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 CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/printing/print_view_manager_observer.h" | 14 #include "chrome/browser/printing/print_view_manager_observer.h" |
| 15 #include "chrome/browser/ui/webui/print_preview/hidden_print_preview.h" |
15 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 16 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
16 #include "content/public/browser/web_ui_message_handler.h" | 17 #include "content/public/browser/web_ui_message_handler.h" |
17 #include "ui/shell_dialogs/select_file_dialog.h" | 18 #include "ui/shell_dialogs/select_file_dialog.h" |
18 | 19 |
19 #if defined(ENABLE_SERVICE_DISCOVERY) | 20 #if defined(ENABLE_SERVICE_DISCOVERY) |
20 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" | 21 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" |
21 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 22 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
22 #endif // ENABLE_SERVICE_DISCOVERY | 23 #endif // ENABLE_SERVICE_DISCOVERY |
23 | 24 |
24 class PrinterHandler; | 25 class PrinterHandler; |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void OnGotExtensionPrinterCapabilities( | 327 void OnGotExtensionPrinterCapabilities( |
327 const std::string& printer_id, | 328 const std::string& printer_id, |
328 const base::DictionaryValue& capabilities); | 329 const base::DictionaryValue& capabilities); |
329 | 330 |
330 // Called when an extension print job is completed. | 331 // Called when an extension print job is completed. |
331 // |success|: Whether the job succeeded. | 332 // |success|: Whether the job succeeded. |
332 // |status|: The returned print job status. Useful for reporting a specific | 333 // |status|: The returned print job status. Useful for reporting a specific |
333 // error. | 334 // error. |
334 void OnExtensionPrintResult(bool success, const std::string& status); | 335 void OnExtensionPrintResult(bool success, const std::string& status); |
335 | 336 |
| 337 // Called when the DOM Distiller determines whether or not this page can |
| 338 // be distilled. |
| 339 // |distillable|: Whether or not this page can be distilled. |
| 340 void HandleIsPageDistillableResult(bool distillable); |
| 341 |
336 // Register/unregister from notifications of changes done to the GAIA | 342 // Register/unregister from notifications of changes done to the GAIA |
337 // cookie. | 343 // cookie. |
338 void RegisterForGaiaCookieChanges(); | 344 void RegisterForGaiaCookieChanges(); |
339 void UnregisterForGaiaCookieChanges(); | 345 void UnregisterForGaiaCookieChanges(); |
340 | 346 |
341 // The underlying dialog object. | 347 // The underlying dialog object. |
342 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 348 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
343 | 349 |
344 // A count of how many requests received to regenerate preview data. | 350 // A count of how many requests received to regenerate preview data. |
345 // Initialized to 0 then incremented and emitted to a histogram. | 351 // Initialized to 0 then incremented and emitted to a histogram. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 #endif | 388 #endif |
383 | 389 |
384 // Handles requests for extension printers. Created lazily by calling | 390 // Handles requests for extension printers. Created lazily by calling |
385 // |EnsureExtensionPrinterHandlerSet|. | 391 // |EnsureExtensionPrinterHandlerSet|. |
386 scoped_ptr<PrinterHandler> extension_printer_handler_; | 392 scoped_ptr<PrinterHandler> extension_printer_handler_; |
387 | 393 |
388 // Notifies tests that want to know if the PDF has been saved. This doesn't | 394 // Notifies tests that want to know if the PDF has been saved. This doesn't |
389 // notify the test if it was a successful save, only that it was attempted. | 395 // notify the test if it was a successful save, only that it was attempted. |
390 base::Closure pdf_file_saved_closure_; | 396 base::Closure pdf_file_saved_closure_; |
391 | 397 |
| 398 // A hidden print preview that is responsible for rendering the page |
| 399 // after being processed by the DOM Distiller. |
| 400 scoped_ptr<HiddenPrintPreview> hidden_print_preview_; |
| 401 |
392 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 402 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
393 | 403 |
394 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 404 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
395 }; | 405 }; |
396 | 406 |
397 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 407 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |