| 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 ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | 5 #ifndef ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ |
| 6 #define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | 6 #define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "ash/wm/shelf_auto_hide_behavior.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 11 #include "ui/views/accessible_pane_view.h" | 12 #include "ui/views/accessible_pane_view.h" |
| 12 #include "ui/views/layout/box_layout.h" | |
| 13 #include "ui/views/widget/widget_delegate.h" | 13 #include "ui/views/widget/widget_delegate.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 class FocusCycler; | 18 class FocusCycler; |
| 19 | 19 |
| 20 class ASH_EXPORT StatusAreaWidgetDelegate : public views::WidgetDelegate, | 20 class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView, |
| 21 public views::AccessiblePaneView { | 21 public views::WidgetDelegate { |
| 22 public: | 22 public: |
| 23 StatusAreaWidgetDelegate(); | 23 StatusAreaWidgetDelegate(); |
| 24 virtual ~StatusAreaWidgetDelegate(); | 24 virtual ~StatusAreaWidgetDelegate(); |
| 25 | 25 |
| 26 // Add a tray view to the widget (e.g. system tray, web notifications). |
| 27 void AddTray(views::View* tray); |
| 28 |
| 29 // Called whenever layout might change (e.g. alignment changed). |
| 30 void UpdateLayout(); |
| 31 |
| 26 // Sets the focus cycler. | 32 // Sets the focus cycler. |
| 27 void SetFocusCyclerForTesting(const FocusCycler* focus_cycler); | 33 void SetFocusCyclerForTesting(const FocusCycler* focus_cycler); |
| 28 | 34 |
| 35 void set_alignment(ShelfAlignment alignment) { alignment_ = alignment; } |
| 36 |
| 29 // Overridden from views::AccessiblePaneView. | 37 // Overridden from views::AccessiblePaneView. |
| 30 virtual View* GetDefaultFocusableChild() OVERRIDE; | 38 virtual View* GetDefaultFocusableChild() OVERRIDE; |
| 31 | 39 |
| 32 // Overridden from views::View: | 40 // Overridden from views::View: |
| 33 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 41 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 34 virtual views::Widget* GetWidget() OVERRIDE; | 42 virtual views::Widget* GetWidget() OVERRIDE; |
| 35 virtual const views::Widget* GetWidget() const OVERRIDE; | 43 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 36 | 44 |
| 37 // views::WidgetDelegate overrides: | 45 // views::WidgetDelegate overrides: |
| 38 virtual bool CanActivate() const OVERRIDE; | 46 virtual bool CanActivate() const OVERRIDE; |
| 39 virtual void DeleteDelegate() OVERRIDE; | 47 virtual void DeleteDelegate() OVERRIDE; |
| 40 | 48 |
| 41 void SetLayout(views::BoxLayout::Orientation orientation); | 49 protected: |
| 50 // Overridden from views::View: |
| 51 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 42 | 52 |
| 43 private: | 53 private: |
| 44 const FocusCycler* focus_cycler_for_testing_; | 54 const FocusCycler* focus_cycler_for_testing_; |
| 55 ShelfAlignment alignment_; |
| 45 | 56 |
| 46 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate); | 57 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate); |
| 47 }; | 58 }; |
| 48 | 59 |
| 49 } // namespace internal | 60 } // namespace internal |
| 50 } // namespace ash | 61 } // namespace ash |
| 51 | 62 |
| 52 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | 63 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ |
| OLD | NEW |