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

Side by Side Diff: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc

Issue 2316183003: Move a bunch of ash-only vector icons to ash/. (Closed)
Patch Set: drop the "id". Just "icon". It's cleaner. Created 4 years, 3 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 "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" 5 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
10 #include "ash/common/system/tray/hover_highlight_view.h" 10 #include "ash/common/system/tray/hover_highlight_view.h"
11 #include "ash/common/system/tray/system_tray.h" 11 #include "ash/common/system/tray/system_tray.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 12 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/system/tray/system_tray_notifier.h" 13 #include "ash/common/system/tray/system_tray_notifier.h"
14 #include "ash/common/system/tray/throbber_view.h" 14 #include "ash/common/system/tray/throbber_view.h"
15 #include "ash/common/system/tray/tray_constants.h" 15 #include "ash/common/system/tray/tray_constants.h"
16 #include "ash/common/system/tray/tray_details_view.h" 16 #include "ash/common/system/tray/tray_details_view.h"
17 #include "ash/common/system/tray/tray_item_more.h" 17 #include "ash/common/system/tray/tray_item_more.h"
18 #include "ash/common/system/tray/tray_popup_header_button.h" 18 #include "ash/common/system/tray/tray_popup_header_button.h"
19 #include "ash/common/wm_shell.h" 19 #include "ash/common/wm_shell.h"
20 #include "ash/resources/vector_icons/vector_icons.h"
20 #include "grit/ash_resources.h" 21 #include "grit/ash_resources.h"
21 #include "grit/ash_strings.h" 22 #include "grit/ash_strings.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
25 #include "ui/gfx/paint_vector_icon.h" 26 #include "ui/gfx/paint_vector_icon.h"
26 #include "ui/gfx/vector_icons_public.h"
27 #include "ui/views/controls/image_view.h" 27 #include "ui/views/controls/image_view.h"
28 #include "ui/views/controls/label.h" 28 #include "ui/views/controls/label.h"
29 #include "ui/views/layout/box_layout.h" 29 #include "ui/views/layout/box_layout.h"
30 30
31 namespace ash { 31 namespace ash {
32 namespace tray { 32 namespace tray {
33 namespace { 33 namespace {
34 34
35 // Updates bluetooth device |device| in the |list|. If it is new, append to the 35 // Updates bluetooth device |device| in the |list|. If it is new, append to the
36 // end of the |list|; otherwise, keep it at the same place, but update the data 36 // end of the |list|; otherwise, keep it at the same place, but update the data
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 Update(); 77 Update();
78 } 78 }
79 79
80 ~BluetoothDefaultView() override {} 80 ~BluetoothDefaultView() override {}
81 81
82 void Update() { 82 void Update() {
83 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 83 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
84 const bool enabled = delegate->GetBluetoothEnabled(); 84 const bool enabled = delegate->GetBluetoothEnabled();
85 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 85 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
86 gfx::VectorIconId icon_id = 86 SetImage(gfx::CreateVectorIcon(
87 enabled ? gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH 87 enabled ? kSystemMenuBluetoothIcon : kSystemMenuBluetoothDisabledIcon,
88 : gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH_DISABLED; 88 kMenuIconColor));
89 SetImage(gfx::CreateVectorIcon(icon_id, kMenuIconColor));
90 } 89 }
91 90
92 if (delegate->GetBluetoothAvailable()) { 91 if (delegate->GetBluetoothAvailable()) {
93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 92 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
94 const base::string16 label = rb.GetLocalizedString( 93 const base::string16 label = rb.GetLocalizedString(
95 enabled ? IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED 94 enabled ? IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED
96 : IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED); 95 : IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED);
97 SetLabel(label); 96 SetLabel(label);
98 SetAccessibleName(label); 97 SetAccessibleName(label);
99 SetVisible(true); 98 SetVisible(true);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 detailed_->Update(); 473 detailed_->Update();
475 } 474 }
476 475
477 void TrayBluetooth::OnBluetoothDiscoveringChanged() { 476 void TrayBluetooth::OnBluetoothDiscoveringChanged() {
478 if (!detailed_) 477 if (!detailed_)
479 return; 478 return;
480 detailed_->Update(); 479 detailed_->Update();
481 } 480 }
482 481
483 } // namespace ash 482 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/cast/tray_cast.cc ('k') | ash/common/system/chromeos/brightness/tray_brightness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698