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

Side by Side Diff: ash/common/system/chromeos/palette/common_palette_tool.cc

Issue 2733823003: Move final vector icons out of ui/gfx/vector_icons/ and remove the (Closed)
Patch Set: fix cast shell maybe Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/palette/common_palette_tool.h" 5 #include "ash/common/system/chromeos/palette/common_palette_tool.h"
6 6
7 #include "ash/common/shelf/shelf_constants.h" 7 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/common/system/chromeos/palette/palette_ids.h" 8 #include "ash/common/system/chromeos/palette/palette_ids.h"
9 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" 9 #include "ash/common/system/chromeos/palette/palette_tool_manager.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/tray_constants.h" 11 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/common/system/tray/view_click_listener.h" 12 #include "ash/common/system/tray/view_click_listener.h"
13 #include "ash/resources/grit/ash_resources.h" 13 #include "ash/resources/grit/ash_resources.h"
14 #include "ash/resources/vector_icons/vector_icons.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/color_palette.h" 19 #include "ui/gfx/color_palette.h"
19 #include "ui/gfx/paint_vector_icon.h" 20 #include "ui/gfx/paint_vector_icon.h"
20 #include "ui/gfx/vector_icons_public.h"
21 #include "ui/views/border.h" 21 #include "ui/views/border.h"
22 #include "ui/views/controls/label.h" 22 #include "ui/views/controls/label.h"
23 23
24 namespace ash { 24 namespace ash {
25 namespace { 25 namespace {
26 26
27 void AddHistogramTimes(PaletteToolId id, base::TimeDelta duration) { 27 void AddHistogramTimes(PaletteToolId id, base::TimeDelta duration) {
28 if (id == PaletteToolId::LASER_POINTER) { 28 if (id == PaletteToolId::LASER_POINTER) {
29 UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InLaserPointerMode", duration, 29 UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InLaserPointerMode", duration,
30 base::TimeDelta::FromMilliseconds(100), 30 base::TimeDelta::FromMilliseconds(100),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 PaletteToolIdToPaletteModeCancelType(GetToolId(), 78 PaletteToolIdToPaletteModeCancelType(GetToolId(),
79 false /*is_switched*/)); 79 false /*is_switched*/));
80 } else { 80 } else {
81 delegate()->EnableTool(GetToolId()); 81 delegate()->EnableTool(GetToolId());
82 } 82 }
83 } 83 }
84 84
85 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { 85 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) {
86 gfx::ImageSkia icon = 86 gfx::ImageSkia icon =
87 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey); 87 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey);
88 gfx::ImageSkia check = CreateVectorIcon(gfx::VectorIconId::CHECK_CIRCLE, 88 gfx::ImageSkia check =
89 kMenuIconSize, gfx::kGoogleGreen700); 89 CreateVectorIcon(kCheckCircleIcon, kMenuIconSize, gfx::kGoogleGreen700);
90 90
91 highlight_view_ = new HoverHighlightView(this); 91 highlight_view_ = new HoverHighlightView(this);
92 highlight_view_->SetBorder(views::CreateEmptyBorder(0, 0, 0, 0)); 92 highlight_view_->SetBorder(views::CreateEmptyBorder(0, 0, 0, 0));
93 const int interior_button_padding = (kMenuButtonSize - kMenuIconSize) / 2; 93 const int interior_button_padding = (kMenuButtonSize - kMenuIconSize) / 2;
94 highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kMenuIconSize, 94 highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kMenuIconSize,
95 interior_button_padding, 95 interior_button_padding,
96 kTrayPopupPaddingHorizontal); 96 kTrayPopupPaddingHorizontal);
97 highlight_view_->AddRightIcon(check, kMenuIconSize); 97 highlight_view_->AddRightIcon(check, kMenuIconSize);
98 highlight_view_->set_custom_height(kMenuButtonSize); 98 highlight_view_->set_custom_height(kMenuButtonSize);
99 99
100 if (enabled()) { 100 if (enabled()) {
101 highlight_view_->SetAccessiblityState( 101 highlight_view_->SetAccessiblityState(
102 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); 102 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX);
103 } else { 103 } else {
104 highlight_view_->SetRightViewVisible(false); 104 highlight_view_->SetRightViewVisible(false);
105 highlight_view_->SetAccessiblityState( 105 highlight_view_->SetAccessiblityState(
106 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); 106 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX);
107 } 107 }
108 108
109 return highlight_view_; 109 return highlight_view_;
110 } 110 }
111 111
112 } // namespace ash 112 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698