| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 ANDROID_WEBVIEW_BROWSER_PRINT_MANAGER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_PRINT_MANAGER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_PRINT_MANAGER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_PRINT_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/printing/browser/print_manager.h" | 9 #include "components/printing/browser/print_manager.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
| 11 #include "printing/print_settings.h" | 11 #include "printing/print_settings.h" |
| 12 | 12 |
| 13 namespace android_webview { | 13 namespace android_webview { |
| 14 | 14 |
| 15 class AwPrintManager : public printing::PrintManager, | 15 class AwPrintManager : public printing::PrintManager, |
| 16 public content::WebContentsUserData<AwPrintManager> { | 16 public content::WebContentsUserData<AwPrintManager> { |
| 17 public: | 17 public: |
| 18 // Creates a AwPrintManager for the provided webcontents. If the | 18 // Creates an AwPrintManager for the provided WebContents. If the |
| 19 // AwPrintManager already exists, it is destroyed and a new one is created. | 19 // AwPrintManager already exists, it is destroyed and a new one is created. |
| 20 static AwPrintManager* CreateForWebContents( | 20 static AwPrintManager* CreateForWebContents( |
| 21 content::WebContents* contents, | 21 content::WebContents* contents, |
| 22 const printing::PrintSettings& settings, | 22 const printing::PrintSettings& settings, |
| 23 const base::FileDescriptor& file_descriptor, | 23 const base::FileDescriptor& file_descriptor, |
| 24 const PdfWritingDoneCallback& callback); | 24 const PdfWritingDoneCallback& callback); |
| 25 | 25 |
| 26 ~AwPrintManager() override; | 26 ~AwPrintManager() override; |
| 27 | 27 |
| 28 bool PrintNow(); | 28 bool PrintNow(); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 friend class content::WebContentsUserData<AwPrintManager>; | 31 friend class content::WebContentsUserData<AwPrintManager>; |
| 32 |
| 32 AwPrintManager(content::WebContents* contents, | 33 AwPrintManager(content::WebContents* contents, |
| 33 const printing::PrintSettings& settings, | 34 const printing::PrintSettings& settings, |
| 34 const base::FileDescriptor& file_descriptor, | 35 const base::FileDescriptor& file_descriptor, |
| 35 const PdfWritingDoneCallback& callback); | 36 const PdfWritingDoneCallback& callback); |
| 36 | 37 |
| 37 bool OnMessageReceived(const IPC::Message& message) override; | 38 bool OnMessageReceived(const IPC::Message& message) override; |
| 38 void OnGetDefaultPrintSettings(IPC::Message* reply_msg); | 39 void OnGetDefaultPrintSettings(IPC::Message* reply_msg); |
| 39 | 40 |
| 40 printing::PrintSettings settings_; | 41 printing::PrintSettings settings_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(AwPrintManager); | 43 DISALLOW_COPY_AND_ASSIGN(AwPrintManager); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace android_webview | 46 } // namespace android_webview |
| 46 | 47 |
| 47 #endif // ANDROID_WEBVIEW_BROWSER_PRINT_MANAGER_H_ | 48 #endif // ANDROID_WEBVIEW_BROWSER_AW_PRINT_MANAGER_H_ |
| OLD | NEW |