OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/enrollment_dialog_view.h" | 5 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/cros/network_library.h" | 9 #include "chrome/browser/chromeos/cros/network_library.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 views::Widget* widget = dialog_view->GetWidget(); | 101 views::Widget* widget = dialog_view->GetWidget(); |
102 DCHECK(widget); | 102 DCHECK(widget); |
103 widget->Show(); | 103 widget->Show(); |
104 } | 104 } |
105 | 105 |
106 int EnrollmentDialogView::GetDialogButtons() const { | 106 int EnrollmentDialogView::GetDialogButtons() const { |
107 return ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK; | 107 return ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK; |
108 } | 108 } |
109 | 109 |
110 bool EnrollmentDialogView::Accept() { | 110 bool EnrollmentDialogView::Accept() { |
| 111 // TODO(beng): use Navigate(). |
111 // Navigate to the target URI in a browser tab. | 112 // Navigate to the target URI in a browser tab. |
112 Browser* browser = browser::FindTabbedBrowser(profile_, false); | 113 Browser* browser = browser::FindTabbedBrowser(profile_, false); |
113 if (!browser) { | 114 if (!browser) { |
114 // Couldn't find a tabbed browser: create one. | 115 // Couldn't find a tabbed browser: create one. |
115 browser = Browser::Create(profile_); | 116 browser = new Browser(Browser::CreateParams(profile_)); |
116 } | 117 } |
117 DCHECK(browser); | 118 DCHECK(browser); |
118 chrome::AddSelectedTabWithURL(browser, target_uri_, | 119 chrome::AddSelectedTabWithURL(browser, target_uri_, |
119 content::PAGE_TRANSITION_LINK); | 120 content::PAGE_TRANSITION_LINK); |
120 return true; | 121 return true; |
121 } | 122 } |
122 | 123 |
123 string16 EnrollmentDialogView::GetDialogButtonLabel( | 124 string16 EnrollmentDialogView::GetDialogButtonLabel( |
124 ui::DialogButton button) const { | 125 ui::DialogButton button) const { |
125 if (button == ui::DIALOG_BUTTON_OK) | 126 if (button == ui::DIALOG_BUTTON_OK) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 //////////////////////////////////////////////////////////////////////////////// | 248 //////////////////////////////////////////////////////////////////////////////// |
248 // Factory function. | 249 // Factory function. |
249 | 250 |
250 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, | 251 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, |
251 const std::string& network_name, | 252 const std::string& network_name, |
252 Profile* profile) { | 253 Profile* profile) { |
253 return new DialogEnrollmentDelegate(owning_window, network_name, profile); | 254 return new DialogEnrollmentDelegate(owning_window, network_name, profile); |
254 } | 255 } |
255 | 256 |
256 } // namespace chromeos | 257 } // namespace chromeos |
OLD | NEW |