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

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

Issue 2803893002: Reuse the code within UpdateCheckMark() (Closed)
Patch Set: Reuse the code within UpdateCheckMark(). Created 3 years, 8 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/tray_popup_utils.h"
12 #include "ash/common/system/tray/view_click_listener.h" 13 #include "ash/common/system/tray/view_click_listener.h"
13 #include "ash/resources/grit/ash_resources.h" 14 #include "ash/resources/grit/ash_resources.h"
14 #include "ash/resources/vector_icons/vector_icons.h" 15 #include "ash/resources/vector_icons/vector_icons.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/color_palette.h" 20 #include "ui/gfx/color_palette.h"
20 #include "ui/gfx/paint_vector_icon.h" 21 #include "ui/gfx/paint_vector_icon.h"
21 #include "ui/views/border.h" 22 #include "ui/views/border.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 PaletteToolIdToPaletteModeCancelType(GetToolId(), 79 PaletteToolIdToPaletteModeCancelType(GetToolId(),
79 false /*is_switched*/)); 80 false /*is_switched*/));
80 } else { 81 } else {
81 delegate()->EnableTool(GetToolId()); 82 delegate()->EnableTool(GetToolId());
82 } 83 }
83 } 84 }
84 85
85 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { 86 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) {
86 gfx::ImageSkia icon = 87 gfx::ImageSkia icon =
87 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey); 88 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey);
88 gfx::ImageSkia check =
89 CreateVectorIcon(kCheckCircleIcon, kMenuIconSize, gfx::kGoogleGreen700);
90 89
91 highlight_view_ = new HoverHighlightView(this); 90 highlight_view_ = new HoverHighlightView(this);
92 highlight_view_->SetBorder(views::CreateEmptyBorder(0, 0, 0, 0)); 91 highlight_view_->SetBorder(views::CreateEmptyBorder(0, 0, 0, 0));
93 highlight_view_->AddIconAndLabel(icon, name); 92 highlight_view_->AddIconAndLabel(icon, name);
94 highlight_view_->AddRightIcon(check, kMenuIconSize);
95 highlight_view_->set_custom_height(kMenuButtonSize); 93 highlight_view_->set_custom_height(kMenuButtonSize);
96 94
97 if (enabled()) { 95 TrayPopupUtils::UpdateCheckMarkVisibility(highlight_view_, enabled());
98 highlight_view_->SetAccessiblityState(
99 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX);
100 } else {
101 highlight_view_->SetRightViewVisible(false);
102 highlight_view_->SetAccessiblityState(
103 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX);
104 }
105 96
106 return highlight_view_; 97 return highlight_view_;
107 } 98 }
108 99
109 } // namespace ash 100 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698