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

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

Issue 8520011: Print Preview: Make print preview tab modal. (try 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: disable tests in touch_ui, fix failing test 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const content::NotificationDetails& details) { 76 const content::NotificationDetails& details) {
73 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 77 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
74 GURL url = web_ui_->tab_contents()->GetURL(); 78 GURL url = web_ui_->tab_contents()->GetURL();
75 GURL dialog_url = CloudPrintURL( 79 GURL dialog_url = CloudPrintURL(
76 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL(); 80 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL();
77 if (url.host() == dialog_url.host() && 81 if (url.host() == dialog_url.host() &&
78 url.path() == dialog_url.path() && 82 url.path() == dialog_url.path() &&
79 url.scheme() == dialog_url.scheme()) { 83 url.scheme() == dialog_url.scheme()) {
80 StoreDialogSize(); 84 StoreDialogSize();
81 web_ui_->tab_contents()->render_view_host()->ClosePage(); 85 web_ui_->tab_contents()->render_view_host()->ClosePage();
82 parent_tab_->controller().Reload(false); 86 static_cast<PrintPreviewUI*>(
87 parent_tab_->web_ui())->OnReloadPrintersList();
83 } 88 }
84 } 89 }
85 } 90 }
86 91
87 void CloudPrintSigninFlowHandler::StoreDialogSize() { 92 void CloudPrintSigninFlowHandler::StoreDialogSize() {
88 if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->view()) { 93 if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->view()) {
89 gfx::Size size = web_ui_->tab_contents()->view()->GetContainerSize(); 94 gfx::Size size = web_ui_->tab_contents()->view()->GetContainerSize();
90 Profile* profile = Profile::FromWebUI(web_ui_); 95 Profile* profile = Profile::FromWebUI(web_ui_);
91 profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth, 96 profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth,
92 size.width()); 97 size.width());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 185 }
181 186
182 void CreateCloudPrintSigninDialog(TabContents* parent_tab) { 187 void CreateCloudPrintSigninDialog(TabContents* parent_tab) {
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
184 189
185 BrowserThread::PostTask( 190 BrowserThread::PostTask(
186 BrowserThread::UI, FROM_HERE, 191 BrowserThread::UI, FROM_HERE,
187 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); 192 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab));
188 } 193 }
189 } // namespace cloud_print_signin_dialog 194 } // namespace cloud_print_signin_dialog
190
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698