| 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 <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "pdf/paint_manager.h" | 15 #include "pdf/paint_manager.h" |
| 16 #include "pdf/pdf_engine.h" | 16 #include "pdf/pdf_engine.h" |
| 17 #include "pdf/preview_mode_client.h" | 17 #include "pdf/preview_mode_client.h" |
| 18 | 18 |
| 19 #include "ppapi/c/private/ppb_pdf.h" | 19 #include "ppapi/c/private/ppb_pdf.h" |
| 20 #include "ppapi/cpp/dev/printing_dev.h" | 20 #include "ppapi/cpp/dev/printing_dev.h" |
| 21 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" | 21 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" |
| 22 #include "ppapi/cpp/dev/selection_dev.h" | 22 #include "ppapi/cpp/dev/selection_dev.h" |
| 23 #include "ppapi/cpp/graphics_2d.h" | 23 #include "ppapi/cpp/graphics_2d.h" |
| 24 #include "ppapi/cpp/image_data.h" | 24 #include "ppapi/cpp/image_data.h" |
| 25 #include "ppapi/cpp/input_event.h" | 25 #include "ppapi/cpp/input_event.h" |
| 26 #include "ppapi/cpp/instance.h" | 26 #include "ppapi/cpp/instance.h" |
| 27 #include "ppapi/cpp/private/find_private.h" | 27 #include "ppapi/cpp/private/find_private.h" |
| 28 #include "ppapi/cpp/private/uma_private.h" | 28 #include "ppapi/cpp/private/uma_private.h" |
| 29 #include "ppapi/cpp/private/var_private.h" | |
| 30 #include "ppapi/cpp/url_loader.h" | 29 #include "ppapi/cpp/url_loader.h" |
| 31 #include "ppapi/utility/completion_callback_factory.h" | 30 #include "ppapi/utility/completion_callback_factory.h" |
| 32 | 31 |
| 33 namespace pp { | 32 namespace pp { |
| 34 class TextInput_Dev; | 33 class TextInput_Dev; |
| 35 } | 34 } |
| 36 | 35 |
| 37 namespace chrome_pdf { | 36 namespace chrome_pdf { |
| 38 | 37 |
| 39 class OutOfProcessInstance : public pp::Instance, | 38 class OutOfProcessInstance : public pp::Instance, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 197 |
| 199 // Process the preview page data information. |src_url| specifies the preview | 198 // Process the preview page data information. |src_url| specifies the preview |
| 200 // page data location. The |src_url| is in the format: | 199 // page data location. The |src_url| is in the format: |
| 201 // chrome://print/id/page_number/print.pdf | 200 // chrome://print/id/page_number/print.pdf |
| 202 // |dst_page_index| specifies the blank page index that needs to be replaced | 201 // |dst_page_index| specifies the blank page index that needs to be replaced |
| 203 // with the new page data. | 202 // with the new page data. |
| 204 void ProcessPreviewPageInfo(const std::string& src_url, int dst_page_index); | 203 void ProcessPreviewPageInfo(const std::string& src_url, int dst_page_index); |
| 205 // Load the next available preview page into the blank page. | 204 // Load the next available preview page into the blank page. |
| 206 void LoadAvailablePreviewPage(); | 205 void LoadAvailablePreviewPage(); |
| 207 | 206 |
| 207 // Bound the given scroll offset to the document. |
| 208 pp::Point BoundScrollOffsetToDocument(const pp::Point& scroll_offset); |
| 209 |
| 208 pp::ImageData image_data_; | 210 pp::ImageData image_data_; |
| 209 // Used when the plugin is embedded in a page and we have to create the loader | 211 // Used when the plugin is embedded in a page and we have to create the loader |
| 210 // ourself. | 212 // ourself. |
| 211 pp::CompletionCallbackFactory<OutOfProcessInstance> loader_factory_; | 213 pp::CompletionCallbackFactory<OutOfProcessInstance> loader_factory_; |
| 212 pp::URLLoader embed_loader_; | 214 pp::URLLoader embed_loader_; |
| 213 pp::URLLoader embed_preview_loader_; | 215 pp::URLLoader embed_preview_loader_; |
| 214 | 216 |
| 215 PP_CursorType_Dev cursor_; // The current cursor. | 217 PP_CursorType_Dev cursor_; // The current cursor. |
| 216 | 218 |
| 217 pp::CompletionCallbackFactory<OutOfProcessInstance> timer_factory_; | 219 pp::CompletionCallbackFactory<OutOfProcessInstance> timer_factory_; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 279 |
| 278 // Used for printing without re-entrancy issues. | 280 // Used for printing without re-entrancy issues. |
| 279 pp::CompletionCallbackFactory<OutOfProcessInstance> print_callback_factory_; | 281 pp::CompletionCallbackFactory<OutOfProcessInstance> print_callback_factory_; |
| 280 | 282 |
| 281 // True if we haven't painted the plugin viewport yet. | 283 // True if we haven't painted the plugin viewport yet. |
| 282 bool first_paint_; | 284 bool first_paint_; |
| 283 | 285 |
| 284 DocumentLoadState document_load_state_; | 286 DocumentLoadState document_load_state_; |
| 285 DocumentLoadState preview_document_load_state_; | 287 DocumentLoadState preview_document_load_state_; |
| 286 | 288 |
| 287 // JavaScript interface to control this instance. | |
| 288 // This wraps a PDFScriptableObject in a pp::Var. | |
| 289 pp::VarPrivate instance_object_; | |
| 290 | |
| 291 // A UMA resource for histogram reporting. | 289 // A UMA resource for histogram reporting. |
| 292 pp::UMAPrivate uma_; | 290 pp::UMAPrivate uma_; |
| 293 | 291 |
| 294 // Used so that we only tell the browser once about an unsupported feature, to | 292 // Used so that we only tell the browser once about an unsupported feature, to |
| 295 // avoid the infobar going up more than once. | 293 // avoid the infobar going up more than once. |
| 296 bool told_browser_about_unsupported_feature_; | 294 bool told_browser_about_unsupported_feature_; |
| 297 | 295 |
| 298 // Keeps track of which unsupported features we reported, so we avoid spamming | 296 // Keeps track of which unsupported features we reported, so we avoid spamming |
| 299 // the stats if a feature shows up many times per document. | 297 // the stats if a feature shows up many times per document. |
| 300 std::set<std::string> unsupported_features_reported_; | 298 std::set<std::string> unsupported_features_reported_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 326 | 324 |
| 327 // Whether the plugin has received a viewport changed message. Nothing should | 325 // Whether the plugin has received a viewport changed message. Nothing should |
| 328 // be painted until this is received. | 326 // be painted until this is received. |
| 329 bool received_viewport_message_; | 327 bool received_viewport_message_; |
| 330 | 328 |
| 331 // If true, this means we told the RenderView that we're starting a network | 329 // If true, this means we told the RenderView that we're starting a network |
| 332 // request so that it can start the throbber. We will tell it again once the | 330 // request so that it can start the throbber. We will tell it again once the |
| 333 // document finishes loading. | 331 // document finishes loading. |
| 334 bool did_call_start_loading_; | 332 bool did_call_start_loading_; |
| 335 | 333 |
| 334 // If this is true, then don't scroll the plugin in response to DidChangeView |
| 335 // messages. This will be true when the extension page is in the process of |
| 336 // zooming the plugin so that flickering doesn't occur while zooming. |
| 337 bool stop_scrolling_; |
| 338 |
| 336 // The callback for receiving the password from the page. | 339 // The callback for receiving the password from the page. |
| 337 scoped_ptr<pp::CompletionCallbackWithOutput<pp::Var> > password_callback_; | 340 scoped_ptr<pp::CompletionCallbackWithOutput<pp::Var> > password_callback_; |
| 338 }; | 341 }; |
| 339 | 342 |
| 340 } // namespace chrome_pdf | 343 } // namespace chrome_pdf |
| 341 | 344 |
| 342 #endif // PDF_OUT_OF_PROCESS_INSTANCE_H_ | 345 #endif // PDF_OUT_OF_PROCESS_INSTANCE_H_ |
| OLD | NEW |