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" | |
13 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | |
15 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" | |
16 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
17 #include "content/public/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
18 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/views/border.h" | |
22 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
23 #include "ui/views/controls/webview/webview.h" | |
24 #include "ui/views/layout/grid_layout.h" | 19 #include "ui/views/layout/grid_layout.h" |
25 #include "ui/views/layout/layout_constants.h" | 20 #include "ui/views/layout/layout_constants.h" |
26 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
27 | 22 |
28 using views::Border; | |
29 using views::ColumnSet; | |
30 using views::GridLayout; | |
31 using views::Label; | |
32 using views::LayoutManager; | |
33 using views::View; | |
34 | |
35 namespace chromeos { | 23 namespace chromeos { |
36 | 24 |
37 namespace { | 25 namespace { |
38 | 26 |
39 // Default width/height of the dialog. | 27 // Default width/height of the dialog. |
40 const int kDefaultWidth = 350; | 28 const int kDefaultWidth = 350; |
41 const int kDefaultHeight = 100; | 29 const int kDefaultHeight = 100; |
42 | 30 |
43 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
44 // Dialog for certificate enrollment. This displays the content from the | 32 // Dialog for certificate enrollment. This displays the content from the |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return gfx::Size(kDefaultWidth, kDefaultHeight); | 139 return gfx::Size(kDefaultWidth, kDefaultHeight); |
152 } | 140 } |
153 | 141 |
154 views::View* EnrollmentDialogView::GetContentsView() { | 142 views::View* EnrollmentDialogView::GetContentsView() { |
155 return this; | 143 return this; |
156 } | 144 } |
157 | 145 |
158 void EnrollmentDialogView::InitDialog() { | 146 void EnrollmentDialogView::InitDialog() { |
159 added_cert_ = false; | 147 added_cert_ = false; |
160 // Create the views and layout manager and set them up. | 148 // Create the views and layout manager and set them up. |
161 Label* label = new Label( | 149 views::Label* label = new views::Label( |
162 l10n_util::GetStringFUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_INSTRUCTIONS, | 150 l10n_util::GetStringFUTF16(IDS_NETWORK_ENROLLMENT_HANDLER_INSTRUCTIONS, |
163 UTF8ToUTF16(network_name_))); | 151 UTF8ToUTF16(network_name_))); |
164 label->SetFont( | 152 label->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( |
165 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); | 153 ui::ResourceBundle::BaseFont)); |
166 label->SetHorizontalAlignment(Label::ALIGN_LEFT); | 154 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
167 label->SetMultiLine(true); | 155 label->SetMultiLine(true); |
168 label->SetAllowCharacterBreak(true); | 156 label->SetAllowCharacterBreak(true); |
169 | 157 |
170 GridLayout* grid_layout = GridLayout::CreatePanel(this); | 158 views::GridLayout* grid_layout = views::GridLayout::CreatePanel(this); |
171 SetLayoutManager(grid_layout); | 159 SetLayoutManager(grid_layout); |
172 | 160 |
173 views::ColumnSet* columns = grid_layout->AddColumnSet(0); | 161 views::ColumnSet* columns = grid_layout->AddColumnSet(0); |
174 columns->AddColumn(views::GridLayout::FILL, // Horizontal resize. | 162 columns->AddColumn(views::GridLayout::FILL, // Horizontal resize. |
175 views::GridLayout::FILL, // Vertical resize. | 163 views::GridLayout::FILL, // Vertical resize. |
176 1, // Resize weight. | 164 1, // Resize weight. |
177 views::GridLayout::USE_PREF, // Size type. | 165 views::GridLayout::USE_PREF, // Size type. |
178 0, // Ignored for USE_PREF. | 166 0, // Ignored for USE_PREF. |
179 0); // Minimum size. | 167 0); // Minimum size. |
180 columns = grid_layout->AddColumnSet(1); | 168 columns = grid_layout->AddColumnSet(1); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 //////////////////////////////////////////////////////////////////////////////// | 247 //////////////////////////////////////////////////////////////////////////////// |
260 // Factory function. | 248 // Factory function. |
261 | 249 |
262 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, | 250 EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window, |
263 const std::string& network_name, | 251 const std::string& network_name, |
264 Profile* profile) { | 252 Profile* profile) { |
265 return new DialogEnrollmentDelegate(owning_window, network_name, profile); | 253 return new DialogEnrollmentDelegate(owning_window, network_name, profile); |
266 } | 254 } |
267 | 255 |
268 } // namespace chromeos | 256 } // namespace chromeos |
OLD | NEW |