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

Side by Side Diff: chrome/browser/ui/webui/cloud_print_signin_dialog.cc

Issue 8983010: Convert WebContents to return a content::NavigationController instead of the implementation. Upda... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac 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/ui/webui/cloud_print_signin_dialog.h" 5 #include "chrome/browser/ui/webui/cloud_print_signin_dialog.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 12 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/dialog_style.h" 16 #include "chrome/browser/ui/dialog_style.h"
17 #include "chrome/browser/ui/webui/html_dialog_ui.h" 17 #include "chrome/browser/ui/webui/html_dialog_ui.h"
18 #include "chrome/browser/ui/webui/print_preview_ui.h" 18 #include "chrome/browser/ui/webui/print_preview_ui.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "content/browser/renderer_host/render_view_host.h" 21 #include "content/browser/renderer_host/render_view_host.h"
22 #include "content/browser/tab_contents/navigation_controller.h"
23 #include "content/browser/tab_contents/tab_contents_view.h" 22 #include "content/browser/tab_contents/tab_contents_view.h"
23 #include "content/public/browser/navigation_controller.h"
24 #include "content/public/browser/navigation_entry.h" 24 #include "content/public/browser/navigation_entry.h"
25 #include "content/public/browser/notification_registrar.h" 25 #include "content/public/browser/notification_registrar.h"
26 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
27 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "content/public/browser/web_ui_message_handler.h" 29 #include "content/public/browser/web_ui_message_handler.h"
30 30
31 using content::BrowserThread; 31 using content::BrowserThread;
32 using content::NavigationEntry; 32 using content::NavigationEntry;
33 using content::WebContents; 33 using content::WebContents;
(...skipping 24 matching lines...) Expand all
58 content::NotificationRegistrar registrar_; 58 content::NotificationRegistrar registrar_;
59 WebContents* parent_tab_; 59 WebContents* parent_tab_;
60 }; 60 };
61 61
62 CloudPrintSigninFlowHandler::CloudPrintSigninFlowHandler( 62 CloudPrintSigninFlowHandler::CloudPrintSigninFlowHandler(
63 WebContents* parent_tab) : parent_tab_(parent_tab) { 63 WebContents* parent_tab) : parent_tab_(parent_tab) {
64 } 64 }
65 65
66 void CloudPrintSigninFlowHandler::RegisterMessages() { 66 void CloudPrintSigninFlowHandler::RegisterMessages() {
67 if (web_ui() && web_ui()->web_contents()) { 67 if (web_ui() && web_ui()->web_contents()) {
68 NavigationController* controller = 68 content::NavigationController* controller =
69 &web_ui()->web_contents()->GetController(); 69 &web_ui()->web_contents()->GetController();
70 NavigationEntry* pending_entry = controller->GetPendingEntry(); 70 NavigationEntry* pending_entry = controller->GetPendingEntry();
71 if (pending_entry) 71 if (pending_entry)
72 pending_entry->SetURL(CloudPrintURL( 72 pending_entry->SetURL(CloudPrintURL(
73 Profile::FromWebUI(web_ui())).GetCloudPrintSigninURL()); 73 Profile::FromWebUI(web_ui())).GetCloudPrintSigninURL());
74 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 74 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
75 content::Source<content::NavigationController>(controller)); 75 content::Source<content::NavigationController>(controller));
76 } 76 }
77 } 77 }
78 78
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 void CreateCloudPrintSigninDialog(WebContents* parent_tab) { 197 void CreateCloudPrintSigninDialog(WebContents* parent_tab) {
198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
199 199
200 BrowserThread::PostTask( 200 BrowserThread::PostTask(
201 BrowserThread::UI, FROM_HERE, 201 BrowserThread::UI, FROM_HERE,
202 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); 202 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab));
203 } 203 }
204 } // namespace cloud_print_signin_dialog 204 } // namespace cloud_print_signin_dialog
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698