OLD | NEW |
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 UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 class Observer { | 33 class Observer { |
34 public: | 34 public: |
35 virtual void OnActivationChanged(views::Widget* widget, bool active) = 0; | 35 virtual void OnActivationChanged(views::Widget* widget, bool active) = 0; |
36 }; | 36 }; |
37 | 37 |
38 // Takes ownership of |delegate|. | 38 // Takes ownership of |delegate|. |
39 explicit AppListView(AppListViewDelegate* delegate); | 39 explicit AppListView(AppListViewDelegate* delegate); |
40 virtual ~AppListView(); | 40 virtual ~AppListView(); |
41 | 41 |
42 // Initializes the widget. | 42 // Initializes the widget and use a given |anchor| plus an |anchor_offset| for |
43 void InitAsBubble(gfx::NativeView parent, | 43 // positioning. |
44 PaginationModel* pagination_model, | 44 void InitAsBubbleAttachedToAnchor(gfx::NativeView parent, |
45 views::View* anchor, | 45 PaginationModel* pagination_model, |
46 const gfx::Point& anchor_point, | 46 views::View* anchor, |
47 views::BubbleBorder::Arrow arrow, | 47 const gfx::Vector2d& anchor_offset, |
48 bool border_accepts_events); | 48 views::BubbleBorder::Arrow arrow, |
| 49 bool border_accepts_events); |
| 50 |
| 51 // Initializes the widget and use a fixed |anchor_point_in_screen| for |
| 52 // positioning. |
| 53 void InitAsBubbleAtFixedLocation(gfx::NativeView parent, |
| 54 PaginationModel* pagination_model, |
| 55 const gfx::Point& anchor_point_in_screen, |
| 56 views::BubbleBorder::Arrow arrow, |
| 57 bool border_accepts_events); |
49 | 58 |
50 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); | 59 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); |
51 | 60 |
52 void SetAnchorPoint(const gfx::Point& anchor_point); | 61 void SetAnchorPoint(const gfx::Point& anchor_point); |
53 | 62 |
54 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop | 63 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop |
55 // operations outside the application list. This has to be called after | 64 // operations outside the application list. This has to be called after |
56 // InitAsBubble was called since the app list object needs to exist so that | 65 // InitAsBubble was called since the app list object needs to exist so that |
57 // it can set the host. | 66 // it can set the host. |
58 void SetDragAndDropHostOfCurrentAppList( | 67 void SetDragAndDropHostOfCurrentAppList( |
(...skipping 23 matching lines...) Expand all Loading... |
82 void RemoveObserver(Observer* observer); | 91 void RemoveObserver(Observer* observer); |
83 | 92 |
84 // Set a callback to be called the next time any app list paints. | 93 // Set a callback to be called the next time any app list paints. |
85 static void SetNextPaintCallback(const base::Closure& callback); | 94 static void SetNextPaintCallback(const base::Closure& callback); |
86 | 95 |
87 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
88 HWND GetHWND() const; | 97 HWND GetHWND() const; |
89 #endif | 98 #endif |
90 | 99 |
91 private: | 100 private: |
| 101 void InitAsBubbleInternal(gfx::NativeView parent, |
| 102 PaginationModel* pagination_model, |
| 103 views::BubbleBorder::Arrow arrow, |
| 104 bool border_accepts_events, |
| 105 const gfx::Vector2d& anchor_offset); |
| 106 |
92 // Overridden from views::WidgetDelegateView: | 107 // Overridden from views::WidgetDelegateView: |
93 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 108 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
94 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; | 109 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; |
95 virtual bool WidgetHasHitTestMask() const OVERRIDE; | 110 virtual bool WidgetHasHitTestMask() const OVERRIDE; |
96 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; | 111 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; |
97 | 112 |
98 // Overridden from views::View: | 113 // Overridden from views::View: |
99 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 114 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
100 virtual void Layout() OVERRIDE; | 115 virtual void Layout() OVERRIDE; |
101 | 116 |
(...skipping 17 matching lines...) Expand all Loading... |
119 SigninView* signin_view_; | 134 SigninView* signin_view_; |
120 | 135 |
121 ObserverList<Observer> observers_; | 136 ObserverList<Observer> observers_; |
122 | 137 |
123 DISALLOW_COPY_AND_ASSIGN(AppListView); | 138 DISALLOW_COPY_AND_ASSIGN(AppListView); |
124 }; | 139 }; |
125 | 140 |
126 } // namespace app_list | 141 } // namespace app_list |
127 | 142 |
128 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 143 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
OLD | NEW |