Chromium Code Reviews| 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_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_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" |
| 11 #include "ash/shelf/shelf_background_animator_observer.h" | 11 #include "ash/shelf/shelf_background_animator_observer.h" |
| 12 #include "ash/system/tray/actionable_view.h" | 12 #include "ash/system/tray/actionable_view.h" |
| 13 #include "ash/system/tray_drag_controller.h" | |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "ui/compositor/layer_animation_observer.h" | 15 #include "ui/compositor/layer_animation_observer.h" |
| 15 #include "ui/gfx/geometry/insets.h" | 16 #include "ui/gfx/geometry/insets.h" |
| 16 #include "ui/views/bubble/tray_bubble_view.h" | 17 #include "ui/views/bubble/tray_bubble_view.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 class Shelf; | 20 class Shelf; |
| 20 class TrayBackground; | 21 class TrayBackground; |
| 21 class TrayContainer; | 22 class TrayContainer; |
| 22 class TrayEventFilter; | 23 class TrayEventFilter; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 46 void ChildPreferredSizeChanged(views::View* child) override; | 47 void ChildPreferredSizeChanged(views::View* child) override; |
| 47 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 48 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 48 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 49 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
| 49 | 50 |
| 50 // ActionableView: | 51 // ActionableView: |
| 51 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 52 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 52 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 53 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 53 const override; | 54 const override; |
| 54 void PaintButtonContents(gfx::Canvas* canvas) override; | 55 void PaintButtonContents(gfx::Canvas* canvas) override; |
| 55 | 56 |
| 57 // Dragging releated functions: | |
|
msw
2017/07/12 05:04:52
Add an explanatory comment for each function, noth
minch1
2017/07/13 19:10:36
Done.
| |
| 58 virtual bool HasBubble(); | |
|
msw
2017/07/12 05:04:52
This function seems unnecessary, as callers can in
minch1
2017/07/13 19:10:36
In SystemTray, HasBubble has a little bit differen
| |
| 59 virtual views::TrayBubbleView* GetBubbleView(); | |
| 60 virtual void CloseBubble() {} | |
| 61 virtual void ShowBubble() {} | |
| 62 | |
| 56 // Called whenever the shelf alignment changes. | 63 // Called whenever the shelf alignment changes. |
| 57 virtual void UpdateAfterShelfAlignmentChange(); | 64 virtual void UpdateAfterShelfAlignmentChange(); |
| 58 | 65 |
| 59 // Called when the anchor (tray or bubble) may have moved or changed. | 66 // Called when the anchor (tray or bubble) may have moved or changed. |
| 60 virtual void AnchorUpdated() {} | 67 virtual void AnchorUpdated() {} |
| 61 | 68 |
| 62 // Called from GetAccessibleNodeData, must return a valid accessible name. | 69 // Called from GetAccessibleNodeData, must return a valid accessible name. |
| 63 virtual base::string16 GetAccessibleNameForTray() = 0; | 70 virtual base::string16 GetAccessibleNameForTray() = 0; |
| 64 | 71 |
| 65 // Called when the bubble is resized. | 72 // Called when the bubble is resized. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 93 void set_separator_visibility(bool visible) { separator_visible_ = visible; } | 100 void set_separator_visibility(bool visible) { separator_visible_ = visible; } |
| 94 | 101 |
| 95 // Gets the anchor for bubbles, which is tray_container(). | 102 // Gets the anchor for bubbles, which is tray_container(). |
| 96 views::View* GetBubbleAnchor() const; | 103 views::View* GetBubbleAnchor() const; |
| 97 | 104 |
| 98 // Gets additional insets for positioning bubbles relative to | 105 // Gets additional insets for positioning bubbles relative to |
| 99 // tray_container(). | 106 // tray_container(). |
| 100 gfx::Insets GetBubbleAnchorInsets() const; | 107 gfx::Insets GetBubbleAnchorInsets() const; |
| 101 | 108 |
| 102 // Returns the container window for the bubble (on the proper display). | 109 // Returns the container window for the bubble (on the proper display). |
| 103 aura::Window* GetBubbleWindowContainer() const; | 110 aura::Window* GetBubbleWindowContainer(); |
| 111 | |
| 112 // Update the bounds of the tray bubbles. Close the bubble if | |
|
msw
2017/07/12 05:04:52
nit: "of the associated tray bubble.", update line
minch1
2017/07/13 19:10:36
Done.
| |
| 113 // |close_bubble| is set. | |
| 114 void AnimateToTargetBounds(const gfx::Rect& target_bounds, bool close_bubble); | |
| 104 | 115 |
| 105 protected: | 116 protected: |
| 106 // ActionableView: | 117 // ActionableView: |
| 107 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; | 118 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; |
| 108 bool ShouldEnterPushedState(const ui::Event& event) override; | 119 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 109 bool PerformAction(const ui::Event& event) override; | 120 bool PerformAction(const ui::Event& event) override; |
| 110 void HandlePerformActionResult(bool action_performed, | 121 void HandlePerformActionResult(bool action_performed, |
| 111 const ui::Event& event) override; | 122 const ui::Event& event) override; |
| 112 | 123 |
| 124 TrayDragController* drag_controller() { return drag_controller_.get(); } | |
| 125 | |
| 113 private: | 126 private: |
| 114 class TrayWidgetObserver; | 127 class TrayWidgetObserver; |
| 115 | 128 |
| 116 // ui::ImplicitAnimationObserver: | 129 // ui::ImplicitAnimationObserver: |
| 117 void OnImplicitAnimationsCompleted() override; | 130 void OnImplicitAnimationsCompleted() override; |
| 118 bool RequiresNotificationWhenAnimatorDestroyed() const override; | 131 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
| 119 | 132 |
| 120 // Applies transformations to the |layer()| to animate the view when | 133 // Applies transformations to the |layer()| to animate the view when |
| 121 // SetVisible(false) is called. | 134 // SetVisible(false) is called. |
| 122 void HideTransformation(); | 135 void HideTransformation(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 138 TrayBackground* background_; | 151 TrayBackground* background_; |
| 139 | 152 |
| 140 // Determines if the view is active. This changes how the ink drop ripples | 153 // Determines if the view is active. This changes how the ink drop ripples |
| 141 // behave. | 154 // behave. |
| 142 bool is_active_; | 155 bool is_active_; |
| 143 | 156 |
| 144 // Visibility of this tray's separator which is a line of 1x32px and 4px to | 157 // Visibility of this tray's separator which is a line of 1x32px and 4px to |
| 145 // right of tray. | 158 // right of tray. |
| 146 bool separator_visible_; | 159 bool separator_visible_; |
| 147 | 160 |
| 161 std::unique_ptr<TrayDragController> drag_controller_; | |
|
msw
2017/07/12 05:04:52
nit: add a comment.
minch1
2017/07/13 19:10:36
Done.
| |
| 162 | |
| 163 // Used in maximize mode to make sure the system tray bubble only be shown in | |
| 164 // work area. | |
| 165 std::unique_ptr<aura::Window> clipping_window_; | |
| 166 | |
| 148 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 167 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| 149 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 168 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
| 150 | 169 |
| 151 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 170 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 152 }; | 171 }; |
| 153 | 172 |
| 154 } // namespace ash | 173 } // namespace ash |
| 155 | 174 |
| 156 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 175 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |