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

Side by Side Diff: ash/system/tray/hover_highlight_view.cc

Issue 1466393002: Support tooltip for HoverHighlightView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « ash/system/tray/hover_highlight_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tray/hover_highlight_view.h" 5 #include "ash/system/tray/hover_highlight_view.h"
6 6
7 #include "ash/system/tray/fixed_sized_image_view.h" 7 #include "ash/system/tray/fixed_sized_image_view.h"
8 #include "ash/system/tray/tray_constants.h" 8 #include "ash/system/tray/tray_constants.h"
9 #include "ash/system/tray/view_click_listener.h" 9 #include "ash/system/tray/view_click_listener.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 hover_(false), 43 hover_(false),
44 expandable_(false), 44 expandable_(false),
45 checkable_(false), 45 checkable_(false),
46 checked_(false) { 46 checked_(false) {
47 set_notify_enter_exit_on_child(true); 47 set_notify_enter_exit_on_child(true);
48 } 48 }
49 49
50 HoverHighlightView::~HoverHighlightView() { 50 HoverHighlightView::~HoverHighlightView() {
51 } 51 }
52 52
53 bool HoverHighlightView::GetTooltipText(const gfx::Point& p,
54 base::string16* tooltip) const {
55 if (tooltip_.empty())
56 return false;
57 *tooltip = tooltip_;
58 return true;
59 }
60
53 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, 61 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image,
54 const base::string16& text, 62 const base::string16& text,
55 bool highlight) { 63 bool highlight) {
56 SetLayoutManager(new views::BoxLayout( 64 SetLayoutManager(new views::BoxLayout(
57 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems)); 65 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems));
58 DoAddIconAndLabel(image, text, highlight); 66 DoAddIconAndLabel(image, text, highlight);
59 } 67 }
60 68
61 void HoverHighlightView::AddIndentedIconAndLabel(const gfx::ImageSkia& image, 69 void HoverHighlightView::AddIndentedIconAndLabel(const gfx::ImageSkia& image,
62 const base::string16& text, 70 const base::string16& text,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { 242 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) {
235 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); 243 canvas->DrawColor(hover_ ? highlight_color_ : default_color_);
236 } 244 }
237 245
238 void HoverHighlightView::OnFocus() { 246 void HoverHighlightView::OnFocus() {
239 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); 247 ScrollRectToVisible(gfx::Rect(gfx::Point(), size()));
240 ActionableView::OnFocus(); 248 ActionableView::OnFocus();
241 } 249 }
242 250
243 } // namespace ash 251 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/hover_highlight_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698