| 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_finder.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 24 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 25 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 25 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
| 26 #include "chrome/common/net/gaia/gaia_constants.h" | 26 #include "chrome/common/net/gaia/gaia_constants.h" |
| 27 #include "chrome/common/net/gaia/google_service_auth_error.h" | 27 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/service_messages.h" | 29 #include "chrome/common/service_messages.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/render_view_host.h" | 31 #include "content/public/browser/render_view_host.h" |
| 32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 55 | 55 |
| 56 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
| 57 // CloudPrintSetupFlow implementation. | 57 // CloudPrintSetupFlow implementation. |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog( | 60 CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog( |
| 61 Profile* profile, | 61 Profile* profile, |
| 62 const base::WeakPtr<Delegate>& delegate, | 62 const base::WeakPtr<Delegate>& delegate, |
| 63 gfx::NativeWindow parent_window) { | 63 gfx::NativeWindow parent_window) { |
| 64 DCHECK(profile); | 64 DCHECK(profile); |
| 65 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 65 Browser* browser = browser::FindLastActiveWithProfile(profile); |
| 66 // Set the arguments for showing the gaia login page. | 66 // Set the arguments for showing the gaia login page. |
| 67 DictionaryValue args; | 67 DictionaryValue args; |
| 68 args.SetString("user", ""); | 68 args.SetString("user", ""); |
| 69 args.SetInteger("error", 0); | 69 args.SetInteger("error", 0); |
| 70 args.SetBoolean("editable_user", true); | 70 args.SetBoolean("editable_user", true); |
| 71 | 71 |
| 72 bool setup_done = false; | 72 bool setup_done = false; |
| 73 if (profile->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) && | 73 if (profile->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) && |
| 74 !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty()) | 74 !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty()) |
| 75 setup_done = true; | 75 setup_done = true; |
| (...skipping 258 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 |