• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_
6 #define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_
7 
8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_types.h"
10 #include "ash/wm/gestures/shelf_gesture_handler.h"
11 #include "ui/gfx/image/image_skia.h"
12 #include "ui/views/accessible_pane_view.h"
13 #include "ui/views/widget/widget_delegate.h"
14 
15 namespace ash {
16 class FocusCycler;
17 
18 class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView,
19                                             public views::WidgetDelegate {
20  public:
21   StatusAreaWidgetDelegate();
22   virtual ~StatusAreaWidgetDelegate();
23 
24   // Add a tray view to the widget (e.g. system tray, web notifications).
25   void AddTray(views::View* tray);
26 
27   // Called whenever layout might change (e.g. alignment changed).
28   void UpdateLayout();
29 
30   // Sets the focus cycler.
31   void SetFocusCyclerForTesting(const FocusCycler* focus_cycler);
32 
set_alignment(ShelfAlignment alignment)33   void set_alignment(ShelfAlignment alignment) { alignment_ = alignment; }
34 
35   // Overridden from views::AccessiblePaneView.
36   virtual View* GetDefaultFocusableChild() OVERRIDE;
37 
38   // Overridden from views::View:
39   virtual views::Widget* GetWidget() OVERRIDE;
40   virtual const views::Widget* GetWidget() const OVERRIDE;
41 
42   // Overridden from ui::EventHandler:
43   virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
44 
45   // views::WidgetDelegate overrides:
46   virtual bool CanActivate() const OVERRIDE;
47   virtual void DeleteDelegate() OVERRIDE;
48 
49  protected:
50   // Overridden from views::View:
51   virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
52   virtual void ChildVisibilityChanged(views::View* child) OVERRIDE;
53 
54  private:
55   void UpdateWidgetSize();
56 
57   const FocusCycler* focus_cycler_for_testing_;
58   ShelfAlignment alignment_;
59 
60   ShelfGestureHandler gesture_handler_;
61 
62   DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate);
63 };
64 
65 }  // namespace ash
66 
67 #endif  // ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_
68