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

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

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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/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"
(...skipping 11 matching lines...) Expand all
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.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/browser/renderer_host/render_view_host.h" 31 #include "content/browser/renderer_host/render_view_host.h"
32 #include "content/browser/tab_contents/tab_contents.h"
33 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.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"
36 #include "ui/base/l10n/l10n_font_util.h" 36 #include "ui/base/l10n/l10n_font_util.h"
37 #include "ui/gfx/font.h" 37 #include "ui/gfx/font.h"
38 38
39 using content::OpenURLParams; 39 using content::OpenURLParams;
40 using content::Referrer; 40 using content::Referrer;
41 using content::WebContents; 41 using content::WebContents;
42 42
43 namespace { 43 namespace {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GaiaConstants::kCloudPrintService, 257 GaiaConstants::kCloudPrintService,
258 last_auth_error_.captcha().token, captcha, 258 last_auth_error_.captcha().token, captcha,
259 GaiaAuthFetcher::HostedAccountsAllowed); 259 GaiaAuthFetcher::HostedAccountsAllowed);
260 } 260 }
261 } 261 }
262 262
263 void CloudPrintSetupFlow::OnUserClickedLearnMore() { 263 void CloudPrintSetupFlow::OnUserClickedLearnMore() {
264 OpenURLParams params(CloudPrintURL::GetCloudPrintLearnMoreURL(), 264 OpenURLParams params(CloudPrintURL::GetCloudPrintLearnMoreURL(),
265 Referrer(), NEW_FOREGROUND_TAB, 265 Referrer(), NEW_FOREGROUND_TAB,
266 content::PAGE_TRANSITION_LINK, false); 266 content::PAGE_TRANSITION_LINK, false);
267 web_ui_->tab_contents()->OpenURL(params); 267 web_ui_->web_contents()->OpenURL(params);
268 } 268 }
269 269
270 void CloudPrintSetupFlow::OnUserClickedPrintTestPage() { 270 void CloudPrintSetupFlow::OnUserClickedPrintTestPage() {
271 OpenURLParams params(CloudPrintURL::GetCloudPrintTestPageURL(), 271 OpenURLParams params(CloudPrintURL::GetCloudPrintTestPageURL(),
272 Referrer(), NEW_FOREGROUND_TAB, 272 Referrer(), NEW_FOREGROUND_TAB,
273 content::PAGE_TRANSITION_LINK, false); 273 content::PAGE_TRANSITION_LINK, false);
274 web_ui_->tab_contents()->OpenURL(params); 274 web_ui_->web_contents()->OpenURL(params);
275 } 275 }
276 276
277 /////////////////////////////////////////////////////////////////////////////// 277 ///////////////////////////////////////////////////////////////////////////////
278 // Helper methods for showing contents of the Web UI 278 // Helper methods for showing contents of the Web UI
279 void CloudPrintSetupFlow::ShowGaiaLogin(const DictionaryValue& args) { 279 void CloudPrintSetupFlow::ShowGaiaLogin(const DictionaryValue& args) {
280 if (web_ui_) 280 if (web_ui_)
281 web_ui_->CallJavascriptFunction("cloudprint.showSetupLogin"); 281 web_ui_->CallJavascriptFunction("cloudprint.showSetupLogin");
282 282
283 std::string json; 283 std::string json;
284 base::JSONWriter::Write(&args, false, &json); 284 base::JSONWriter::Write(&args, false, &json);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 331
332 ExecuteJavascriptInIFrame(DoneIframeXPath(), 332 ExecuteJavascriptInIFrame(DoneIframeXPath(),
333 ASCIIToUTF16("cloudprint.onPageShown();")); 333 ASCIIToUTF16("cloudprint.onPageShown();"));
334 } 334 }
335 335
336 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( 336 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame(
337 const string16& iframe_xpath, 337 const string16& iframe_xpath,
338 const string16& js) { 338 const string16& js) {
339 if (web_ui_) { 339 if (web_ui_) {
340 RenderViewHost* rvh = web_ui_->tab_contents()->GetRenderViewHost(); 340 RenderViewHost* rvh = web_ui_->web_contents()->GetRenderViewHost();
341 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); 341 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js);
342 } 342 }
343 } 343 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698