| 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = chrome::FindLastActiveWithProfile(profile, | 65 Browser* browser = chrome::FindLastActiveWithProfile(profile, |
| 66 chrome::GetActiveDesktop()); | 66 chrome::GetActiveDesktop()); |
| 67 // Set the arguments for showing the gaia login page. | 67 // Set the arguments for showing the gaia login page. |
| 68 DictionaryValue args; | 68 DictionaryValue args; |
| 69 args.SetString("user", ""); | 69 args.SetString("user", std::string()); |
| 70 args.SetInteger("error", 0); | 70 args.SetInteger("error", 0); |
| 71 args.SetBoolean("editable_user", true); | 71 args.SetBoolean("editable_user", true); |
| 72 | 72 |
| 73 bool setup_done = false; | 73 bool setup_done = false; |
| 74 if (profile->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) && | 74 if (profile->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) && |
| 75 !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty()) | 75 !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty()) |
| 76 setup_done = true; | 76 setup_done = true; |
| 77 args.SetString("pageToShow", setup_done ? "setupdone" : "cloudprintsetup"); | 77 args.SetString("pageToShow", setup_done ? "setupdone" : "cloudprintsetup"); |
| 78 | 78 |
| 79 std::string json_args; | 79 std::string json_args; |
| (...skipping 254 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 |