OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/task.h" | |
12 #include "chrome/browser/ui/views/accessible_pane_view.h" | 11 #include "chrome/browser/ui/views/accessible_pane_view.h" |
13 #include "views/view.h" | 12 #include "views/view.h" |
14 | 13 |
15 namespace chromeos { | 14 namespace chromeos { |
16 | 15 |
17 class AccessibilityMenuButton; | 16 class AccessibilityMenuButton; |
18 class CapsLockMenuButton; | 17 class CapsLockMenuButton; |
19 class ClockMenuButton; | 18 class ClockMenuButton; |
20 class InputMethodMenuButton; | 19 class InputMethodMenuButton; |
21 class MemoryMenuButton; | 20 class MemoryMenuButton; |
22 class NetworkMenuButton; | 21 class NetworkMenuButton; |
23 class PowerMenuButton; | 22 class PowerMenuButton; |
24 class StatusAreaHost; | 23 class StatusAreaHost; |
25 | 24 |
26 // This class is used to wrap the small informative widgets in the upper-right | 25 // This class is used to wrap the small informative widgets in the upper-right |
27 // of the window title bar. It is used on ChromeOS only. | 26 // of the window title bar. It is used on ChromeOS only. |
28 class StatusAreaView : public AccessiblePaneView { | 27 class StatusAreaView : public AccessiblePaneView, |
28 public base::SupportsWeakPtr<StatusAreaView> { | |
satorux1
2011/10/25 01:08:16
Just FYI. You can use WeakPtrFactory instead, but
achuithb
2011/10/25 08:49:09
If you look at my first patch, I used WeakPtrFacto
satorux1
2011/10/25 16:17:29
Please go ahead. :)
| |
29 public: | 29 public: |
30 explicit StatusAreaView(StatusAreaHost* host); | 30 explicit StatusAreaView(StatusAreaHost* host); |
31 virtual ~StatusAreaView(); | 31 virtual ~StatusAreaView(); |
32 | 32 |
33 virtual void Init(); | 33 virtual void Init(); |
34 void MakeButtonsActive(bool active); | 34 void MakeButtonsActive(bool active); |
35 void ButtonVisibilityChanged(views::View* button_view); | 35 void ButtonVisibilityChanged(views::View* button_view); |
36 | 36 |
37 // Takes focus and transfers it to the first (last if |reverse| is true). | 37 // Takes focus and transfers it to the first (last if |reverse| is true). |
38 // After focus has traversed through all elements, clears focus and calls | 38 // After focus has traversed through all elements, clears focus and calls |
39 // |return_focus_cb(reverse)| from the message loop. | 39 // |return_focus_cb(reverse)| from the message loop. |
40 typedef base::Callback<void(bool)> ReturnFocusCallback; | |
40 void TakeFocus(bool reverse, | 41 void TakeFocus(bool reverse, |
41 const base::Callback<void(bool)>& return_focus_cb); | 42 const ReturnFocusCallback& return_focus_cb); |
42 | 43 |
43 // Overridden from views::FocusChangeListener: | 44 // Overridden from views::FocusChangeListener: |
44 virtual void FocusWillChange(views::View* focused_before, | 45 virtual void FocusWillChange(views::View* focused_before, |
45 views::View* focused_now) OVERRIDE; | 46 views::View* focused_now) OVERRIDE; |
46 | 47 |
47 // views::View* overrides. | 48 // views::View* overrides. |
48 virtual gfx::Size GetPreferredSize(); | 49 virtual gfx::Size GetPreferredSize(); |
49 virtual void Layout(); | 50 virtual void Layout(); |
50 virtual void ChildPreferredSizeChanged(View* child); | 51 virtual void ChildPreferredSizeChanged(View* child); |
51 | 52 |
(...skipping 10 matching lines...) Expand all Loading... | |
62 AccessibilityMenuButton* accessibility_view_; | 63 AccessibilityMenuButton* accessibility_view_; |
63 CapsLockMenuButton* caps_lock_view_; | 64 CapsLockMenuButton* caps_lock_view_; |
64 ClockMenuButton* clock_view_; | 65 ClockMenuButton* clock_view_; |
65 InputMethodMenuButton* input_method_view_; | 66 InputMethodMenuButton* input_method_view_; |
66 MemoryMenuButton* memory_view_; | 67 MemoryMenuButton* memory_view_; |
67 NetworkMenuButton* network_view_; | 68 NetworkMenuButton* network_view_; |
68 PowerMenuButton* power_view_; | 69 PowerMenuButton* power_view_; |
69 | 70 |
70 // True if focus needs to be returned via |return_focus_cb_| when it wraps. | 71 // True if focus needs to be returned via |return_focus_cb_| when it wraps. |
71 bool need_return_focus_; | 72 bool need_return_focus_; |
72 base::Callback<void(bool)> return_focus_cb_; | 73 ReturnFocusCallback return_focus_cb_; |
73 ScopedRunnableMethodFactory<StatusAreaView> task_factory_; | |
74 | 74 |
75 // Clears focus and calls |return_focus_cb_|. | 75 // Clears focus and calls |return_focus_cb_|. |
76 void ReturnFocus(bool reverse); | 76 void ReturnFocus(bool reverse); |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); | 78 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace chromeos | 81 } // namespace chromeos |
82 | 82 |
83 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ | 83 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ |
OLD | NEW |