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

Side by Side Diff: mash/shelf/shelf_button_host.h

Issue 1585363002: Fork a subset of ash/shelf for use in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ui/resources dep; comment out unused constants. Created 4 years, 10 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
« no previous file with comments | « mash/shelf/shelf_button.cc ('k') | mash/shelf/shelf_constants.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SHELF_SHELF_BUTTON_HOST_H_ 5 #ifndef MASH_SHELF_SHELF_BUTTON_HOST_H_
6 #define ASH_SHELF_SHELF_BUTTON_HOST_H_ 6 #define MASH_SHELF_SHELF_BUTTON_HOST_H_
7 7
8 #include "ash/ash_export.h" 8 #include "base/logging.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "mash/shelf/shelf_types.h"
10 11
11 namespace ui { 12 namespace ui {
12 class LocatedEvent; 13 class LocatedEvent;
13 } 14 }
14 15
15 namespace views { 16 namespace views {
16 class View; 17 class View;
17 } 18 }
18 19
19 namespace ash { 20 namespace mash {
21 namespace shelf {
20 22
23 // TODO(msw): Eliminate this abstraction and just pass pointers to ShelfView?
21 // The shelf buttons communicate back to the host by way of this interface. 24 // The shelf buttons communicate back to the host by way of this interface.
22 // This interface is used to enable reordering the items on the shelf. 25 // This interface is used to enable reordering the items on the shelf.
23 class ASH_EXPORT ShelfButtonHost { 26 class ShelfButtonHost {
24 public: 27 public:
25 enum Pointer { 28 enum Pointer {
26 NONE, 29 NONE,
27 DRAG_AND_DROP, 30 DRAG_AND_DROP,
28 MOUSE, 31 MOUSE,
29 TOUCH, 32 TOUCH,
30 }; 33 };
31 34
35 virtual ShelfAlignment GetAlignment() const = 0;
36
37 virtual bool IsHorizontalAlignment() const = 0;
38
39 // Helper function for choosing values specific to the shelf alignment.
40 template<typename T>
41 T PrimaryAxisValue(T horizontal, T vertical) const {
42 return IsHorizontalAlignment() ? horizontal : vertical;
43 }
44
45 // Helper function for choosing values specific to the shelf alignment.
46 template<typename T>
47 T SelectValueForShelfAlignment(T bottom, T left, T right, T top) const {
48 switch (GetAlignment()) {
49 case SHELF_ALIGNMENT_BOTTOM: return bottom;
50 case SHELF_ALIGNMENT_LEFT: return left;
51 case SHELF_ALIGNMENT_RIGHT: return right;
52 case SHELF_ALIGNMENT_TOP: return top;
53 }
54 NOTREACHED();
55 return bottom;
56 }
57
32 // Invoked when a pointer device is pressed on a view. 58 // Invoked when a pointer device is pressed on a view.
33 virtual void PointerPressedOnButton(views::View* view, 59 virtual void PointerPressedOnButton(views::View* view,
34 Pointer pointer, 60 Pointer pointer,
35 const ui::LocatedEvent& event) = 0; 61 const ui::LocatedEvent& event) = 0;
36 62
37 // Invoked when a pointer device is dragged over a view. 63 // Invoked when a pointer device is dragged over a view.
38 virtual void PointerDraggedOnButton(views::View* view, 64 virtual void PointerDraggedOnButton(views::View* view,
39 Pointer pointer, 65 Pointer pointer,
40 const ui::LocatedEvent& event) = 0; 66 const ui::LocatedEvent& event) = 0;
41 67
(...skipping 11 matching lines...) Expand all
53 // Invoked when the mouse exits the item. 79 // Invoked when the mouse exits the item.
54 virtual void MouseExitedButton(views::View* view) = 0; 80 virtual void MouseExitedButton(views::View* view) = 0;
55 81
56 // Invoked to get the accessible name of the item. 82 // Invoked to get the accessible name of the item.
57 virtual base::string16 GetAccessibleName(const views::View* view) = 0; 83 virtual base::string16 GetAccessibleName(const views::View* view) = 0;
58 84
59 protected: 85 protected:
60 virtual ~ShelfButtonHost() {} 86 virtual ~ShelfButtonHost() {}
61 }; 87 };
62 88
63 } // namespace ash 89 } // namespace shelf
90 } // namespace mash
64 91
65 #endif // ASH_SHELF_SHELF_BUTTON_HOST_H_ 92 #endif // MASH_SHELF_SHELF_BUTTON_HOST_H_
OLDNEW
« no previous file with comments | « mash/shelf/shelf_button.cc ('k') | mash/shelf/shelf_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698