Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Side by Side Diff: ui/views/bubble/bubble_delegate.h

Issue 10162017: Re-reland Propagate OnNativeWidgetMove to delegate/observers, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_BUBBLE_DELEGATE_H_ 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "ui/base/animation/animation_delegate.h" 10 #include "ui/base/animation/animation_delegate.h"
(...skipping 29 matching lines...) Expand all
40 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); 40 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate);
41 41
42 // WidgetDelegate overrides: 42 // WidgetDelegate overrides:
43 virtual View* GetInitiallyFocusedView() OVERRIDE; 43 virtual View* GetInitiallyFocusedView() OVERRIDE;
44 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; 44 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE;
45 virtual View* GetContentsView() OVERRIDE; 45 virtual View* GetContentsView() OVERRIDE;
46 virtual NonClientFrameView* CreateNonClientFrameView( 46 virtual NonClientFrameView* CreateNonClientFrameView(
47 views::Widget* widget) OVERRIDE; 47 views::Widget* widget) OVERRIDE;
48 48
49 // Widget::Observer overrides: 49 // Widget::Observer overrides:
50 virtual void OnWidgetClosing(Widget* widget) OVERRIDE;
50 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; 51 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE;
51 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; 52 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE;
53 virtual void OnWidgetMoved(Widget* widget) OVERRIDE;
52 54
53 bool close_on_esc() const { return close_on_esc_; } 55 bool close_on_esc() const { return close_on_esc_; }
54 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } 56 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
55 57
56 bool close_on_deactivate() const { return close_on_deactivate_; } 58 bool close_on_deactivate() const { return close_on_deactivate_; }
57 void set_close_on_deactivate(bool close_on_deactivate) { 59 void set_close_on_deactivate(bool close_on_deactivate) {
58 close_on_deactivate_ = close_on_deactivate; 60 close_on_deactivate_ = close_on_deactivate;
59 } 61 }
60 62
61 View* anchor_view() const { return anchor_view_; } 63 View* anchor_view() const { return anchor_view_; }
62 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } 64 Widget* anchor_widget() const { return anchor_widget_; }
63 65
64 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; } 66 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; }
65 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) { 67 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) {
66 arrow_location_ = arrow_location; 68 arrow_location_ = arrow_location;
67 } 69 }
68 70
69 SkColor color() const { return color_; } 71 SkColor color() const { return color_; }
70 void set_color(SkColor color) { color_ = color; } 72 void set_color(SkColor color) { color_ = color; }
71 73
72 int margin() const { return margin_; } 74 int margin() const { return margin_; }
73 void set_margin(int margin) { margin_ = margin; } 75 void set_margin(int margin) { margin_ = margin; }
74 76
75 gfx::NativeView parent_window() const { return parent_window_; } 77 gfx::NativeView parent_window() const { return parent_window_; }
76 void set_parent_window(gfx::NativeView window) { parent_window_ = window; } 78 void set_parent_window(gfx::NativeView window) { parent_window_ = window; }
(...skipping 24 matching lines...) Expand all
101 // View overrides: 103 // View overrides:
102 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 104 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
103 105
104 // ui::AnimationDelegate overrides: 106 // ui::AnimationDelegate overrides:
105 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 107 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
106 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 108 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
107 109
108 // Perform view initialization on the contents for bubble sizing. 110 // Perform view initialization on the contents for bubble sizing.
109 virtual void Init(); 111 virtual void Init();
110 112
113 // Set the anchor view, this must be done before calling CreateBubble or Show.
114 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; }
115
116 bool move_with_anchor() const { return move_with_anchor_; }
117 void set_move_with_anchor(bool move_with_anchor) {
118 move_with_anchor_ = move_with_anchor;
119 }
120
111 // Resizes and potentially moves the Bubble to best accommodate the 121 // Resizes and potentially moves the Bubble to best accommodate the
112 // contents preferred size. 122 // contents preferred size.
113 void SizeToContents(); 123 void SizeToContents();
114 124
115 BubbleFrameView* GetBubbleFrameView() const; 125 BubbleFrameView* GetBubbleFrameView() const;
116 126
117 private: 127 private:
118 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, NonClientHitTest); 128 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, NonClientHitTest);
119 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); 129 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate);
120 130
121 // Get bubble bounds from the anchor point and client view's preferred size. 131 // Get bubble bounds from the anchor point and client view's preferred size.
122 gfx::Rect GetBubbleBounds(); 132 gfx::Rect GetBubbleBounds();
123 133
124 #if defined(OS_WIN) && !defined(USE_AURA) 134 #if defined(OS_WIN) && !defined(USE_AURA)
125 // Get bounds for the Windows-only widget that hosts the bubble's contents. 135 // Get bounds for the Windows-only widget that hosts the bubble's contents.
126 gfx::Rect GetBubbleClientBounds() const; 136 gfx::Rect GetBubbleClientBounds() const;
127 #endif 137 #endif
128 138
129 // Fade animation for bubble. 139 // Fade animation for bubble.
130 scoped_ptr<ui::SlideAnimation> fade_animation_; 140 scoped_ptr<ui::SlideAnimation> fade_animation_;
131 141
132 // Flags controlling bubble closure on the escape key and deactivation. 142 // Flags controlling bubble closure on the escape key and deactivation.
133 bool close_on_esc_; 143 bool close_on_esc_;
134 bool close_on_deactivate_; 144 bool close_on_deactivate_;
135 145
136 // The view hosting this bubble; the arrow is anchored to this view. 146 // The view and widget to which this bubble is anchored.
137 View* anchor_view_; 147 View* anchor_view_;
148 Widget* anchor_widget_;
149
150 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|.
151 bool move_with_anchor_;
138 152
139 // The arrow's location on the bubble. 153 // The arrow's location on the bubble.
140 BubbleBorder::ArrowLocation arrow_location_; 154 BubbleBorder::ArrowLocation arrow_location_;
141 155
142 // The background color of the bubble. 156 // The background color of the bubble.
143 SkColor color_; 157 SkColor color_;
144 158
145 // The margin between the content and the inside of the border, in pixels. 159 // The margin between the content and the inside of the border, in pixels.
146 int margin_; 160 int margin_;
147 161
148 // Original opacity of the bubble. 162 // Original opacity of the bubble.
149 int original_opacity_; 163 int original_opacity_;
150 164
151 // The widget hosting the border for this bubble (non-Aura Windows only). 165 // The widget hosting the border for this bubble (non-Aura Windows only).
152 Widget* border_widget_; 166 Widget* border_widget_;
153 167
154 // Create a popup window for focusless bubbles on Linux/ChromeOS. 168 // Create a popup window for focusless bubbles on Linux/ChromeOS.
155 // These bubbles are not interactive and should not gain focus. 169 // These bubbles are not interactive and should not gain focus.
156 bool use_focusless_; 170 bool use_focusless_;
157 171
158 // Parent native window of the bubble. 172 // Parent native window of the bubble.
159 gfx::NativeView parent_window_; 173 gfx::NativeView parent_window_;
160 174
161 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); 175 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
162 }; 176 };
163 177
164 } // namespace views 178 } // namespace views
165 179
166 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 180 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698