| 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_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 private: | 53 private: |
| 54 void UpdateLayout(); | 54 void UpdateLayout(); |
| 55 | 55 |
| 56 ShelfAlignment alignment_; | 56 ShelfAlignment alignment_; |
| 57 int main_axis_margin_ = 0; | 57 int main_axis_margin_ = 0; |
| 58 int cross_axis_margin_ = 0; | 58 int cross_axis_margin_ = 0; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(TrayContainer); | 60 DISALLOW_COPY_AND_ASSIGN(TrayContainer); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 explicit TrayBackgroundView(WmShelf* wm_shelf); | 63 // TODO(mohsen): Remove |draws_background| paramter when LogoutButtonTray, as |
| 64 // the only reason for existence of this parameter, is no longer a |
| 65 // TrayBackgroundView. See https://crbug.com/698134. |
| 66 TrayBackgroundView(WmShelf* wm_shelf, bool draws_background); |
| 64 ~TrayBackgroundView() override; | 67 ~TrayBackgroundView() override; |
| 65 | 68 |
| 66 // Called after the tray has been added to the widget containing it. | 69 // Called after the tray has been added to the widget containing it. |
| 67 virtual void Initialize(); | 70 virtual void Initialize(); |
| 68 | 71 |
| 69 // Initializes animations for the bubble. | 72 // Initializes animations for the bubble. |
| 70 static void InitializeBubbleAnimations(views::Widget* bubble_widget); | 73 static void InitializeBubbleAnimations(views::Widget* bubble_widget); |
| 71 | 74 |
| 72 // views::View: | 75 // views::View: |
| 73 void SetVisible(bool visible) override; | 76 void SetVisible(bool visible) override; |
| 74 const char* GetClassName() const override; | 77 const char* GetClassName() const override; |
| 75 void ChildPreferredSizeChanged(views::View* child) override; | 78 void ChildPreferredSizeChanged(views::View* child) override; |
| 76 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 79 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 77 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 80 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
| 78 void OnPaint(gfx::Canvas* canvas) override; | 81 void OnPaint(gfx::Canvas* canvas) override; |
| 79 | 82 |
| 80 // ActionableView: | 83 // ActionableView: |
| 81 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 84 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 82 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 85 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 83 const override; | 86 const override; |
| 84 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 85 | 87 |
| 86 // Called whenever the shelf alignment changes. | 88 // Called whenever the shelf alignment changes. |
| 87 virtual void SetShelfAlignment(ShelfAlignment alignment); | 89 virtual void SetShelfAlignment(ShelfAlignment alignment); |
| 88 | 90 |
| 89 // Called when the anchor (tray or bubble) may have moved or changed. | 91 // Called when the anchor (tray or bubble) may have moved or changed. |
| 90 virtual void AnchorUpdated() {} | 92 virtual void AnchorUpdated() {} |
| 91 | 93 |
| 92 // Called from GetAccessibleNodeData, must return a valid accessible name. | 94 // Called from GetAccessibleNodeData, must return a valid accessible name. |
| 93 virtual base::string16 GetAccessibleNameForTray() = 0; | 95 virtual base::string16 GetAccessibleNameForTray() = 0; |
| 94 | 96 |
| 95 // Called when the bubble is resized. | 97 // Called when the bubble is resized. |
| 96 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} | 98 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} |
| 97 | 99 |
| 98 // Hides the bubble associated with |bubble_view|. Called when the widget | 100 // Hides the bubble associated with |bubble_view|. Called when the widget |
| 99 // is closed. | 101 // is closed. |
| 100 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; | 102 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; |
| 101 | 103 |
| 102 // Called by the bubble wrapper when a click event occurs outside the bubble. | 104 // Called by the bubble wrapper when a click event occurs outside the bubble. |
| 103 // May close the bubble. | 105 // May close the bubble. |
| 104 virtual void ClickedOutsideBubble() = 0; | 106 virtual void ClickedOutsideBubble() = 0; |
| 105 | 107 |
| 106 // Sets |contents| as a child. | |
| 107 void SetContents(views::View* contents); | |
| 108 | |
| 109 // Creates and sets contents background to |background_|. |draws_active| | |
| 110 // determines if the view's background should be drawn as active when the view | |
| 111 // is in the active state. | |
| 112 void SetContentsBackground(bool draws_active); | |
| 113 | |
| 114 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 108 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
| 115 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 109 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
| 116 | 110 |
| 117 void SetIsActive(bool is_active); | 111 void SetIsActive(bool is_active); |
| 118 bool is_active() const { return is_active_; } | 112 bool is_active() const { return is_active_; } |
| 119 | 113 |
| 120 TrayContainer* tray_container() const { return tray_container_; } | 114 TrayContainer* tray_container() const { return tray_container_; } |
| 121 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 115 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
| 122 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 116 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
| 123 WmShelf* shelf() { return wm_shelf_; } | 117 WmShelf* shelf() { return wm_shelf_; } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Convenience pointer to the contents view. | 165 // Convenience pointer to the contents view. |
| 172 TrayContainer* tray_container_; | 166 TrayContainer* tray_container_; |
| 173 | 167 |
| 174 // Shelf alignment. | 168 // Shelf alignment. |
| 175 // TODO(jamescook): Don't cache this, get it from WmShelf. | 169 // TODO(jamescook): Don't cache this, get it from WmShelf. |
| 176 ShelfAlignment shelf_alignment_; | 170 ShelfAlignment shelf_alignment_; |
| 177 | 171 |
| 178 // Owned by the view passed to SetContents(). | 172 // Owned by the view passed to SetContents(). |
| 179 TrayBackground* background_; | 173 TrayBackground* background_; |
| 180 | 174 |
| 181 // Determines if the view is active. This changes how the background is drawn | 175 // Determines if the view is active. This changes how the ink drop ripples |
| 182 // in non-MD version and how the ink drop ripples behave in MD version. | 176 // behave. |
| 183 bool is_active_; | 177 bool is_active_; |
| 184 | 178 |
| 185 // Visibility of this tray's separator which is a line of 1x32px and 4px to | 179 // Visibility of this tray's separator which is a line of 1x32px and 4px to |
| 186 // right of tray. | 180 // right of tray. |
| 187 bool separator_visible_; | 181 bool separator_visible_; |
| 188 | 182 |
| 189 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 183 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| 190 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 184 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
| 191 | 185 |
| 192 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 186 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 193 }; | 187 }; |
| 194 | 188 |
| 195 } // namespace ash | 189 } // namespace ash |
| 196 | 190 |
| 197 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 191 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |