| 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_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/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | |
| 17 #include "chrome/browser/ui/webui/web_dialog_ui.h" | |
| 18 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 20 #include "content/public/browser/web_ui_message_handler.h" | 18 #include "content/public/browser/web_ui_message_handler.h" |
| 19 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 20 #include "ui/web_dialogs/web_dialog_ui.h" |
| 21 | 21 |
| 22 class GURL; | 22 class GURL; |
| 23 class CloudPrintWebDialogDelegateTest; | 23 class CloudPrintWebDialogDelegateTest; |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class ListValue; | 26 class ListValue; |
| 27 class StringValue; | 27 class StringValue; |
| 28 class Value; | 28 class Value; |
| 29 } | 29 } |
| 30 | 30 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 scoped_ptr<CloudPrintDataSenderHelper> print_data_helper_; | 150 scoped_ptr<CloudPrintDataSenderHelper> print_data_helper_; |
| 151 bool close_after_signin_; | 151 bool close_after_signin_; |
| 152 base::Closure callback_; | 152 base::Closure callback_; |
| 153 | 153 |
| 154 DISALLOW_COPY_AND_ASSIGN(CloudPrintFlowHandler); | 154 DISALLOW_COPY_AND_ASSIGN(CloudPrintFlowHandler); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 // State machine used to run the printing dialog. This class is used | 157 // State machine used to run the printing dialog. This class is used |
| 158 // to open and run the web dialog and deletes itself when the dialog | 158 // to open and run the web dialog and deletes itself when the dialog |
| 159 // is closed. | 159 // is closed. |
| 160 class CloudPrintWebDialogDelegate : public WebDialogDelegate { | 160 class CloudPrintWebDialogDelegate : public ui::WebDialogDelegate { |
| 161 public: | 161 public: |
| 162 CloudPrintWebDialogDelegate(content::BrowserContext* browser_context, | 162 CloudPrintWebDialogDelegate(content::BrowserContext* browser_context, |
| 163 gfx::NativeWindow modal_parent, | 163 gfx::NativeWindow modal_parent, |
| 164 const FilePath& path_to_file, | 164 const FilePath& path_to_file, |
| 165 const std::string& json_arguments, | 165 const std::string& json_arguments, |
| 166 const string16& print_job_title, | 166 const string16& print_job_title, |
| 167 const string16& print_ticket, | 167 const string16& print_ticket, |
| 168 const std::string& file_type, | 168 const std::string& file_type, |
| 169 bool delete_on_close, | 169 bool delete_on_close, |
| 170 bool close_after_signin, | 170 bool close_after_signin, |
| 171 const base::Closure& callback); | 171 const base::Closure& callback); |
| 172 virtual ~CloudPrintWebDialogDelegate(); | 172 virtual ~CloudPrintWebDialogDelegate(); |
| 173 | 173 |
| 174 // WebDialogDelegate implementation: | 174 // ui::WebDialogDelegate implementation: |
| 175 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | 175 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
| 176 virtual string16 GetDialogTitle() const OVERRIDE; | 176 virtual string16 GetDialogTitle() const OVERRIDE; |
| 177 virtual GURL GetDialogContentURL() const OVERRIDE; | 177 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 178 virtual void GetWebUIMessageHandlers( | 178 virtual void GetWebUIMessageHandlers( |
| 179 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; | 179 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 180 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 180 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 181 virtual std::string GetDialogArgs() const OVERRIDE; | 181 virtual std::string GetDialogArgs() const OVERRIDE; |
| 182 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 182 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 183 virtual void OnCloseContents(content::WebContents* source, | 183 virtual void OnCloseContents(content::WebContents* source, |
| 184 bool* out_close_dialog) OVERRIDE; | 184 bool* out_close_dialog) OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 198 const std::string& json_arguments); | 198 const std::string& json_arguments); |
| 199 | 199 |
| 200 bool delete_on_close_; | 200 bool delete_on_close_; |
| 201 CloudPrintFlowHandler* flow_handler_; | 201 CloudPrintFlowHandler* flow_handler_; |
| 202 gfx::NativeWindow modal_parent_; | 202 gfx::NativeWindow modal_parent_; |
| 203 mutable bool owns_flow_handler_; | 203 mutable bool owns_flow_handler_; |
| 204 FilePath path_to_file_; | 204 FilePath path_to_file_; |
| 205 bool keep_alive_when_non_modal_; | 205 bool keep_alive_when_non_modal_; |
| 206 | 206 |
| 207 // The parameters needed to display a modal web dialog. | 207 // The parameters needed to display a modal web dialog. |
| 208 WebDialogUI::WebDialogParams params_; | 208 ui::WebDialogUI::WebDialogParams params_; |
| 209 | 209 |
| 210 DISALLOW_COPY_AND_ASSIGN(CloudPrintWebDialogDelegate); | 210 DISALLOW_COPY_AND_ASSIGN(CloudPrintWebDialogDelegate); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 void CreateDialogFullImpl(content::BrowserContext* browser_context, | 213 void CreateDialogFullImpl(content::BrowserContext* browser_context, |
| 214 gfx::NativeWindow modal_parent, | 214 gfx::NativeWindow modal_parent, |
| 215 const FilePath& path_to_file, | 215 const FilePath& path_to_file, |
| 216 const string16& print_job_title, | 216 const string16& print_job_title, |
| 217 const string16& print_ticket, | 217 const string16& print_ticket, |
| 218 const std::string& file_type, | 218 const std::string& file_type, |
| 219 bool delete_on_close); | 219 bool delete_on_close); |
| 220 void CreateDialogSigninImpl(content::BrowserContext* browser_context, | 220 void CreateDialogSigninImpl(content::BrowserContext* browser_context, |
| 221 gfx::NativeWindow modal_parent, | 221 gfx::NativeWindow modal_parent, |
| 222 const base::Closure& callback); | 222 const base::Closure& callback); |
| 223 | 223 |
| 224 void Delete(const FilePath& path_to_file); | 224 void Delete(const FilePath& path_to_file); |
| 225 | 225 |
| 226 } // namespace internal_cloud_print_helpers | 226 } // namespace internal_cloud_print_helpers |
| 227 | 227 |
| 228 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ | 228 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_INTERNAL_H_ |
| OLD | NEW |