Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: chrome/browser/chromeos/options/wimax_config_view.cc

Issue 2685663003: [Harmony] Harmonize Chrome OS VPN/Wimax dialogs. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/options/vpn_config_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/options/wimax_config_view.h" 5 #include "chrome/browser/chromeos/options/wimax_config_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/enrollment_dialog_view.h" 10 #include "chrome/browser/chromeos/enrollment_dialog_view.h"
11 #include "chrome/browser/chromeos/login/startup_utils.h" 11 #include "chrome/browser/chromeos/login/startup_utils.h"
12 #include "chrome/browser/chromeos/net/shill_error.h" 12 #include "chrome/browser/chromeos/net/shill_error.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
15 #include "chrome/browser/ui/views/layout_utils.h"
14 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
15 #include "chrome/grit/theme_resources.h" 17 #include "chrome/grit/theme_resources.h"
16 #include "chromeos/login/login_state.h" 18 #include "chromeos/login/login_state.h"
17 #include "chromeos/network/network_configuration_handler.h" 19 #include "chromeos/network/network_configuration_handler.h"
18 #include "chromeos/network/network_connect.h" 20 #include "chromeos/network/network_connect.h"
19 #include "chromeos/network/network_event_log.h" 21 #include "chromeos/network/network_event_log.h"
20 #include "chromeos/network/network_profile.h" 22 #include "chromeos/network/network_profile.h"
21 #include "chromeos/network/network_profile_handler.h" 23 #include "chromeos/network/network_profile_handler.h"
22 #include "chromeos/network/network_state.h" 24 #include "chromeos/network/network_state.h"
23 #include "chromeos/network/network_state_handler.h" 25 #include "chromeos/network/network_state_handler.h"
24 #include "chromeos/network/onc/onc_utils.h" 26 #include "chromeos/network/onc/onc_utils.h"
25 #include "components/onc/onc_constants.h" 27 #include "components/onc/onc_constants.h"
26 #include "third_party/cros_system_api/dbus/service_constants.h" 28 #include "third_party/cros_system_api/dbus/service_constants.h"
27 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/events/event.h" 31 #include "ui/events/event.h"
30 #include "ui/views/controls/button/checkbox.h" 32 #include "ui/views/controls/button/checkbox.h"
31 #include "ui/views/controls/button/image_button.h" 33 #include "ui/views/controls/button/image_button.h"
32 #include "ui/views/controls/label.h" 34 #include "ui/views/controls/label.h"
33 #include "ui/views/controls/textfield/textfield.h" 35 #include "ui/views/controls/textfield/textfield.h"
34 #include "ui/views/layout/grid_layout.h" 36 #include "ui/views/layout/grid_layout.h"
35 #include "ui/views/layout/layout_constants.h"
36 #include "ui/views/widget/widget.h" 37 #include "ui/views/widget/widget.h"
37 #include "ui/views/window/dialog_client_view.h" 38 #include "ui/views/window/dialog_client_view.h"
38 39
39 namespace chromeos { 40 namespace chromeos {
40 41
41 namespace { 42 namespace {
42 43
43 void ShillError(const std::string& function, 44 void ShillError(const std::string& function,
44 const std::string& error_name, 45 const std::string& error_name,
45 std::unique_ptr<base::DictionaryValue> error_data) { 46 std::unique_ptr<base::DictionaryValue> error_data) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 GetNetworkState(service_path_); 203 GetNetworkState(service_path_);
203 DCHECK(wimax && wimax->type() == shill::kTypeWimax); 204 DCHECK(wimax && wimax->type() == shill::kTypeWimax);
204 205
205 WifiConfigView::ParseEAPUIProperty( 206 WifiConfigView::ParseEAPUIProperty(
206 &save_credentials_ui_data_, wimax, ::onc::eap::kSaveCredentials); 207 &save_credentials_ui_data_, wimax, ::onc::eap::kSaveCredentials);
207 WifiConfigView::ParseEAPUIProperty( 208 WifiConfigView::ParseEAPUIProperty(
208 &identity_ui_data_, wimax, ::onc::eap::kIdentity); 209 &identity_ui_data_, wimax, ::onc::eap::kIdentity);
209 WifiConfigView::ParseUIProperty( 210 WifiConfigView::ParseUIProperty(
210 &passphrase_ui_data_, wimax, ::onc::wifi::kPassphrase); 211 &passphrase_ui_data_, wimax, ::onc::wifi::kPassphrase);
211 212
212 views::GridLayout* layout = views::GridLayout::CreatePanel(this); 213 views::GridLayout* layout = layout_utils::CreatePanelLayout(this);
213 SetLayoutManager(layout); 214 LayoutDelegate* delegate = LayoutDelegate::Get();
214 215
215 const int column_view_set_id = 0; 216 const int column_view_set_id = 0;
216 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); 217 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id);
217 const int kPasswordVisibleWidth = 20; 218 const int kPasswordVisibleWidth = 20;
218 // Label 219 // Label
219 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, 220 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1,
220 views::GridLayout::USE_PREF, 0, 0); 221 views::GridLayout::USE_PREF, 0, 0);
221 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); 222 column_set->AddPaddingColumn(
223 0, delegate->GetMetric(
224 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING));
222 // Textfield, combobox. 225 // Textfield, combobox.
223 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 226 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
224 views::GridLayout::USE_PREF, 0, 227 views::GridLayout::USE_PREF, 0,
225 ChildNetworkConfigView::kInputFieldMinWidth); 228 ChildNetworkConfigView::kInputFieldMinWidth);
226 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); 229 column_set->AddPaddingColumn(
230 0, delegate->GetMetric(
231 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING));
227 // Password visible button / policy indicator. 232 // Password visible button / policy indicator.
228 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, 233 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1,
229 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); 234 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth);
230 235
231 // Network name 236 // Network name
232 layout->StartRow(0, column_view_set_id); 237 layout->StartRow(0, column_view_set_id);
233 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 238 layout->AddView(new views::Label(l10n_util::GetStringUTF16(
234 IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK))); 239 IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK)));
235 views::Label* label = new views::Label(base::UTF8ToUTF16(wimax->name())); 240 views::Label* label = new views::Label(base::UTF8ToUTF16(wimax->name()));
236 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 241 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
237 layout->AddView(label); 242 layout->AddView(label);
238 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 243 layout->AddPaddingRow(
244 0, delegate->GetMetric(
245 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
239 246
240 // Identity 247 // Identity
241 layout->StartRow(0, column_view_set_id); 248 layout->StartRow(0, column_view_set_id);
242 base::string16 identity_label_text = l10n_util::GetStringUTF16( 249 base::string16 identity_label_text = l10n_util::GetStringUTF16(
243 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); 250 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY);
244 identity_label_ = new views::Label(identity_label_text); 251 identity_label_ = new views::Label(identity_label_text);
245 layout->AddView(identity_label_); 252 layout->AddView(identity_label_);
246 identity_textfield_ = new views::Textfield(); 253 identity_textfield_ = new views::Textfield();
247 identity_textfield_->SetAccessibleName(identity_label_text); 254 identity_textfield_->SetAccessibleName(identity_label_text);
248 identity_textfield_->set_controller(this); 255 identity_textfield_->set_controller(this);
249 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); 256 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable());
250 layout->AddView(identity_textfield_); 257 layout->AddView(identity_textfield_);
251 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); 258 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_));
252 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 259 layout->AddPaddingRow(
260 0, delegate->GetMetric(
261 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
253 262
254 // Passphrase input 263 // Passphrase input
255 layout->StartRow(0, column_view_set_id); 264 layout->StartRow(0, column_view_set_id);
256 base::string16 passphrase_label_text = l10n_util::GetStringUTF16( 265 base::string16 passphrase_label_text = l10n_util::GetStringUTF16(
257 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE); 266 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE);
258 passphrase_label_ = new views::Label(passphrase_label_text); 267 passphrase_label_ = new views::Label(passphrase_label_text);
259 layout->AddView(passphrase_label_); 268 layout->AddView(passphrase_label_);
260 passphrase_textfield_ = new views::Textfield(); 269 passphrase_textfield_ = new views::Textfield();
261 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 270 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
262 passphrase_textfield_->set_controller(this); 271 passphrase_textfield_->set_controller(this);
(...skipping 29 matching lines...) Expand all
292 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD)); 301 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD));
293 passphrase_visible_button_->SetToggledImage( 302 passphrase_visible_button_->SetToggledImage(
294 views::ImageButton::STATE_HOVERED, 303 views::ImageButton::STATE_HOVERED,
295 ResourceBundle::GetSharedInstance(). 304 ResourceBundle::GetSharedInstance().
296 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD_HOVER)); 305 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD_HOVER));
297 passphrase_visible_button_->SetImageAlignment( 306 passphrase_visible_button_->SetImageAlignment(
298 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); 307 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE);
299 layout->AddView(passphrase_visible_button_); 308 layout->AddView(passphrase_visible_button_);
300 } 309 }
301 310
302 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 311 layout->AddPaddingRow(
312 0, delegate->GetMetric(
313 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
303 314
304 // Checkboxes. 315 // Checkboxes.
305 316
306 if (LoginState::Get()->IsUserAuthenticated()) { 317 if (LoginState::Get()->IsUserAuthenticated()) {
307 // Save credentials 318 // Save credentials
308 layout->StartRow(0, column_view_set_id); 319 layout->StartRow(0, column_view_set_id);
309 save_credentials_checkbox_ = new views::Checkbox( 320 save_credentials_checkbox_ = new views::Checkbox(
310 l10n_util::GetStringUTF16( 321 l10n_util::GetStringUTF16(
311 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); 322 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS));
312 save_credentials_checkbox_->SetEnabled( 323 save_credentials_checkbox_->SetEnabled(
(...skipping 16 matching lines...) Expand all
329 ChildNetworkConfigView::GetShareStateForLoginState( 340 ChildNetworkConfigView::GetShareStateForLoginState(
330 &share_network_checkbox_value, 341 &share_network_checkbox_value,
331 &share_network_checkbox_enabled); 342 &share_network_checkbox_enabled);
332 343
333 share_network_checkbox_->SetChecked(share_network_checkbox_value); 344 share_network_checkbox_->SetChecked(share_network_checkbox_value);
334 share_network_checkbox_->SetEnabled(share_network_checkbox_enabled); 345 share_network_checkbox_->SetEnabled(share_network_checkbox_enabled);
335 346
336 layout->SkipColumns(1); 347 layout->SkipColumns(1);
337 layout->AddView(share_network_checkbox_); 348 layout->AddView(share_network_checkbox_);
338 } 349 }
339 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 350 layout->AddPaddingRow(
351 0, delegate->GetMetric(
352 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
340 353
341 // Create an error label. 354 // Create an error label.
342 layout->StartRow(0, column_view_set_id); 355 layout->StartRow(0, column_view_set_id);
343 layout->SkipColumns(1); 356 layout->SkipColumns(1);
344 error_label_ = new views::Label(); 357 error_label_ = new views::Label();
345 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 358 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
346 error_label_->SetEnabledColor(SK_ColorRED); 359 error_label_->SetEnabledColor(SK_ColorRED);
347 layout->AddView(error_label_); 360 layout->AddView(error_label_);
348 361
349 UpdateErrorLabel(); 362 UpdateErrorLabel();
(...skipping 24 matching lines...) Expand all
374 } 387 }
375 } 388 }
376 389
377 void WimaxConfigView::InitFocus() { 390 void WimaxConfigView::InitFocus() {
378 views::View* view_to_focus = GetInitiallyFocusedView(); 391 views::View* view_to_focus = GetInitiallyFocusedView();
379 if (view_to_focus) 392 if (view_to_focus)
380 view_to_focus->RequestFocus(); 393 view_to_focus->RequestFocus();
381 } 394 }
382 395
383 } // namespace chromeos 396 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/vpn_config_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698