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

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

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

Powered by Google App Engine
This is Rietveld 408576698