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

Side by Side Diff: ash/common/system/user/button_from_view.h

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_COMMON_SYSTEM_USER_BUTTON_FROM_VIEW_H_
6 #define ASH_COMMON_SYSTEM_USER_BUTTON_FROM_VIEW_H_
7
8 #include <memory>
9
10 #include "ash/common/system/tray/tray_popup_ink_drop_style.h"
11 #include "base/macros.h"
12 #include "ui/views/controls/button/custom_button.h"
13
14 namespace views {
15 class InkDropContainerView;
16 } // namespace views
17
18 namespace ash {
19 namespace tray {
20
21 // This view is used to wrap it's content and transform it into button.
22 class ButtonFromView : public views::CustomButton {
23 public:
24 // The |content| is the content which is shown within the button. The
25 // |button_listener| will be informed - if provided - when a button was
26 // pressed.
27 ButtonFromView(views::View* content,
28 views::ButtonListener* listener,
29 TrayPopupInkDropStyle ink_drop_style);
30 ~ButtonFromView() override;
31
32 // views::View:
33 void OnMouseEntered(const ui::MouseEvent& event) override;
34 void OnMouseExited(const ui::MouseEvent& event) override;
35 void OnPaint(gfx::Canvas* canvas) override;
36 void OnFocus() override;
37 void OnBlur() override;
38 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
39 void Layout() override;
40
41 // Check if the item is hovered.
42 bool is_hovered_for_test() { return button_hovered_; }
43
44 protected:
45 // views::CustomButton:
46 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
47 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
48 std::unique_ptr<views::InkDrop> CreateInkDrop() override;
49 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
50 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
51 const override;
52 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override;
53
54 private:
55 // Content of button.
56 views::View* content_;
57
58 // Defines the flavor of ink drop ripple/highlight that should be constructed.
59 TrayPopupInkDropStyle ink_drop_style_;
60
61 // True if button is hovered.
62 bool button_hovered_;
63
64 // A separate view is necessary to hold the ink drop layer so that |this| can
65 // host labels with subpixel anti-aliasing enabled.
66 views::InkDropContainerView* ink_drop_container_;
67
68 std::unique_ptr<views::InkDropMask> ink_drop_mask_;
69
70 DISALLOW_COPY_AND_ASSIGN(ButtonFromView);
71 };
72
73 } // namespace tray
74 } // namespace ash
75
76 #endif // ASH_COMMON_SYSTEM_USER_BUTTON_FROM_VIEW_H_
OLDNEW
« no previous file with comments | « ash/common/system/update/tray_update_unittest.cc ('k') | ash/common/system/user/button_from_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698