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/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" |
13 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 14 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
14 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" | 15 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" |
15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
16 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/views/border.h" | 21 #include "ui/views/border.h" |
21 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" |
22 #include "ui/views/controls/webview/webview.h" | 23 #include "ui/views/controls/webview/webview.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DCHECK(widget); | 113 DCHECK(widget); |
113 widget->Show(); | 114 widget->Show(); |
114 } | 115 } |
115 | 116 |
116 int EnrollmentDialogView::GetDialogButtons() const { | 117 int EnrollmentDialogView::GetDialogButtons() const { |
117 return ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK; | 118 return ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK; |
118 } | 119 } |
119 | 120 |
120 bool EnrollmentDialogView::Accept() { | 121 bool EnrollmentDialogView::Accept() { |
121 // Navigate to the target URI in a browser tab. | 122 // Navigate to the target URI in a browser tab. |
122 Browser* browser = BrowserList::FindTabbedBrowser(profile_, false); | 123 Browser* browser = browser::FindTabbedBrowser(profile_, false); |
123 if (!browser) { | 124 if (!browser) { |
124 // Couldn't find a tabbed browser: create one. | 125 // Couldn't find a tabbed browser: create one. |
125 browser = Browser::Create(profile_); | 126 browser = Browser::Create(profile_); |
126 } | 127 } |
127 DCHECK(browser); | 128 DCHECK(browser); |
128 browser->AddSelectedTabWithURL( | 129 browser->AddSelectedTabWithURL( |
129 target_uri_, | 130 target_uri_, |
130 content::PAGE_TRANSITION_LINK); | 131 content::PAGE_TRANSITION_LINK); |
131 return true; | 132 return true; |
132 } | 133 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 //////////////////////////////////////////////////////////////////////////////// | 259 //////////////////////////////////////////////////////////////////////////////// |
259 // Factory function. | 260 // Factory function. |
260 | 261 |
261 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, | 262 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, |
262 const std::string& network_name, | 263 const std::string& network_name, |
263 Profile* profile) { | 264 Profile* profile) { |
264 return new DialogEnrollmentDelegate(owning_window, network_name, profile); | 265 return new DialogEnrollmentDelegate(owning_window, network_name, profile); |
265 } | 266 } |
266 | 267 |
267 } // namespace chromeos | 268 } // namespace chromeos |
OLD | NEW |