• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PPAPI_PROXY_PDF_RESOURCE_H_
6 #define PPAPI_PROXY_PDF_RESOURCE_H_
7 
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_var.h"
12 #include "ppapi/c/private/ppb_flash.h"
13 #include "ppapi/proxy/connection.h"
14 #include "ppapi/proxy/plugin_resource.h"
15 #include "ppapi/proxy/ppapi_proxy_export.h"
16 #include "ppapi/thunk/ppb_pdf_api.h"
17 
18 namespace ppapi {
19 namespace proxy {
20 
21 class PluginDispatcher;
22 
23 class PPAPI_PROXY_EXPORT PDFResource
24     : public PluginResource,
25       public thunk::PPB_PDF_API {
26  public:
27   PDFResource(Connection connection, PP_Instance instance);
28   virtual ~PDFResource();
29 
30   // For unittesting with a given locale.
SetLocaleForTest(const std::string & locale)31   void SetLocaleForTest(const std::string& locale) {
32     locale_ = locale;
33   }
34 
35   // Resource override.
36   virtual thunk::PPB_PDF_API* AsPPB_PDF_API() OVERRIDE;
37 
38   // PPB_PDF_API implementation.
39   PP_Var GetLocalizedString(PP_ResourceString string_id) OVERRIDE;
40   virtual void SearchString(const unsigned short* input_string,
41                             const unsigned short* input_term,
42                             bool case_sensitive,
43                             PP_PrivateFindResult** results,
44                             int* count) OVERRIDE;
45   virtual void DidStartLoading() OVERRIDE;
46   virtual void DidStopLoading() OVERRIDE;
47   virtual void SetContentRestriction(int restrictions) OVERRIDE;
48   virtual void HistogramPDFPageCount(int count) OVERRIDE;
49   virtual void UserMetricsRecordAction(const PP_Var& action) OVERRIDE;
50   virtual void HasUnsupportedFeature() OVERRIDE;
51   virtual void Print() OVERRIDE;
52   virtual void SaveAs() OVERRIDE;
53   virtual PP_Bool IsFeatureEnabled(PP_PDFFeature feature) OVERRIDE;
54   virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id,
55                                                float scale) OVERRIDE;
56   virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) OVERRIDE;
57   virtual PP_Bool IsOutOfProcess() OVERRIDE;
58   virtual void SetSelectedText(const char* selected_text) OVERRIDE;
59   virtual void SetLinkUnderCursor(const char* url) OVERRIDE;
60 
61  private:
62   std::string locale_;
63 
64   DISALLOW_COPY_AND_ASSIGN(PDFResource);
65 };
66 
67 }  // namespace proxy
68 }  // namespace ppapi
69 
70 #endif  // PPAPI_PROXY_PDF_RESOURCE_H_
71