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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 static void ShowDialog(gfx::NativeWindow owning_window, | 42 static void ShowDialog(gfx::NativeWindow owning_window, |
43 const std::string& network_name, | 43 const std::string& network_name, |
44 Profile* profile, | 44 Profile* profile, |
45 const GURL& target_uri, | 45 const GURL& target_uri, |
46 const base::Closure& connect); | 46 const base::Closure& connect); |
47 | 47 |
48 // views::DialogDelegateView overrides | 48 // views::DialogDelegateView overrides |
49 virtual int GetDialogButtons() const OVERRIDE; | 49 virtual int GetDialogButtons() const OVERRIDE; |
50 virtual bool Accept() OVERRIDE; | 50 virtual bool Accept() OVERRIDE; |
51 virtual void OnClosed() OVERRIDE; | 51 virtual void OnClosed() OVERRIDE; |
52 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 52 virtual base::string16 GetDialogButtonLabel( |
| 53 ui::DialogButton button) const OVERRIDE; |
53 | 54 |
54 // views::WidgetDelegate overrides | 55 // views::WidgetDelegate overrides |
55 virtual ui::ModalType GetModalType() const OVERRIDE; | 56 virtual ui::ModalType GetModalType() const OVERRIDE; |
56 virtual string16 GetWindowTitle() const OVERRIDE; | 57 virtual base::string16 GetWindowTitle() const OVERRIDE; |
57 | 58 |
58 // views::View overrides | 59 // views::View overrides |
59 virtual gfx::Size GetPreferredSize() OVERRIDE; | 60 virtual gfx::Size GetPreferredSize() OVERRIDE; |
60 | 61 |
61 private: | 62 private: |
62 EnrollmentDialogView(const std::string& network_name, | 63 EnrollmentDialogView(const std::string& network_name, |
63 Profile* profile, | 64 Profile* profile, |
64 const GURL& target_uri, | 65 const GURL& target_uri, |
65 const base::Closure& connect); | 66 const base::Closure& connect); |
66 void InitDialog(); | 67 void InitDialog(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (!accepted_) | 120 if (!accepted_) |
120 return; | 121 return; |
121 chrome::NavigateParams params(profile_, | 122 chrome::NavigateParams params(profile_, |
122 GURL(target_uri_), | 123 GURL(target_uri_), |
123 content::PAGE_TRANSITION_LINK); | 124 content::PAGE_TRANSITION_LINK); |
124 params.disposition = NEW_FOREGROUND_TAB; | 125 params.disposition = NEW_FOREGROUND_TAB; |
125 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 126 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
126 chrome::Navigate(¶ms); | 127 chrome::Navigate(¶ms); |
127 } | 128 } |
128 | 129 |
129 string16 EnrollmentDialogView::GetDialogButtonLabel( | 130 base::string16 EnrollmentDialogView::GetDialogButtonLabel( |
130 ui::DialogButton button) const { | 131 ui::DialogButton button) const { |
131 if (button == ui::DIALOG_BUTTON_OK) | 132 if (button == ui::DIALOG_BUTTON_OK) |
132 return l10n_util::GetStringUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_BUTTON); | 133 return l10n_util::GetStringUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_BUTTON); |
133 return views::DialogDelegateView::GetDialogButtonLabel(button); | 134 return views::DialogDelegateView::GetDialogButtonLabel(button); |
134 } | 135 } |
135 | 136 |
136 ui::ModalType EnrollmentDialogView::GetModalType() const { | 137 ui::ModalType EnrollmentDialogView::GetModalType() const { |
137 return ui::MODAL_TYPE_SYSTEM; | 138 return ui::MODAL_TYPE_SYSTEM; |
138 } | 139 } |
139 | 140 |
140 string16 EnrollmentDialogView::GetWindowTitle() const { | 141 base::string16 EnrollmentDialogView::GetWindowTitle() const { |
141 return l10n_util::GetStringUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_TITLE); | 142 return l10n_util::GetStringUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_TITLE); |
142 } | 143 } |
143 | 144 |
144 gfx::Size EnrollmentDialogView::GetPreferredSize() { | 145 gfx::Size EnrollmentDialogView::GetPreferredSize() { |
145 return gfx::Size(kDefaultWidth, kDefaultHeight); | 146 return gfx::Size(kDefaultWidth, kDefaultHeight); |
146 } | 147 } |
147 | 148 |
148 void EnrollmentDialogView::InitDialog() { | 149 void EnrollmentDialogView::InitDialog() { |
149 added_cert_ = false; | 150 added_cert_ = false; |
150 // Create the views and layout manager and set them up. | 151 // Create the views and layout manager and set them up. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 DialogEnrollmentDelegate* enrollment = | 287 DialogEnrollmentDelegate* enrollment = |
287 new DialogEnrollmentDelegate(owning_window, network->name(), | 288 new DialogEnrollmentDelegate(owning_window, network->name(), |
288 ProfileManager::GetDefaultProfile()); | 289 ProfileManager::GetDefaultProfile()); |
289 return enrollment->Enroll(certificate_pattern.enrollment_uri_list(), | 290 return enrollment->Enroll(certificate_pattern.enrollment_uri_list(), |
290 base::Bind(&EnrollmentComplete, service_path)); | 291 base::Bind(&EnrollmentComplete, service_path)); |
291 } | 292 } |
292 | 293 |
293 } // namespace enrollment | 294 } // namespace enrollment |
294 | 295 |
295 } // namespace chromeos | 296 } // namespace chromeos |
OLD | NEW |