| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if (browser) | 62 if (browser) |
| 63 return browser->window()->GetNativeWindow(); | 63 return browser->window()->GetNativeWindow(); |
| 64 } | 64 } |
| 65 return nullptr; | 65 return nullptr; |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 const int ChildNetworkConfigView::kInputFieldMinWidth = 270; | 71 const int ChildNetworkConfigView::kInputFieldMinWidth = 270; |
| 72 const int ChildNetworkConfigView::kInputFieldHeight = 28; |
| 72 | 73 |
| 73 NetworkConfigView::NetworkConfigView() | 74 NetworkConfigView::NetworkConfigView() |
| 74 : child_config_view_(nullptr), | 75 : child_config_view_(nullptr), |
| 75 delegate_(nullptr), | 76 delegate_(nullptr), |
| 76 advanced_button_(nullptr) { | 77 advanced_button_(nullptr) { |
| 77 DCHECK(!g_instance); | 78 DCHECK(!g_instance); |
| 78 g_instance = this; | 79 g_instance = this; |
| 79 } | 80 } |
| 80 | 81 |
| 81 bool NetworkConfigView::InitWithNetworkState(const NetworkState* network) { | 82 bool NetworkConfigView::InitWithNetworkState(const NetworkState* network) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 193 } |
| 193 | 194 |
| 194 views::View* NetworkConfigView::CreateExtraView() { | 195 views::View* NetworkConfigView::CreateExtraView() { |
| 195 return advanced_button_; | 196 return advanced_button_; |
| 196 } | 197 } |
| 197 | 198 |
| 198 views::View* NetworkConfigView::GetInitiallyFocusedView() { | 199 views::View* NetworkConfigView::GetInitiallyFocusedView() { |
| 199 return child_config_view_->GetInitiallyFocusedView(); | 200 return child_config_view_->GetInitiallyFocusedView(); |
| 200 } | 201 } |
| 201 | 202 |
| 203 int NetworkConfigView::GetDefaultDialogButton() const { |
| 204 return ui::DIALOG_BUTTON_CANCEL; |
| 205 } |
| 206 |
| 202 base::string16 NetworkConfigView::GetWindowTitle() const { | 207 base::string16 NetworkConfigView::GetWindowTitle() const { |
| 203 DCHECK(!child_config_view_->GetTitle().empty()); | 208 DCHECK(!child_config_view_->GetTitle().empty()); |
| 204 return child_config_view_->GetTitle(); | 209 return child_config_view_->GetTitle(); |
| 205 } | 210 } |
| 206 | 211 |
| 207 ui::ModalType NetworkConfigView::GetModalType() const { | 212 ui::ModalType NetworkConfigView::GetModalType() const { |
| 208 return ui::MODAL_TYPE_SYSTEM; | 213 return ui::MODAL_TYPE_SYSTEM; |
| 209 } | 214 } |
| 210 | 215 |
| 211 void NetworkConfigView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 216 void NetworkConfigView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 225 void NetworkConfigView::ShowAdvancedView() { | 230 void NetworkConfigView::ShowAdvancedView() { |
| 226 // Clear out the old widgets and build new ones. | 231 // Clear out the old widgets and build new ones. |
| 227 RemoveChildView(child_config_view_); | 232 RemoveChildView(child_config_view_); |
| 228 delete child_config_view_; | 233 delete child_config_view_; |
| 229 // For now, there is only an advanced view for Wi-Fi 802.1X. | 234 // For now, there is only an advanced view for Wi-Fi 802.1X. |
| 230 child_config_view_ = new WifiConfigView(this, | 235 child_config_view_ = new WifiConfigView(this, |
| 231 "" /* service_path */, | 236 "" /* service_path */, |
| 232 true /* show_8021x */); | 237 true /* show_8021x */); |
| 233 AddChildView(child_config_view_); | 238 AddChildView(child_config_view_); |
| 234 // Resize the window to be able to hold the new widgets. | 239 // Resize the window to be able to hold the new widgets. |
| 235 gfx::Size size = views::Widget::GetLocalizedContentsSize( | 240 gfx::Size size = GetWidget()->client_view()->GetPreferredSize(); |
| 241 gfx::Size predefined_size = views::Widget::GetLocalizedContentsSize( |
| 236 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_WIDTH_CHARS, | 242 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_WIDTH_CHARS, |
| 237 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES); | 243 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES); |
| 244 size.SetToMax(predefined_size); |
| 245 |
| 238 // Get the new bounds with desired size at the same center point. | 246 // Get the new bounds with desired size at the same center point. |
| 239 gfx::Rect bounds = GetWidget()->GetWindowBoundsInScreen(); | 247 gfx::Rect bounds = GetWidget()->GetWindowBoundsInScreen(); |
| 240 int horiz_padding = bounds.width() - size.width(); | 248 int horiz_padding = bounds.width() - size.width(); |
| 241 int vert_padding = bounds.height() - size.height(); | 249 int vert_padding = bounds.height() - size.height(); |
| 242 bounds.Inset(horiz_padding / 2, vert_padding / 2, | 250 bounds.Inset(horiz_padding / 2, vert_padding / 2, |
| 243 horiz_padding / 2, vert_padding / 2); | 251 horiz_padding / 2, vert_padding / 2); |
| 244 GetWidget()->SetBoundsConstrained(bounds); | 252 GetWidget()->SetBoundsConstrained(bounds); |
| 245 Layout(); | 253 Layout(); |
| 246 child_config_view_->InitFocus(); | 254 child_config_view_->InitFocus(); |
| 247 } | 255 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 337 } |
| 330 | 338 |
| 331 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {} | 339 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {} |
| 332 | 340 |
| 333 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const { | 341 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const { |
| 334 return (managed_ && visible()) ? image_view_->GetPreferredSize() | 342 return (managed_ && visible()) ? image_view_->GetPreferredSize() |
| 335 : gfx::Size(); | 343 : gfx::Size(); |
| 336 } | 344 } |
| 337 | 345 |
| 338 } // namespace chromeos | 346 } // namespace chromeos |
| OLD | NEW |