OLD | NEW |
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/view_click_listener.h" | 11 #include "ash/common/system/tray/view_click_listener.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/gfx/color_palette.h" | 16 #include "ui/gfx/color_palette.h" |
17 #include "ui/gfx/paint_vector_icon.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
| 18 #include "ui/gfx/vector_icons_public.h" |
18 #include "ui/views/border.h" | 19 #include "ui/views/border.h" |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
21 namespace { | 22 namespace { |
22 | 23 |
23 // Size of the icons in DP. | 24 // Size of the icons in DP. |
24 const int kIconSize = 20; | 25 const int kIconSize = 20; |
25 | 26 |
26 // Distance between the icon and the check from the egdes in DP. | 27 // Distance between the icon and the check from the egdes in DP. |
27 const int kMarginFromEdges = 14; | 28 const int kMarginFromEdges = 14; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 70 |
70 void CommonPaletteTool::OnViewClicked(views::View* sender) { | 71 void CommonPaletteTool::OnViewClicked(views::View* sender) { |
71 if (enabled()) | 72 if (enabled()) |
72 delegate()->DisableTool(GetToolId()); | 73 delegate()->DisableTool(GetToolId()); |
73 else | 74 else |
74 delegate()->EnableTool(GetToolId()); | 75 delegate()->EnableTool(GetToolId()); |
75 } | 76 } |
76 | 77 |
77 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { | 78 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { |
78 gfx::ImageSkia icon = | 79 gfx::ImageSkia icon = |
79 CreateVectorIcon(GetPaletteIconId(), kIconSize, gfx::kChromeIconGrey); | 80 CreateVectorIcon(GetPaletteIcon(), kIconSize, gfx::kChromeIconGrey); |
80 gfx::ImageSkia check = CreateVectorIcon(gfx::VectorIconId::CHECK_CIRCLE, | 81 gfx::ImageSkia check = CreateVectorIcon(gfx::VectorIconId::CHECK_CIRCLE, |
81 kIconSize, gfx::kGoogleGreen700); | 82 kIconSize, gfx::kGoogleGreen700); |
82 | 83 |
83 highlight_view_ = new HoverHighlightView(this); | 84 highlight_view_ = new HoverHighlightView(this); |
84 highlight_view_->SetBorder( | 85 highlight_view_->SetBorder( |
85 views::Border::CreateEmptyBorder(0, kExtraMarginFromLeftEdge, 0, 0)); | 86 views::Border::CreateEmptyBorder(0, kExtraMarginFromLeftEdge, 0, 0)); |
86 highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kIconSize, | 87 highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kIconSize, |
87 kMarginFromEdges, | 88 kMarginFromEdges, |
88 kMarginBetweenIconAndText); | 89 kMarginBetweenIconAndText); |
89 highlight_view_->AddRightIcon(check, kIconSize); | 90 highlight_view_->AddRightIcon(check, kIconSize); |
90 | 91 |
91 if (enabled()) | 92 if (enabled()) |
92 highlight_view_->SetHighlight(true); | 93 highlight_view_->SetHighlight(true); |
93 else | 94 else |
94 highlight_view_->SetRightIconVisible(false); | 95 highlight_view_->SetRightIconVisible(false); |
95 | 96 |
96 return highlight_view_; | 97 return highlight_view_; |
97 } | 98 } |
98 | 99 |
99 } // namespace ash | 100 } // namespace ash |
OLD | NEW |