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

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

Issue 8136027: Print Preview: Make print preview tab modal. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase, no renderer changes Created 9 years, 1 month 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>
8 #include <vector>
9
7 #include "base/bind.h" 10 #include "base/bind.h"
8 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 12 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
10 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/webui/html_dialog_ui.h" 16 #include "chrome/browser/ui/webui/html_dialog_ui.h"
17 #include "chrome/browser/ui/webui/print_preview_ui.h"
14 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
15 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
16 #include "content/browser/renderer_host/render_view_host.h" 20 #include "content/browser/renderer_host/render_view_host.h"
17 #include "content/browser/tab_contents/navigation_controller.h" 21 #include "content/browser/tab_contents/navigation_controller.h"
18 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/browser/tab_contents/tab_contents_view.h" 23 #include "content/browser/tab_contents/tab_contents_view.h"
20 #include "content/common/view_messages.h" 24 #include "content/common/view_messages.h"
21 #include "content/public/browser/notification_registrar.h" 25 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
23 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const content::NotificationDetails& details) { 74 const content::NotificationDetails& details) {
71 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 75 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
72 GURL url = web_ui_->tab_contents()->GetURL(); 76 GURL url = web_ui_->tab_contents()->GetURL();
73 GURL dialog_url = CloudPrintURL( 77 GURL dialog_url = CloudPrintURL(
74 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL(); 78 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL();
75 if (url.host() == dialog_url.host() && 79 if (url.host() == dialog_url.host() &&
76 url.path() == dialog_url.path() && 80 url.path() == dialog_url.path() &&
77 url.scheme() == dialog_url.scheme()) { 81 url.scheme() == dialog_url.scheme()) {
78 StoreDialogSize(); 82 StoreDialogSize();
79 web_ui_->tab_contents()->render_view_host()->ClosePage(); 83 web_ui_->tab_contents()->render_view_host()->ClosePage();
80 parent_tab_->controller().Reload(false); 84 static_cast<PrintPreviewUI*>(
85 parent_tab_->web_ui())->OnReloadPrintersList();
81 } 86 }
82 } 87 }
83 } 88 }
84 89
85 void CloudPrintSigninFlowHandler::StoreDialogSize() { 90 void CloudPrintSigninFlowHandler::StoreDialogSize() {
86 if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->view()) { 91 if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->view()) {
87 gfx::Size size = web_ui_->tab_contents()->view()->GetContainerSize(); 92 gfx::Size size = web_ui_->tab_contents()->view()->GetContainerSize();
88 Profile* profile = Profile::FromWebUI(web_ui_); 93 Profile* profile = Profile::FromWebUI(web_ui_);
89 profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth, 94 profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth,
90 size.width()); 95 size.width());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 183 }
179 184
180 void CreateCloudPrintSigninDialog(TabContents* parent_tab) { 185 void CreateCloudPrintSigninDialog(TabContents* parent_tab) {
181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
182 187
183 BrowserThread::PostTask( 188 BrowserThread::PostTask(
184 BrowserThread::UI, FROM_HERE, 189 BrowserThread::UI, FROM_HERE,
185 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); 190 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab));
186 } 191 }
187 } // namespace cloud_print_signin_dialog 192 } // namespace cloud_print_signin_dialog
188
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698