| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ |
| 6 #define CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 15 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 16 #include "content/browser/webui/web_ui.h" | |
| 17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/web_ui_message_handler.h" |
| 19 | 19 |
| 20 class GURL; | 20 class GURL; |
| 21 class CloudPrintHtmlDialogDelegateTest; | 21 class CloudPrintHtmlDialogDelegateTest; |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class ListValue; | 24 class ListValue; |
| 25 class StringValue; | 25 class StringValue; |
| 26 class Value; | 26 class Value; |
| 27 } | 27 } |
| 28 | 28 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 class CloudPrintHtmlDialogDelegate; | 94 class CloudPrintHtmlDialogDelegate; |
| 95 | 95 |
| 96 // The CloudPrintFlowHandler connects the state machine (the UI delegate) | 96 // The CloudPrintFlowHandler connects the state machine (the UI delegate) |
| 97 // to the dialog backing HTML and JS by providing WebUIMessageHandler | 97 // to the dialog backing HTML and JS by providing WebUIMessageHandler |
| 98 // functions for the JS to use. This include refreshing the page | 98 // functions for the JS to use. This include refreshing the page |
| 99 // setup parameters (which will cause a re-generation of the PDF in | 99 // setup parameters (which will cause a re-generation of the PDF in |
| 100 // the renderer process - do we want a progress throbber shown? | 100 // the renderer process - do we want a progress throbber shown? |
| 101 // Probably..), and packing up the PDF and job parameters and sending | 101 // Probably..), and packing up the PDF and job parameters and sending |
| 102 // them to the cloud. | 102 // them to the cloud. |
| 103 class CloudPrintFlowHandler : public WebUIMessageHandler, | 103 class CloudPrintFlowHandler : public content::WebUIMessageHandler, |
| 104 public content::NotificationObserver { | 104 public content::NotificationObserver { |
| 105 public: | 105 public: |
| 106 CloudPrintFlowHandler(const FilePath& path_to_file, | 106 CloudPrintFlowHandler(const FilePath& path_to_file, |
| 107 const string16& print_job_title, | 107 const string16& print_job_title, |
| 108 const string16& print_ticket, | 108 const string16& print_ticket, |
| 109 const std::string& file_type); | 109 const std::string& file_type); |
| 110 virtual ~CloudPrintFlowHandler(); | 110 virtual ~CloudPrintFlowHandler(); |
| 111 | 111 |
| 112 // WebUIMessageHandler implementation. | 112 // WebUIMessageHandler implementation. |
| 113 virtual void RegisterMessages() OVERRIDE; | 113 virtual void RegisterMessages() OVERRIDE; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 const std::string& file_type, | 160 const std::string& file_type, |
| 161 bool modal, | 161 bool modal, |
| 162 bool delete_on_close); | 162 bool delete_on_close); |
| 163 virtual ~CloudPrintHtmlDialogDelegate(); | 163 virtual ~CloudPrintHtmlDialogDelegate(); |
| 164 | 164 |
| 165 // HTMLDialogUIDelegate implementation: | 165 // HTMLDialogUIDelegate implementation: |
| 166 virtual bool IsDialogModal() const OVERRIDE; | 166 virtual bool IsDialogModal() const OVERRIDE; |
| 167 virtual string16 GetDialogTitle() const OVERRIDE; | 167 virtual string16 GetDialogTitle() const OVERRIDE; |
| 168 virtual GURL GetDialogContentURL() const OVERRIDE; | 168 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 169 virtual void GetWebUIMessageHandlers( | 169 virtual void GetWebUIMessageHandlers( |
| 170 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | 170 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 171 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 171 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 172 virtual std::string GetDialogArgs() const OVERRIDE; | 172 virtual std::string GetDialogArgs() const OVERRIDE; |
| 173 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 173 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 174 virtual void OnCloseContents(content::WebContents* source, | 174 virtual void OnCloseContents(content::WebContents* source, |
| 175 bool* out_close_dialog) OVERRIDE; | 175 bool* out_close_dialog) OVERRIDE; |
| 176 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 176 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
| 177 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; | 177 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; |
| 178 | 178 |
| 179 private: | 179 private: |
| 180 friend class ::CloudPrintHtmlDialogDelegateTest; | 180 friend class ::CloudPrintHtmlDialogDelegateTest; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 204 const string16& print_ticket, | 204 const string16& print_ticket, |
| 205 const std::string& file_type, | 205 const std::string& file_type, |
| 206 bool modal, | 206 bool modal, |
| 207 bool delete_on_close); | 207 bool delete_on_close); |
| 208 | 208 |
| 209 void Delete(const FilePath& path_to_file); | 209 void Delete(const FilePath& path_to_file); |
| 210 | 210 |
| 211 } // namespace internal_cloud_print_helpers | 211 } // namespace internal_cloud_print_helpers |
| 212 | 212 |
| 213 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ | 213 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ |
| OLD | NEW |