| 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 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 13 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 14 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 14 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 15 #include "chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.
h" | 15 #include "chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.
h" |
| 16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_source.h" | 16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_source.h" |
| 17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/service/service_process_control.h" | 19 #include "chrome/browser/service/service_process_control.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_dialogs.h" | 21 #include "chrome/browser/ui/browser_dialogs.h" |
| 22 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/browser/ui/dialog_style.h" | 24 #include "chrome/browser/ui/dialog_style.h" |
| 25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 25 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" |
| 26 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 26 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
| 27 #include "chrome/common/net/gaia/gaia_constants.h" | 27 #include "chrome/common/net/gaia/gaia_constants.h" |
| 28 #include "chrome/common/net/gaia/google_service_auth_error.h" | 28 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/service_messages.h" | 30 #include "chrome/common/service_messages.h" |
| 31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
| 33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 34 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
| 35 #include "grit/locale_settings.h" | 35 #include "grit/locale_settings.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 const base::WeakPtr<Delegate>& delegate, | 96 const base::WeakPtr<Delegate>& delegate, |
| 97 bool setup_done) | 97 bool setup_done) |
| 98 : web_ui_(NULL), | 98 : web_ui_(NULL), |
| 99 dialog_start_args_(args), | 99 dialog_start_args_(args), |
| 100 last_auth_error_(GoogleServiceAuthError::None()), | 100 last_auth_error_(GoogleServiceAuthError::None()), |
| 101 setup_done_(setup_done), | 101 setup_done_(setup_done), |
| 102 process_control_(NULL), | 102 process_control_(NULL), |
| 103 delegate_(delegate) { | 103 delegate_(delegate) { |
| 104 // TODO(hclam): The data source should be added once. | 104 // TODO(hclam): The data source should be added once. |
| 105 profile_ = profile; | 105 profile_ = profile; |
| 106 profile->GetChromeURLDataManager()->AddDataSource( | 106 ChromeURLDataManagerFactory::GetForProfile(profile)-> |
| 107 new CloudPrintSetupSource()); | 107 AddDataSource(new CloudPrintSetupSource()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 CloudPrintSetupFlow::~CloudPrintSetupFlow() { | 110 CloudPrintSetupFlow::~CloudPrintSetupFlow() { |
| 111 } | 111 } |
| 112 | 112 |
| 113 void CloudPrintSetupFlow::Focus() { | 113 void CloudPrintSetupFlow::Focus() { |
| 114 // TODO(pranavk): implement this method. | 114 // TODO(pranavk): implement this method. |
| 115 NOTIMPLEMENTED(); | 115 NOTIMPLEMENTED(); |
| 116 } | 116 } |
| 117 | 117 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( | 335 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( |
| 336 const string16& iframe_xpath, | 336 const string16& iframe_xpath, |
| 337 const string16& js) { | 337 const string16& js) { |
| 338 if (web_ui_) { | 338 if (web_ui_) { |
| 339 content::RenderViewHost* rvh = | 339 content::RenderViewHost* rvh = |
| 340 web_ui_->GetWebContents()->GetRenderViewHost(); | 340 web_ui_->GetWebContents()->GetRenderViewHost(); |
| 341 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); | 341 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); |
| 342 } | 342 } |
| 343 } | 343 } |
| OLD | NEW |