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