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

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

Issue 2365263006: Delete pre-MD code from OmniboxResultView (Closed)
Patch Set: update references to constant (merge resolution) Created 4 years, 2 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
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/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"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 12 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
13 #include "chrome/browser/chromeos/options/network_property_ui_data.h" 13 #include "chrome/browser/chromeos/options/network_property_ui_data.h"
14 #include "chrome/browser/chromeos/options/vpn_config_view.h" 14 #include "chrome/browser/chromeos/options/vpn_config_view.h"
15 #include "chrome/browser/chromeos/options/wifi_config_view.h" 15 #include "chrome/browser/chromeos/options/wifi_config_view.h"
16 #include "chrome/browser/chromeos/options/wimax_config_view.h" 16 #include "chrome/browser/chromeos/options/wimax_config_view.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
22 #include "chrome/grit/locale_settings.h" 22 #include "chrome/grit/locale_settings.h"
23 #include "chrome/grit/theme_resources.h"
24 #include "chromeos/login/login_state.h" 23 #include "chromeos/login/login_state.h"
25 #include "chromeos/network/network_state.h" 24 #include "chromeos/network/network_state.h"
26 #include "chromeos/network/network_state_handler.h" 25 #include "chromeos/network/network_state_handler.h"
27 #include "components/device_event_log/device_event_log.h" 26 #include "components/device_event_log/device_event_log.h"
28 #include "components/grit/components_scaled_resources.h"
29 #include "components/user_manager/user.h" 27 #include "components/user_manager/user.h"
30 #include "ui/accessibility/ax_view_state.h" 28 #include "ui/accessibility/ax_view_state.h"
31 #include "ui/aura/window_event_dispatcher.h" 29 #include "ui/aura/window_event_dispatcher.h"
32 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/gfx/color_palette.h"
34 #include "ui/gfx/geometry/rect.h" 32 #include "ui/gfx/geometry/rect.h"
35 #include "ui/gfx/image/image.h" 33 #include "ui/gfx/image/image.h"
34 #include "ui/gfx/paint_vector_icon.h"
35 #include "ui/gfx/vector_icons_public.h"
36 #include "ui/views/controls/button/md_text_button.h" 36 #include "ui/views/controls/button/md_text_button.h"
37 #include "ui/views/controls/image_view.h" 37 #include "ui/views/controls/image_view.h"
38 #include "ui/views/layout/fill_layout.h"
38 #include "ui/views/layout/layout_constants.h" 39 #include "ui/views/layout/layout_constants.h"
39 #include "ui/views/widget/widget.h" 40 #include "ui/views/widget/widget.h"
40 41
41 using views::Widget; 42 using views::Widget;
42 43
43 namespace chromeos { 44 namespace chromeos {
44 45
45 namespace { 46 namespace {
46 47
47 gfx::NativeWindow GetParentForUnhostedDialog() { 48 gfx::NativeWindow GetParentForUnhostedDialog() {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // static 306 // static
306 void ChildNetworkConfigView::GetShareStateForLoginState(bool* default_value, 307 void ChildNetworkConfigView::GetShareStateForLoginState(bool* default_value,
307 bool* modifiable) { 308 bool* modifiable) {
308 *default_value = !LoginState::Get()->UserHasNetworkProfile(); 309 *default_value = !LoginState::Get()->UserHasNetworkProfile();
309 // Allow only authenticated user to change the share state. 310 // Allow only authenticated user to change the share state.
310 *modifiable = LoginState::Get()->IsUserAuthenticated(); 311 *modifiable = LoginState::Get()->IsUserAuthenticated();
311 } 312 }
312 313
313 // ControlledSettingIndicatorView 314 // ControlledSettingIndicatorView
314 315
315 ControlledSettingIndicatorView::ControlledSettingIndicatorView()
316 : managed_(false), image_view_(nullptr) {
317 Init();
318 }
319
320 ControlledSettingIndicatorView::ControlledSettingIndicatorView( 316 ControlledSettingIndicatorView::ControlledSettingIndicatorView(
321 const NetworkPropertyUIData& ui_data) 317 const NetworkPropertyUIData& ui_data)
322 : managed_(false), image_view_(nullptr) { 318 : managed_(ui_data.IsManaged()), image_view_(nullptr) {
323 Init(); 319 image_view_ = new views::ImageView();
324 Update(ui_data); 320 // Disable |image_view_| so mouse events propagate to the parent.
321 image_view_->SetEnabled(false);
322 image_view_->SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::BUSINESS, 16,
323 gfx::kChromeIconGrey));
324 image_view_->SetTooltipText(
325 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY));
326 AddChildView(image_view_);
327 SetLayoutManager(new views::FillLayout());
325 } 328 }
326 329
327 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {} 330 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {}
328 331
329 void ControlledSettingIndicatorView::Update(
330 const NetworkPropertyUIData& ui_data) {
331 if (managed_ == ui_data.IsManaged())
332 return;
333
334 managed_ = ui_data.IsManaged();
335 PreferredSizeChanged();
336 }
337
338 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const { 332 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() const {
339 return (managed_ && visible()) ? image_view_->GetPreferredSize() 333 return (managed_ && visible()) ? image_view_->GetPreferredSize()
340 : gfx::Size(); 334 : gfx::Size();
341 } 335 }
342 336
343 void ControlledSettingIndicatorView::Layout() {
344 image_view_->SetBounds(0, 0, width(), height());
345 }
346
347 void ControlledSettingIndicatorView::Init() {
348 image_ = ResourceBundle::GetSharedInstance()
349 .GetImageNamed(IDR_OMNIBOX_HTTPS_POLICY_WARNING)
350 .ToImageSkia();
351 image_view_ = new views::ImageView();
352 // Disable |image_view_| so mouse events propagate to the parent.
353 image_view_->SetEnabled(false);
354 image_view_->SetImage(image_);
355 image_view_->SetTooltipText(
356 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY));
357 AddChildView(image_view_);
358 }
359
360 } // namespace chromeos 337 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698