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

Side by Side Diff: chrome/browser/chromeos/status/status_area_view.h

Issue 9570013: Activate the status area only when it's focused using the keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new FocusCycler tests Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/activation_controller.cc ('k') | chrome/browser/chromeos/status/status_area_view.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 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 <list> 9 #include <list>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "chrome/browser/chromeos/status/status_area_button.h" 13 #include "chrome/browser/chromeos/status/status_area_button.h"
14 #include "ui/views/accessible_pane_view.h" 14 #include "ui/views/accessible_pane_view.h"
15 #include "ui/views/view.h" 15 #include "ui/views/view.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 #include "ui/views/widget/widget_delegate.h"
17 18
18 // This class is used to wrap the small informative widgets in the upper-right 19 // This class is used to wrap the small informative widgets in the upper-right
19 // of the window title bar. It is used on ChromeOS only. 20 // of the window title bar. It is used on ChromeOS only.
20 class StatusAreaView : public views::AccessiblePaneView, 21 class StatusAreaView : public views::AccessiblePaneView,
21 public views::Widget::Observer, 22 public views::Widget::Observer,
22 public base::SupportsWeakPtr<StatusAreaView> { 23 public base::SupportsWeakPtr<StatusAreaView>,
24 public views::WidgetDelegate {
23 public: 25 public:
24 enum ButtonBorder { 26 enum ButtonBorder {
25 NO_BORDER, 27 NO_BORDER,
26 HAS_BORDER 28 HAS_BORDER
27 }; 29 };
28 30
29 explicit StatusAreaView(); 31 StatusAreaView();
30 virtual ~StatusAreaView(); 32 virtual ~StatusAreaView();
31 33
32 void AddButton(StatusAreaButton* button, ButtonBorder border); 34 void AddButton(StatusAreaButton* button, ButtonBorder border);
33 void RemoveButton(StatusAreaButton* button); 35 void RemoveButton(StatusAreaButton* button);
34 36
35 void MakeButtonsActive(bool active); 37 void MakeButtonsActive(bool active);
36 void UpdateButtonVisibility(); 38 void UpdateButtonVisibility();
37 39
38 // Refresh the style used to paint all buttons' text. Schedules repaint. 40 // Refresh the style used to paint all buttons' text. Schedules repaint.
39 void UpdateButtonTextStyle(); 41 void UpdateButtonTextStyle();
40 42
41 // Takes focus and transfers it to the first (last if |reverse| is true). 43 // Takes focus and transfers it to the first (last if |reverse| is true).
42 // After focus has traversed through all elements, clears focus and calls 44 // After focus has traversed through all elements, clears focus and calls
43 // |return_focus_cb(reverse)| from the message loop. 45 // |return_focus_cb(reverse)| from the message loop.
44 typedef base::Callback<void(bool)> ReturnFocusCallback; 46 typedef base::Callback<void(bool)> ReturnFocusCallback;
45 void TakeFocus(bool reverse, 47 void TakeFocus(bool reverse,
46 const ReturnFocusCallback& return_focus_cb); 48 const ReturnFocusCallback& return_focus_cb);
47 49
48 // views::View* overrides. 50 // views::View* overrides.
49 virtual gfx::Size GetPreferredSize() OVERRIDE; 51 virtual gfx::Size GetPreferredSize() OVERRIDE;
50 virtual void Layout() OVERRIDE; 52 virtual void Layout() OVERRIDE;
51 virtual void PreferredSizeChanged() OVERRIDE; 53 virtual void PreferredSizeChanged() OVERRIDE;
52 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; 54 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
53 55
56 // views::WidgetDelegate overrides:
57 virtual bool CanActivate() const OVERRIDE;
58 virtual views::Widget* GetWidget() OVERRIDE;
59 virtual const views::Widget* GetWidget() const OVERRIDE;
60
54 private: 61 private:
55 // Overridden from views::FocusChangeListener: 62 // Overridden from views::FocusChangeListener:
56 virtual void OnDidChangeFocus(views::View* focused_before, 63 virtual void OnDidChangeFocus(views::View* focused_before,
57 views::View* focused_now) OVERRIDE; 64 views::View* focused_now) OVERRIDE;
58 65
59 // Overriden from views::Widget::Observer: 66 // Overriden from views::Widget::Observer:
60 virtual void OnWidgetActivationChanged(views::Widget* widget, 67 virtual void OnWidgetActivationChanged(views::Widget* widget,
61 bool active) OVERRIDE; 68 bool active) OVERRIDE;
62 69
63 // Overriden from views::AccessiblePaneView: 70 // Overriden from views::AccessiblePaneView:
(...skipping 13 matching lines...) Expand all
77 // Clears focus and calls |return_focus_cb_|. 84 // Clears focus and calls |return_focus_cb_|.
78 void ReturnFocus(bool reverse); 85 void ReturnFocus(bool reverse);
79 86
80 // Clears focus (called when widget is deactivated). 87 // Clears focus (called when widget is deactivated).
81 void ClearFocus(); 88 void ClearFocus();
82 89
83 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); 90 DISALLOW_COPY_AND_ASSIGN(StatusAreaView);
84 }; 91 };
85 92
86 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_ 93 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_
OLDNEW
« no previous file with comments | « ash/wm/activation_controller.cc ('k') | chrome/browser/chromeos/status/status_area_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698