OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PDF_OUT_OF_PROCESS_INSTANCE_H_ | 5 #ifndef PDF_OUT_OF_PROCESS_INSTANCE_H_ |
6 #define PDF_OUT_OF_PROCESS_INSTANCE_H_ | 6 #define PDF_OUT_OF_PROCESS_INSTANCE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <queue> | 10 #include <queue> |
9 #include <set> | 11 #include <set> |
10 #include <string> | 12 #include <string> |
11 #include <utility> | 13 #include <utility> |
12 #include <vector> | 14 #include <vector> |
13 | 15 |
| 16 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
15 #include "pdf/paint_manager.h" | 18 #include "pdf/paint_manager.h" |
16 #include "pdf/pdf_engine.h" | 19 #include "pdf/pdf_engine.h" |
17 #include "pdf/preview_mode_client.h" | 20 #include "pdf/preview_mode_client.h" |
18 | 21 |
19 #include "ppapi/c/private/ppb_pdf.h" | 22 #include "ppapi/c/private/ppb_pdf.h" |
20 #include "ppapi/c/private/ppp_pdf.h" | 23 #include "ppapi/c/private/ppp_pdf.h" |
21 #include "ppapi/cpp/dev/printing_dev.h" | 24 #include "ppapi/cpp/dev/printing_dev.h" |
22 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" | 25 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" |
23 #include "ppapi/cpp/graphics_2d.h" | 26 #include "ppapi/cpp/graphics_2d.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void ScheduleCallback(int id, int delay_in_ms) override; | 121 void ScheduleCallback(int id, int delay_in_ms) override; |
119 void SearchString(const base::char16* string, | 122 void SearchString(const base::char16* string, |
120 const base::char16* term, | 123 const base::char16* term, |
121 bool case_sensitive, | 124 bool case_sensitive, |
122 std::vector<SearchStringResult>* results) override; | 125 std::vector<SearchStringResult>* results) override; |
123 void DocumentPaintOccurred() override; | 126 void DocumentPaintOccurred() override; |
124 void DocumentLoadComplete(int page_count) override; | 127 void DocumentLoadComplete(int page_count) override; |
125 void DocumentLoadFailed() override; | 128 void DocumentLoadFailed() override; |
126 pp::Instance* GetPluginInstance() override; | 129 pp::Instance* GetPluginInstance() override; |
127 void DocumentHasUnsupportedFeature(const std::string& feature) override; | 130 void DocumentHasUnsupportedFeature(const std::string& feature) override; |
128 void DocumentLoadProgress(uint32 available, uint32 doc_size) override; | 131 void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override; |
129 void FormTextFieldFocusChange(bool in_focus) override; | 132 void FormTextFieldFocusChange(bool in_focus) override; |
130 bool IsPrintPreview() override; | 133 bool IsPrintPreview() override; |
131 uint32 GetBackgroundColor() override; | 134 uint32_t GetBackgroundColor() override; |
132 void IsSelectingChanged(bool is_selecting) override; | 135 void IsSelectingChanged(bool is_selecting) override; |
133 | 136 |
134 // PreviewModeClient::Client implementation. | 137 // PreviewModeClient::Client implementation. |
135 void PreviewDocumentLoadComplete() override; | 138 void PreviewDocumentLoadComplete() override; |
136 void PreviewDocumentLoadFailed() override; | 139 void PreviewDocumentLoadFailed() override; |
137 | 140 |
138 // Helper functions for implementing PPP_PDF. | 141 // Helper functions for implementing PPP_PDF. |
139 void RotateClockwise(); | 142 void RotateClockwise(); |
140 void RotateCounterclockwise(); | 143 void RotateCounterclockwise(); |
141 | 144 |
142 private: | 145 private: |
143 void ResetRecentlySentFindUpdate(int32_t); | 146 void ResetRecentlySentFindUpdate(int32_t); |
144 | 147 |
145 // Called whenever the plugin geometry changes to update the location of the | 148 // Called whenever the plugin geometry changes to update the location of the |
146 // background parts, and notifies the pdf engine. | 149 // background parts, and notifies the pdf engine. |
147 void OnGeometryChanged(double old_zoom, float old_device_scale); | 150 void OnGeometryChanged(double old_zoom, float old_device_scale); |
148 | 151 |
149 // Figures out the location of any background rectangles (i.e. those that | 152 // Figures out the location of any background rectangles (i.e. those that |
150 // aren't painted by the PDF engine). | 153 // aren't painted by the PDF engine). |
151 void CalculateBackgroundParts(); | 154 void CalculateBackgroundParts(); |
152 | 155 |
153 // Computes document width/height in device pixels, based on current zoom and | 156 // Computes document width/height in device pixels, based on current zoom and |
154 // device scale | 157 // device scale |
155 int GetDocumentPixelWidth() const; | 158 int GetDocumentPixelWidth() const; |
156 int GetDocumentPixelHeight() const; | 159 int GetDocumentPixelHeight() const; |
157 | 160 |
158 // Draws a rectangle with the specified dimensions and color in our buffer. | 161 // Draws a rectangle with the specified dimensions and color in our buffer. |
159 void FillRect(const pp::Rect& rect, uint32 color); | 162 void FillRect(const pp::Rect& rect, uint32_t color); |
160 | 163 |
161 void LoadUrl(const std::string& url); | 164 void LoadUrl(const std::string& url); |
162 void LoadPreviewUrl(const std::string& url); | 165 void LoadPreviewUrl(const std::string& url); |
163 void LoadUrlInternal(const std::string& url, pp::URLLoader* loader, | 166 void LoadUrlInternal(const std::string& url, pp::URLLoader* loader, |
164 void (OutOfProcessInstance::* method)(int32_t)); | 167 void (OutOfProcessInstance::* method)(int32_t)); |
165 | 168 |
166 // Creates a URL loader and allows it to access all urls, i.e. not just the | 169 // Creates a URL loader and allows it to access all urls, i.e. not just the |
167 // frame's origin. | 170 // frame's origin. |
168 pp::URLLoader CreateURLLoaderInternal(); | 171 pp::URLLoader CreateURLLoaderInternal(); |
169 | 172 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 double zoom_; // Current zoom factor. | 225 double zoom_; // Current zoom factor. |
223 | 226 |
224 float device_scale_; // Current device scale factor. | 227 float device_scale_; // Current device scale factor. |
225 // True if the plugin is full-page. | 228 // True if the plugin is full-page. |
226 bool full_; | 229 bool full_; |
227 | 230 |
228 PaintManager paint_manager_; | 231 PaintManager paint_manager_; |
229 | 232 |
230 struct BackgroundPart { | 233 struct BackgroundPart { |
231 pp::Rect location; | 234 pp::Rect location; |
232 uint32 color; | 235 uint32_t color; |
233 }; | 236 }; |
234 std::vector<BackgroundPart> background_parts_; | 237 std::vector<BackgroundPart> background_parts_; |
235 | 238 |
236 struct PrintSettings { | 239 struct PrintSettings { |
237 PrintSettings() { | 240 PrintSettings() { |
238 Clear(); | 241 Clear(); |
239 } | 242 } |
240 void Clear() { | 243 void Clear() { |
241 is_printing = false; | 244 is_printing = false; |
242 print_pages_called_ = false; | 245 print_pages_called_ = false; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // request so that it can start the throbber. We will tell it again once the | 329 // request so that it can start the throbber. We will tell it again once the |
327 // document finishes loading. | 330 // document finishes loading. |
328 bool did_call_start_loading_; | 331 bool did_call_start_loading_; |
329 | 332 |
330 // If this is true, then don't scroll the plugin in response to DidChangeView | 333 // If this is true, then don't scroll the plugin in response to DidChangeView |
331 // messages. This will be true when the extension page is in the process of | 334 // messages. This will be true when the extension page is in the process of |
332 // zooming the plugin so that flickering doesn't occur while zooming. | 335 // zooming the plugin so that flickering doesn't occur while zooming. |
333 bool stop_scrolling_; | 336 bool stop_scrolling_; |
334 | 337 |
335 // The background color of the PDF viewer. | 338 // The background color of the PDF viewer. |
336 uint32 background_color_; | 339 uint32_t background_color_; |
337 | 340 |
338 // The blank space above the first page of the document reserved for the | 341 // The blank space above the first page of the document reserved for the |
339 // toolbar. | 342 // toolbar. |
340 int top_toolbar_height_; | 343 int top_toolbar_height_; |
341 | 344 |
342 DISALLOW_COPY_AND_ASSIGN(OutOfProcessInstance); | 345 DISALLOW_COPY_AND_ASSIGN(OutOfProcessInstance); |
343 }; | 346 }; |
344 | 347 |
345 } // namespace chrome_pdf | 348 } // namespace chrome_pdf |
346 | 349 |
347 #endif // PDF_OUT_OF_PROCESS_INSTANCE_H_ | 350 #endif // PDF_OUT_OF_PROCESS_INSTANCE_H_ |
OLD | NEW |