| 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/options/network_config_view.h" | 5 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 23 #include "chrome/grit/locale_settings.h" | 23 #include "chrome/grit/locale_settings.h" |
| 24 #include "chromeos/login/login_state.h" | 24 #include "chromeos/login/login_state.h" |
| 25 #include "chromeos/network/network_state.h" | 25 #include "chromeos/network/network_state.h" |
| 26 #include "chromeos/network/network_state_handler.h" | 26 #include "chromeos/network/network_state_handler.h" |
| 27 #include "components/device_event_log/device_event_log.h" | 27 #include "components/device_event_log/device_event_log.h" |
| 28 #include "components/user_manager/user.h" | 28 #include "components/user_manager/user.h" |
| 29 #include "ui/accessibility/ax_node_data.h" | 29 #include "ui/accessibility/ax_node_data.h" |
| 30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "ui/base/material_design/material_design_controller.h" |
| 32 #include "ui/gfx/color_palette.h" | 33 #include "ui/gfx/color_palette.h" |
| 33 #include "ui/gfx/geometry/rect.h" | 34 #include "ui/gfx/geometry/rect.h" |
| 34 #include "ui/gfx/image/image.h" | 35 #include "ui/gfx/image/image.h" |
| 35 #include "ui/gfx/paint_vector_icon.h" | 36 #include "ui/gfx/paint_vector_icon.h" |
| 36 #include "ui/gfx/vector_icons_public.h" | 37 #include "ui/gfx/vector_icons_public.h" |
| 37 #include "ui/views/controls/button/md_text_button.h" | 38 #include "ui/views/controls/button/md_text_button.h" |
| 38 #include "ui/views/controls/image_view.h" | 39 #include "ui/views/controls/image_view.h" |
| 39 #include "ui/views/layout/fill_layout.h" | 40 #include "ui/views/layout/fill_layout.h" |
| 40 #include "ui/views/layout/layout_constants.h" | 41 #include "ui/views/layout/layout_constants.h" |
| 41 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // For now, there is only an advanced view for Wi-Fi 802.1X. | 231 // For now, there is only an advanced view for Wi-Fi 802.1X. |
| 231 child_config_view_ = new WifiConfigView(this, | 232 child_config_view_ = new WifiConfigView(this, |
| 232 "" /* service_path */, | 233 "" /* service_path */, |
| 233 true /* show_8021x */); | 234 true /* show_8021x */); |
| 234 AddChildView(child_config_view_); | 235 AddChildView(child_config_view_); |
| 235 // Resize the window to be able to hold the new widgets. | 236 // Resize the window to be able to hold the new widgets. |
| 236 gfx::Size size = GetWidget()->client_view()->GetPreferredSize(); | 237 gfx::Size size = GetWidget()->client_view()->GetPreferredSize(); |
| 237 gfx::Size predefined_size = views::Widget::GetLocalizedContentsSize( | 238 gfx::Size predefined_size = views::Widget::GetLocalizedContentsSize( |
| 238 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_WIDTH_CHARS, | 239 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_WIDTH_CHARS, |
| 239 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES); | 240 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES); |
| 240 size.SetToMax(predefined_size); | 241 // Use the pre-determined value to determine its size for non-harmony dialog. |
| 242 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) |
| 243 size.SetToMax(predefined_size); |
| 241 | 244 |
| 242 // Get the new bounds with desired size at the same center point. | 245 // Get the new bounds with desired size at the same center point. |
| 243 gfx::Rect bounds = GetWidget()->GetWindowBoundsInScreen(); | 246 gfx::Rect bounds = GetWidget()->GetWindowBoundsInScreen(); |
| 244 int horiz_padding = bounds.width() - size.width(); | 247 int horiz_padding = bounds.width() - size.width(); |
| 245 int vert_padding = bounds.height() - size.height(); | 248 int vert_padding = bounds.height() - size.height(); |
| 246 bounds.Inset(horiz_padding / 2, vert_padding / 2, | 249 bounds.Inset(horiz_padding / 2, vert_padding / 2, |
| 247 horiz_padding / 2, vert_padding / 2); | 250 horiz_padding / 2, vert_padding / 2); |
| 248 GetWidget()->SetBoundsConstrained(bounds); | 251 GetWidget()->SetBoundsConstrained(bounds); |
| 249 Layout(); | 252 Layout(); |
| 250 child_config_view_->InitFocus(); | 253 child_config_view_->InitFocus(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 336 } |
| 334 | 337 |
| 335 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {} | 338 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {} |
| 336 | 339 |
| 337 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const { | 340 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const { |
| 338 return (managed_ && visible()) ? image_view_->GetPreferredSize() | 341 return (managed_ && visible()) ? image_view_->GetPreferredSize() |
| 339 : gfx::Size(); | 342 : gfx::Size(); |
| 340 } | 343 } |
| 341 | 344 |
| 342 } // namespace chromeos | 345 } // namespace chromeos |
| OLD | NEW |