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

Side by Side Diff: ash/common/system/chromeos/brightness/tray_brightness.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/brightness/tray_brightness.h" 5 #include "ash/common/system/chromeos/brightness/tray_brightness.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
11 #include "ash/common/shell_observer.h" 11 #include "ash/common/shell_observer.h"
12 #include "ash/common/system/brightness_control_delegate.h" 12 #include "ash/common/system/brightness_control_delegate.h"
13 #include "ash/common/system/tray/fixed_sized_image_view.h" 13 #include "ash/common/system/tray/fixed_sized_image_view.h"
14 #include "ash/common/system/tray/system_tray_delegate.h" 14 #include "ash/common/system/tray/system_tray_delegate.h"
15 #include "ash/common/system/tray/tray_constants.h" 15 #include "ash/common/system/tray/tray_constants.h"
16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
17 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
18 #include "ash/resources/vector_icons/vector_icons.h"
18 #include "base/bind.h" 19 #include "base/bind.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
21 #include "chromeos/dbus/dbus_thread_manager.h" 22 #include "chromeos/dbus/dbus_thread_manager.h"
22 #include "chromeos/dbus/power_manager_client.h" 23 #include "chromeos/dbus/power_manager_client.h"
23 #include "grit/ash_resources.h" 24 #include "grit/ash_resources.h"
24 #include "grit/ash_strings.h" 25 #include "grit/ash_strings.h"
25 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
26 #include "ui/display/display.h" 27 #include "ui/display/display.h"
27 #include "ui/gfx/image/image.h" 28 #include "ui/gfx/image/image.h"
28 #include "ui/gfx/paint_vector_icon.h" 29 #include "ui/gfx/paint_vector_icon.h"
29 #include "ui/gfx/vector_icons_public.h"
30 #include "ui/views/controls/button/image_button.h" 30 #include "ui/views/controls/button/image_button.h"
31 #include "ui/views/controls/image_view.h" 31 #include "ui/views/controls/image_view.h"
32 #include "ui/views/controls/label.h" 32 #include "ui/views/controls/label.h"
33 #include "ui/views/controls/slider.h" 33 #include "ui/views/controls/slider.h"
34 #include "ui/views/layout/box_layout.h" 34 #include "ui/views/layout/box_layout.h"
35 #include "ui/views/view.h" 35 #include "ui/views/view.h"
36 36
37 namespace ash { 37 namespace ash {
38 namespace tray { 38 namespace tray {
39 namespace { 39 namespace {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 is_default_view_(default_view), 96 is_default_view_(default_view),
97 last_percent_(initial_percent) { 97 last_percent_(initial_percent) {
98 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 98 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
99 kTrayPopupPaddingHorizontal, 0, 99 kTrayPopupPaddingHorizontal, 0,
100 kTrayPopupPaddingBetweenItems)); 100 kTrayPopupPaddingBetweenItems));
101 101
102 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 102 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
103 views::ImageView* icon = 103 views::ImageView* icon =
104 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); 104 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT));
105 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 105 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
106 icon->SetImage(gfx::CreateVectorIcon( 106 icon->SetImage(
107 gfx::VectorIconId::SYSTEM_MENU_BRIGHTNESS, kMenuIconColor)); 107 gfx::CreateVectorIcon(kSystemMenuBrightnessIcon, kMenuIconColor));
108 } else { 108 } else {
109 icon->SetImage( 109 icon->SetImage(
110 rb.GetImageNamed(IDR_AURA_UBER_TRAY_BRIGHTNESS).ToImageSkia()); 110 rb.GetImageNamed(IDR_AURA_UBER_TRAY_BRIGHTNESS).ToImageSkia());
111 } 111 }
112 AddChildView(icon); 112 AddChildView(icon);
113 113
114 slider_ = new views::Slider(this); 114 slider_ = new views::Slider(this);
115 slider_->set_focus_border_color(kFocusBorderColor); 115 slider_->set_focus_border_color(kFocusBorderColor);
116 slider_->SetValue(static_cast<float>(initial_percent / 100.0)); 116 slider_->SetValue(static_cast<float>(initial_percent / 100.0));
117 slider_->SetAccessibleName( 117 slider_->SetAccessibleName(
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 if (!display::Display::HasInternalDisplay()) 277 if (!display::Display::HasInternalDisplay())
278 return; 278 return;
279 279
280 if (brightness_view_) 280 if (brightness_view_)
281 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 281 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
282 else 282 else
283 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 283 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
284 } 284 }
285 285
286 } // namespace ash 286 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/bluetooth/tray_bluetooth.cc ('k') | ash/common/system/chromeos/network/tray_sms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698