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 "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 horiz_padding / 2, vert_padding / 2); | 245 horiz_padding / 2, vert_padding / 2); |
246 GetWidget()->SetBoundsConstrained(bounds); | 246 GetWidget()->SetBoundsConstrained(bounds); |
247 Layout(); | 247 Layout(); |
248 child_config_view_->InitFocus(); | 248 child_config_view_->InitFocus(); |
249 } | 249 } |
250 | 250 |
251 void NetworkConfigView::Layout() { | 251 void NetworkConfigView::Layout() { |
252 child_config_view_->SetBounds(0, 0, width(), height()); | 252 child_config_view_->SetBounds(0, 0, width(), height()); |
253 } | 253 } |
254 | 254 |
255 gfx::Size NetworkConfigView::GetPreferredSize() { | 255 gfx::Size NetworkConfigView::GetPreferredSize() const { |
256 gfx::Size result(views::Widget::GetLocalizedContentsSize( | 256 gfx::Size result(views::Widget::GetLocalizedContentsSize( |
257 IDS_JOIN_WIFI_NETWORK_DIALOG_WIDTH_CHARS, | 257 IDS_JOIN_WIFI_NETWORK_DIALOG_WIDTH_CHARS, |
258 IDS_JOIN_WIFI_NETWORK_DIALOG_MINIMUM_HEIGHT_LINES)); | 258 IDS_JOIN_WIFI_NETWORK_DIALOG_MINIMUM_HEIGHT_LINES)); |
259 gfx::Size size = child_config_view_->GetPreferredSize(); | 259 gfx::Size size = child_config_view_->GetPreferredSize(); |
260 result.set_height(size.height()); | 260 result.set_height(size.height()); |
261 if (size.width() > result.width()) | 261 if (size.width() > result.width()) |
262 result.set_width(size.width()); | 262 result.set_width(size.width()); |
263 return result; | 263 return result; |
264 } | 264 } |
265 | 265 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 void ControlledSettingIndicatorView::Update( | 330 void ControlledSettingIndicatorView::Update( |
331 const NetworkPropertyUIData& ui_data) { | 331 const NetworkPropertyUIData& ui_data) { |
332 if (managed_ == ui_data.IsManaged()) | 332 if (managed_ == ui_data.IsManaged()) |
333 return; | 333 return; |
334 | 334 |
335 managed_ = ui_data.IsManaged(); | 335 managed_ = ui_data.IsManaged(); |
336 PreferredSizeChanged(); | 336 PreferredSizeChanged(); |
337 } | 337 } |
338 | 338 |
339 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() { | 339 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const { |
340 return (managed_ && visible()) ? image_view_->GetPreferredSize() | 340 return (managed_ && visible()) ? image_view_->GetPreferredSize() |
341 : gfx::Size(); | 341 : gfx::Size(); |
342 } | 342 } |
343 | 343 |
344 void ControlledSettingIndicatorView::Layout() { | 344 void ControlledSettingIndicatorView::Layout() { |
345 image_view_->SetBounds(0, 0, width(), height()); | 345 image_view_->SetBounds(0, 0, width(), height()); |
346 } | 346 } |
347 | 347 |
348 void ControlledSettingIndicatorView::Init() { | 348 void ControlledSettingIndicatorView::Init() { |
349 image_ = ResourceBundle::GetSharedInstance().GetImageNamed( | 349 image_ = ResourceBundle::GetSharedInstance().GetImageNamed( |
350 IDR_CONTROLLED_SETTING_MANDATORY).ToImageSkia(); | 350 IDR_CONTROLLED_SETTING_MANDATORY).ToImageSkia(); |
351 image_view_ = new views::ImageView(); | 351 image_view_ = new views::ImageView(); |
352 // Disable |image_view_| so mouse events propagate to the parent. | 352 // Disable |image_view_| so mouse events propagate to the parent. |
353 image_view_->SetEnabled(false); | 353 image_view_->SetEnabled(false); |
354 image_view_->SetImage(image_); | 354 image_view_->SetImage(image_); |
355 image_view_->SetTooltipText( | 355 image_view_->SetTooltipText( |
356 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); | 356 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); |
357 AddChildView(image_view_); | 357 AddChildView(image_view_); |
358 } | 358 } |
359 | 359 |
360 } // namespace chromeos | 360 } // namespace chromeos |
OLD | NEW |