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

Side by Side Diff: ash/system/tray/tray_views.h

Issue 10078009: Add an accessible name to the restart button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/tray/tray_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ 5 #ifndef ASH_SYSTEM_TRAY_TRAY_VIEWS_H_
6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ 6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ui/gfx/font.h" 9 #include "ui/gfx/font.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 protected: 52 protected:
53 // Performs an action when user clicks on the view (on mouse-press event), or 53 // Performs an action when user clicks on the view (on mouse-press event), or
54 // presses a key when this view is in focus. Returns true if the event has 54 // presses a key when this view is in focus. Returns true if the event has
55 // been handled and an action was performed. Returns false otherwise. 55 // been handled and an action was performed. Returns false otherwise.
56 virtual bool PerformAction(const views::Event& event) = 0; 56 virtual bool PerformAction(const views::Event& event) = 0;
57 57
58 // Overridden from views::View. 58 // Overridden from views::View.
59 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; 59 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE;
60 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; 60 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
61 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; 61 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
62 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
sadrul 2012/04/19 11:25:38 GetAccessibleState should be above OnPaintFocusBor
Zachary Kuznia 2012/04/20 09:26:58 Done.
63
64 // Set the accessible name.
65 void SetAccessibleName(const string16& name);
sadrul 2012/04/19 11:25:38 This should be in line ~58 (above the overridden m
sadrul 2012/04/19 11:33:58 Perhaps just make this public, and add accessible_
Zachary Kuznia 2012/04/20 09:26:58 Done.
Zachary Kuznia 2012/04/20 09:26:58 Done.
62 66
63 private: 67 private:
68 string16 accessible_name_;
69
64 DISALLOW_COPY_AND_ASSIGN(ActionableView); 70 DISALLOW_COPY_AND_ASSIGN(ActionableView);
65 }; 71 };
66 72
67 class ViewClickListener { 73 class ViewClickListener {
68 public: 74 public:
69 virtual ~ViewClickListener() {} 75 virtual ~ViewClickListener() {}
70 virtual void ClickedOn(views::View* sender) = 0; 76 virtual void ClickedOn(views::View* sender) = 0;
71 }; 77 };
72 78
73 // A view that changes background color on hover, and triggers a callback in the 79 // A view that changes background color on hover, and triggers a callback in the
74 // associated ViewClickListener on click. The view can also be forced to 80 // associated ViewClickListener on click. The view can also be forced to
75 // maintain a fixed height. 81 // maintain a fixed height.
76 class HoverHighlightView : public ActionableView { 82 class HoverHighlightView : public ActionableView {
77 public: 83 public:
78 explicit HoverHighlightView(ViewClickListener* listener); 84 explicit HoverHighlightView(ViewClickListener* listener);
79 virtual ~HoverHighlightView(); 85 virtual ~HoverHighlightView();
80 86
81 // Convenience function for adding an icon and a label. 87 // Convenience function for adding an icon and a label.
sadrul 2012/04/19 11:33:58 Update the comment here (and in 88) that this also
Zachary Kuznia 2012/04/20 09:26:58 Done.
82 void AddIconAndLabel(const SkBitmap& image, 88 void AddIconAndLabel(const SkBitmap& image,
83 const string16& text, 89 const string16& text,
84 gfx::Font::FontStyle style); 90 gfx::Font::FontStyle style);
85 91
86 // Convenience function for adding a label with padding on the left for a 92 // Convenience function for adding a label with padding on the left for a
87 // blank icon. 93 // blank icon.
88 void AddLabel(const string16& text, gfx::Font::FontStyle style); 94 void AddLabel(const string16& text, gfx::Font::FontStyle style);
89 95
90 // Set the accessible name. Should be used if this doesn't match the label. 96 // Set the accessible name. Should be used if this doesn't match the label.
91 void SetAccessibleName(const string16& name); 97 void SetAccessibleName(const string16& name);
sadrul 2012/04/19 11:33:58 Remove this.
Zachary Kuznia 2012/04/20 09:26:58 Done.
92 98
93 void set_highlight_color(SkColor color) { highlight_color_ = color; } 99 void set_highlight_color(SkColor color) { highlight_color_ = color; }
94 void set_default_color(SkColor color) { default_color_ = color; } 100 void set_default_color(SkColor color) { default_color_ = color; }
95 void set_fixed_height(int height) { fixed_height_ = height; } 101 void set_fixed_height(int height) { fixed_height_ = height; }
96 102
97 private: 103 private:
98 // Overridden from ActionableView. 104 // Overridden from ActionableView.
99 virtual bool PerformAction(const views::Event& event) OVERRIDE; 105 virtual bool PerformAction(const views::Event& event) OVERRIDE;
100 106
101 // Overridden from views::View. 107 // Overridden from views::View.
102 virtual gfx::Size GetPreferredSize() OVERRIDE; 108 virtual gfx::Size GetPreferredSize() OVERRIDE;
103 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; 109 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
104 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; 110 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
105 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 111 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
106 virtual void OnEnabledChanged() OVERRIDE; 112 virtual void OnEnabledChanged() OVERRIDE;
107 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; 113 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE;
108 114
109 ViewClickListener* listener_; 115 ViewClickListener* listener_;
110 string16 accessible_name_; 116 string16 accessible_name_;
sadrul 2012/04/19 11:33:58 And this
Zachary Kuznia 2012/04/20 09:26:58 Done.
111 SkColor highlight_color_; 117 SkColor highlight_color_;
112 SkColor default_color_; 118 SkColor default_color_;
113 int fixed_height_; 119 int fixed_height_;
114 bool hover_; 120 bool hover_;
115 121
116 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); 122 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView);
117 }; 123 };
118 124
119 // A custom scroll-view that has a specified dimension. 125 // A custom scroll-view that has a specified dimension.
120 class FixedSizedScrollView : public views::ScrollView { 126 class FixedSizedScrollView : public views::ScrollView {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 views::View* CreateDetailedHeaderEntry(int string_id, 206 views::View* CreateDetailedHeaderEntry(int string_id,
201 ViewClickListener* listener); 207 ViewClickListener* listener);
202 208
203 // Sets up a Label properly for the tray (sets color, font etc.). 209 // Sets up a Label properly for the tray (sets color, font etc.).
204 void SetupLabelForTray(views::Label* label); 210 void SetupLabelForTray(views::Label* label);
205 211
206 } // namespace internal 212 } // namespace internal
207 } // namespace ash 213 } // namespace ash
208 214
209 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ 215 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_
OLDNEW
« no previous file with comments | « no previous file | ash/system/tray/tray_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698