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 10 matching lines...) Expand all Loading... |
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" | 22 #include "content/browser/tab_contents/navigation_controller.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 23 #include "content/browser/tab_contents/tab_contents.h" |
24 #include "content/browser/tab_contents/tab_contents_view.h" | 24 #include "content/browser/tab_contents/tab_contents_view.h" |
25 #include "content/public/browser/navigation_entry.h" | 25 #include "content/public/browser/navigation_entry.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
29 | 29 |
30 using content::BrowserThread; | 30 using content::BrowserThread; |
| 31 using content::NavigationEntry; |
31 using content::WebContents; | 32 using content::WebContents; |
32 | 33 |
33 // This module implements a sign in dialog for cloud print. | 34 // This module implements a sign in dialog for cloud print. |
34 // it is based heavily off "chrome/browser/printing/print_dialog_cloud.cc". | 35 // it is based heavily off "chrome/browser/printing/print_dialog_cloud.cc". |
35 // See the comments in that file for a discussion about how this works. | 36 // See the comments in that file for a discussion about how this works. |
36 | 37 |
37 namespace cloud_print_signin_dialog { | 38 namespace cloud_print_signin_dialog { |
38 | 39 |
39 // The flow handler sends our dialog to the correct URL, saves size info, | 40 // The flow handler sends our dialog to the correct URL, saves size info, |
40 // and closes the dialog when sign in is complete. | 41 // and closes the dialog when sign in is complete. |
(...skipping 16 matching lines...) Expand all Loading... |
57 }; | 58 }; |
58 | 59 |
59 CloudPrintSigninFlowHandler::CloudPrintSigninFlowHandler( | 60 CloudPrintSigninFlowHandler::CloudPrintSigninFlowHandler( |
60 TabContents* parent_tab) : parent_tab_(parent_tab) { | 61 TabContents* parent_tab) : parent_tab_(parent_tab) { |
61 } | 62 } |
62 | 63 |
63 void CloudPrintSigninFlowHandler::RegisterMessages() { | 64 void CloudPrintSigninFlowHandler::RegisterMessages() { |
64 if (web_ui_ && web_ui_->tab_contents()) { | 65 if (web_ui_ && web_ui_->tab_contents()) { |
65 NavigationController* controller = | 66 NavigationController* controller = |
66 &web_ui_->tab_contents()->GetController(); | 67 &web_ui_->tab_contents()->GetController(); |
67 content::NavigationEntry* pending_entry = controller->GetPendingEntry(); | 68 NavigationEntry* pending_entry = controller->GetPendingEntry(); |
68 if (pending_entry) | 69 if (pending_entry) |
69 pending_entry->SetURL(CloudPrintURL( | 70 pending_entry->SetURL(CloudPrintURL( |
70 Profile::FromWebUI(web_ui_)).GetCloudPrintSigninURL()); | 71 Profile::FromWebUI(web_ui_)).GetCloudPrintSigninURL()); |
71 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 72 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
72 content::Source<NavigationController>(controller)); | 73 content::Source<NavigationController>(controller)); |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 void CloudPrintSigninFlowHandler::Observe( | 77 void CloudPrintSigninFlowHandler::Observe( |
77 int type, | 78 int type, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 191 } |
191 | 192 |
192 void CreateCloudPrintSigninDialog(TabContents* parent_tab) { | 193 void CreateCloudPrintSigninDialog(TabContents* parent_tab) { |
193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
194 | 195 |
195 BrowserThread::PostTask( | 196 BrowserThread::PostTask( |
196 BrowserThread::UI, FROM_HERE, | 197 BrowserThread::UI, FROM_HERE, |
197 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); | 198 base::Bind(&CreateCloudPrintSigninDialogImpl, parent_tab)); |
198 } | 199 } |
199 } // namespace cloud_print_signin_dialog | 200 } // namespace cloud_print_signin_dialog |
OLD | NEW |