OLD | NEW |
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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 78 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
79 GURL url = web_ui_->tab_contents()->GetURL(); | 79 GURL url = web_ui_->tab_contents()->GetURL(); |
80 GURL dialog_url = CloudPrintURL( | 80 GURL dialog_url = CloudPrintURL( |
81 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL(); | 81 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL(); |
82 if (url.host() == dialog_url.host() && | 82 if (url.host() == dialog_url.host() && |
83 url.path() == dialog_url.path() && | 83 url.path() == dialog_url.path() && |
84 url.scheme() == dialog_url.scheme()) { | 84 url.scheme() == dialog_url.scheme()) { |
85 StoreDialogSize(); | 85 StoreDialogSize(); |
86 web_ui_->tab_contents()->GetRenderViewHost()->ClosePage(); | 86 web_ui_->tab_contents()->GetRenderViewHost()->ClosePage(); |
87 static_cast<PrintPreviewUI*>( | 87 static_cast<PrintPreviewUI*>( |
88 parent_tab_->web_ui())->OnReloadPrintersList(); | 88 parent_tab_->GetWebUI())->OnReloadPrintersList(); |
89 } | 89 } |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void CloudPrintSigninFlowHandler::StoreDialogSize() { | 93 void CloudPrintSigninFlowHandler::StoreDialogSize() { |
94 if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->GetView())
{ | 94 if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->GetView())
{ |
95 gfx::Size size = web_ui_->tab_contents()->GetView()->GetContainerSize(); | 95 gfx::Size size = web_ui_->tab_contents()->GetView()->GetContainerSize(); |
96 Profile* profile = Profile::FromWebUI(web_ui_); | 96 Profile* profile = Profile::FromWebUI(web_ui_); |
97 profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth, | 97 profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth, |
98 size.width()); | 98 size.width()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 void CreateCloudPrintSigninDialog(TabContents* parent_tab) { | 190 void CreateCloudPrintSigninDialog(TabContents* parent_tab) { |
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
192 | 192 |
193 BrowserThread::PostTask( | 193 BrowserThread::PostTask( |
194 BrowserThread::UI, FROM_HERE, | 194 BrowserThread::UI, FROM_HERE, |
195 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); | 195 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); |
196 } | 196 } |
197 } // namespace cloud_print_signin_dialog | 197 } // namespace cloud_print_signin_dialog |
OLD | NEW |