Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc

Issue 6685008: Cloud print signin crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase past Windows views options removal. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #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/singleton.h" 8 #include "base/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"
(...skipping 27 matching lines...) Expand all
38 #include "ui/gfx/font.h" 38 #include "ui/gfx/font.h"
39 39
40 static const wchar_t kGaiaLoginIFrameXPath[] = L"//iframe[@id='gaialogin']"; 40 static const wchar_t kGaiaLoginIFrameXPath[] = L"//iframe[@id='gaialogin']";
41 static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='setupdone']"; 41 static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='setupdone']";
42 42
43 //////////////////////////////////////////////////////////////////////////////// 43 ////////////////////////////////////////////////////////////////////////////////
44 // CloudPrintSetupFlow implementation. 44 // CloudPrintSetupFlow implementation.
45 45
46 // static 46 // static
47 CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog( 47 CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog(
48 Profile* profile, Delegate* delegate, gfx::NativeWindow parent_window) { 48 Profile* profile, const base::WeakPtr<Delegate>& delegate,
49 gfx::NativeWindow parent_window) {
49 DCHECK(profile); 50 DCHECK(profile);
50 // Set the arguments for showing the gaia login page. 51 // Set the arguments for showing the gaia login page.
51 DictionaryValue args; 52 DictionaryValue args;
52 args.SetString("user", ""); 53 args.SetString("user", "");
53 args.SetInteger("error", 0); 54 args.SetInteger("error", 0);
54 args.SetBoolean("editable_user", true); 55 args.SetBoolean("editable_user", true);
55 56
56 bool setup_done = false; 57 bool setup_done = false;
57 if (profile->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) && 58 if (profile->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) &&
58 !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty()) 59 !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty())
(...skipping 11 matching lines...) Expand all
70 // using a browser. 71 // using a browser.
71 if (!parent_window) { 72 if (!parent_window) {
72 Browser* browser = BrowserList::GetLastActive(); 73 Browser* browser = BrowserList::GetLastActive();
73 if (browser && browser->window()) 74 if (browser && browser->window())
74 parent_window = browser->window()->GetNativeHandle(); 75 parent_window = browser->window()->GetNativeHandle();
75 } 76 }
76 browser::ShowHtmlDialog(parent_window, profile, flow); 77 browser::ShowHtmlDialog(parent_window, profile, flow);
77 return flow; 78 return flow;
78 } 79 }
79 80
80 CloudPrintSetupFlow::CloudPrintSetupFlow(const std::string& args, 81 CloudPrintSetupFlow::CloudPrintSetupFlow(
81 Profile* profile, 82 const std::string& args,
82 Delegate* delegate, 83 Profile* profile,
83 bool setup_done) 84 const base::WeakPtr<Delegate>& delegate,
85 bool setup_done)
84 : web_ui_(NULL), 86 : web_ui_(NULL),
85 dialog_start_args_(args), 87 dialog_start_args_(args),
86 setup_done_(setup_done), 88 setup_done_(setup_done),
87 process_control_(NULL), 89 process_control_(NULL),
88 delegate_(delegate) { 90 delegate_(delegate) {
89 // TODO(hclam): The data source should be added once. 91 // TODO(hclam): The data source should be added once.
90 profile_ = profile; 92 profile_ = profile;
91 profile->GetChromeURLDataManager()->AddDataSource( 93 profile->GetChromeURLDataManager()->AddDataSource(
92 new CloudPrintSetupSource()); 94 new CloudPrintSetupSource());
93 } 95 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 293
292 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( 294 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame(
293 const std::wstring& iframe_xpath, 295 const std::wstring& iframe_xpath,
294 const std::wstring& js) { 296 const std::wstring& js) {
295 if (web_ui_) { 297 if (web_ui_) {
296 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host(); 298 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host();
297 rvh->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), 299 rvh->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath),
298 WideToUTF16Hack(js)); 300 WideToUTF16Hack(js));
299 } 301 }
300 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698