| 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 UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 5 #ifndef UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
| 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 8 #include "ui/views/bubble/bubble_delegate.h" | 9 #include "ui/views/bubble/bubble_delegate.h" |
| 9 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
| 10 | 11 |
| 11 // Specialized bubble view for bubbles associated with a tray icon (e.g. the | 12 // Specialized bubble view for bubbles associated with a tray icon (e.g. the |
| 12 // Ash status area). Mostly this handles custom anchor location and arrow and | 13 // Ash status area). Mostly this handles custom anchor location and arrow and |
| 13 // border rendering. This also has its own delegate for handling mouse events | 14 // border rendering. This also has its own delegate for handling mouse events |
| 14 // and other implementation specific details. | 15 // and other implementation specific details. |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 class LocatedEvent; | 18 class LocatedEvent; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| 21 class View; | 22 class View; |
| 22 class Widget; | 23 class Widget; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace views { | 26 namespace views { |
| 26 | 27 |
| 27 namespace internal { | 28 namespace internal { |
| 28 class TrayBubbleBorder; | 29 class TrayBubbleBorder; |
| 30 #if defined(OS_WIN) && !defined(USE_AURA) |
| 29 class TrayBubbleBackground; | 31 class TrayBubbleBackground; |
| 32 #else |
| 33 class TrayBubbleContentMask; |
| 34 #endif |
| 30 } | 35 } |
| 31 | 36 |
| 32 class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView { | 37 class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView { |
| 33 public: | 38 public: |
| 34 enum AnchorType { | 39 enum AnchorType { |
| 35 ANCHOR_TYPE_TRAY, | 40 ANCHOR_TYPE_TRAY, |
| 36 ANCHOR_TYPE_BUBBLE | 41 ANCHOR_TYPE_BUBBLE |
| 37 }; | 42 }; |
| 38 | 43 |
| 39 enum AnchorAlignment { | 44 enum AnchorAlignment { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 86 |
| 82 InitParams(AnchorType anchor_type, | 87 InitParams(AnchorType anchor_type, |
| 83 AnchorAlignment anchor_alignment, | 88 AnchorAlignment anchor_alignment, |
| 84 int bubble_width); | 89 int bubble_width); |
| 85 AnchorType anchor_type; | 90 AnchorType anchor_type; |
| 86 AnchorAlignment anchor_alignment; | 91 AnchorAlignment anchor_alignment; |
| 87 int bubble_width; | 92 int bubble_width; |
| 88 int max_height; | 93 int max_height; |
| 89 bool can_activate; | 94 bool can_activate; |
| 90 bool close_on_deactivate; | 95 bool close_on_deactivate; |
| 96 #if defined(OS_WIN) && !defined(USE_AURA) |
| 91 SkColor top_color; | 97 SkColor top_color; |
| 98 #endif |
| 92 SkColor arrow_color; | 99 SkColor arrow_color; |
| 93 views::BubbleBorder::ArrowLocation arrow_location; | 100 views::BubbleBorder::ArrowLocation arrow_location; |
| 94 int arrow_offset; | 101 int arrow_offset; |
| 95 views::BubbleBorder::Shadow shadow; | 102 views::BubbleBorder::Shadow shadow; |
| 96 }; | 103 }; |
| 97 | 104 |
| 98 // Constructs and returns a TrayBubbleView. init_params may be modified. | 105 // Constructs and returns a TrayBubbleView. init_params may be modified. |
| 99 static TrayBubbleView* Create(gfx::NativeView parent_window, | 106 static TrayBubbleView* Create(gfx::NativeView parent_window, |
| 100 views::View* anchor, | 107 views::View* anchor, |
| 101 Delegate* delegate, | 108 Delegate* delegate, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Overridden from views::View. | 162 // Overridden from views::View. |
| 156 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 163 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 157 virtual void ViewHierarchyChanged(bool is_add, | 164 virtual void ViewHierarchyChanged(bool is_add, |
| 158 views::View* parent, | 165 views::View* parent, |
| 159 views::View* child) OVERRIDE; | 166 views::View* child) OVERRIDE; |
| 160 | 167 |
| 161 private: | 168 private: |
| 162 InitParams params_; | 169 InitParams params_; |
| 163 Delegate* delegate_; | 170 Delegate* delegate_; |
| 164 internal::TrayBubbleBorder* bubble_border_; | 171 internal::TrayBubbleBorder* bubble_border_; |
| 172 #if defined(OS_WIN) && !defined(USE_AURA) |
| 165 internal::TrayBubbleBackground* bubble_background_; | 173 internal::TrayBubbleBackground* bubble_background_; |
| 174 #else |
| 175 scoped_ptr<internal::TrayBubbleContentMask> bubble_content_mask_; |
| 176 #endif |
| 166 bool is_gesture_dragging_; | 177 bool is_gesture_dragging_; |
| 167 | 178 |
| 168 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); | 179 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
| 169 }; | 180 }; |
| 170 | 181 |
| 171 } // namespace views | 182 } // namespace views |
| 172 | 183 |
| 173 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 184 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
| OLD | NEW |