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" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "content/public/common/page_transition_types.h" | 15 #include "content/public/common/page_transition_types.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
19 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
20 #include "ui/views/layout/layout_constants.h" | 21 #include "ui/views/layout/layout_constants.h" |
21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
22 | 23 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 108 } |
108 | 109 |
109 bool EnrollmentDialogView::Accept() { | 110 bool EnrollmentDialogView::Accept() { |
110 // Navigate to the target URI in a browser tab. | 111 // Navigate to the target URI in a browser tab. |
111 Browser* browser = browser::FindTabbedBrowser(profile_, false); | 112 Browser* browser = browser::FindTabbedBrowser(profile_, false); |
112 if (!browser) { | 113 if (!browser) { |
113 // Couldn't find a tabbed browser: create one. | 114 // Couldn't find a tabbed browser: create one. |
114 browser = Browser::Create(profile_); | 115 browser = Browser::Create(profile_); |
115 } | 116 } |
116 DCHECK(browser); | 117 DCHECK(browser); |
117 browser->AddSelectedTabWithURL( | 118 chrome::AddSelectedTabWithURL(browser, target_uri_, |
118 target_uri_, | 119 content::PAGE_TRANSITION_LINK); |
119 content::PAGE_TRANSITION_LINK); | |
120 return true; | 120 return true; |
121 } | 121 } |
122 | 122 |
123 string16 EnrollmentDialogView::GetDialogButtonLabel( | 123 string16 EnrollmentDialogView::GetDialogButtonLabel( |
124 ui::DialogButton button) const { | 124 ui::DialogButton button) const { |
125 if (button == ui::DIALOG_BUTTON_OK) | 125 if (button == ui::DIALOG_BUTTON_OK) |
126 return l10n_util::GetStringUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_BUTTON); | 126 return l10n_util::GetStringUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_BUTTON); |
127 return views::DialogDelegateView::GetDialogButtonLabel(button); | 127 return views::DialogDelegateView::GetDialogButtonLabel(button); |
128 } | 128 } |
129 | 129 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 //////////////////////////////////////////////////////////////////////////////// | 247 //////////////////////////////////////////////////////////////////////////////// |
248 // Factory function. | 248 // Factory function. |
249 | 249 |
250 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, | 250 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, |
251 const std::string& network_name, | 251 const std::string& network_name, |
252 Profile* profile) { | 252 Profile* profile) { |
253 return new DialogEnrollmentDelegate(owning_window, network_name, profile); | 253 return new DialogEnrollmentDelegate(owning_window, network_name, profile); |
254 } | 254 } |
255 | 255 |
256 } // namespace chromeos | 256 } // namespace chromeos |
OLD | NEW |