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

Side by Side Diff: ash/system/overview/overview_button_tray.cc

Issue 2051663005: Vectorize the remaining material design shelf icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/system/overview/overview_button_tray.h" 5 #include "ash/system/overview/overview_button_tray.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h"
7 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
9 #include "ash/common/shelf/wm_shelf_util.h" 11 #include "ash/common/shelf/wm_shelf_util.h"
10 #include "ash/shelf/shelf_util.h" 12 #include "ash/shelf/shelf_util.h"
11 #include "ash/shell.h" 13 #include "ash/shell.h"
12 #include "ash/system/tray/system_tray_delegate.h" 14 #include "ash/system/tray/system_tray_delegate.h"
13 #include "ash/system/tray/tray_utils.h" 15 #include "ash/system/tray/tray_utils.h"
14 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 16 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
15 #include "ash/wm/overview/window_selector_controller.h" 17 #include "ash/wm/overview/window_selector_controller.h"
16 #include "grit/ash_resources.h" 18 #include "grit/ash_resources.h"
17 #include "grit/ash_strings.h" 19 #include "grit/ash_strings.h"
18 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/gfx/paint_vector_icon.h"
23 #include "ui/gfx/vector_icons_public.h"
20 #include "ui/views/border.h" 24 #include "ui/views/border.h"
21 #include "ui/views/controls/image_view.h" 25 #include "ui/views/controls/image_view.h"
22 26
23 namespace { 27 namespace {
24 28
25 // Predefined padding for the icon used in this tray. These are to be set to the 29 // Predefined padding for the icon used in this tray. These are to be set to the
26 // border of the icon, depending on the current shelf_alignment() 30 // border of the icon, depending on the current shelf_alignment()
27 const int kHorizontalShelfHorizontalPadding = 8; 31 const int kHorizontalShelfHorizontalPadding = 8;
28 const int kHorizontalShelfVerticalPadding = 4; 32 const int kHorizontalShelfVerticalPadding = 4;
29 const int kVerticalShelfHorizontalPadding = 2; 33 const int kVerticalShelfHorizontalPadding = 2;
30 const int kVerticalShelfVerticalPadding = 5; 34 const int kVerticalShelfVerticalPadding = 5;
31 35
32 } // namespace 36 } // namespace
33 37
34 namespace ash { 38 namespace ash {
35 39
36 OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget) 40 OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget)
37 : TrayBackgroundView(status_area_widget), icon_(NULL) { 41 : TrayBackgroundView(status_area_widget), icon_(NULL) {
38 SetContentsBackground(); 42 SetContentsBackground();
39 43
40 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 44 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
41 icon_ = new views::ImageView(); 45 icon_ = new views::ImageView();
42 icon_->SetImage( 46 gfx::ImageSkia image_md =
James Cook 2016/06/09 19:24:48 ditto
tdanderson 2016/06/09 22:36:33 Done.
43 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia()); 47 CreateVectorIcon(gfx::VectorIconId::SHELF_OVERVIEW, kShelfIconColor);
48 gfx::ImageSkia* image_non_md =
49 bundle.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE);
50 icon_->SetImage(MaterialDesignController::IsMaterial() ? &image_md
51 : image_non_md);
44 SetIconBorderForShelfAlignment(); 52 SetIconBorderForShelfAlignment();
45 tray_container()->AddChildView(icon_); 53 tray_container()->AddChildView(icon_);
46 54
47 Shell::GetInstance()->AddShellObserver(this); 55 Shell::GetInstance()->AddShellObserver(this);
48 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); 56 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this);
49 } 57 }
50 58
51 OverviewButtonTray::~OverviewButtonTray() { 59 OverviewButtonTray::~OverviewButtonTray() {
52 Shell::GetInstance()->RemoveShellObserver(this); 60 Shell::GetInstance()->RemoveShellObserver(this);
53 Shell::GetInstance()->session_state_delegate()->RemoveSessionStateObserver( 61 Shell::GetInstance()->session_state_delegate()->RemoveSessionStateObserver(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() && 140 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() &&
133 session_state_delegate->IsActiveUserSessionStarted() && 141 session_state_delegate->IsActiveUserSessionStarted() &&
134 !session_state_delegate->IsScreenLocked() && 142 !session_state_delegate->IsScreenLocked() &&
135 session_state_delegate->GetSessionState() == 143 session_state_delegate->GetSessionState() ==
136 SessionStateDelegate::SESSION_STATE_ACTIVE && 144 SessionStateDelegate::SESSION_STATE_ACTIVE &&
137 shell->system_tray_delegate()->GetUserLoginStatus() != 145 shell->system_tray_delegate()->GetUserLoginStatus() !=
138 LoginStatus::KIOSK_APP); 146 LoginStatus::KIOSK_APP);
139 } 147 }
140 148
141 } // namespace ash 149 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698