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

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

Issue 89503003: Close bubble widget when its anchor widget bounds has changed and move_with_anchor is false. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « no previous file | ui/views/bubble/bubble_delegate_unittest.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 #include "ui/views/bubble/bubble_delegate.h" 5 #include "ui/views/bubble/bubble_delegate.h"
6 6
7 #include "ui/base/accessibility/accessible_view_state.h" 7 #include "ui/base/accessibility/accessible_view_state.h"
8 #include "ui/gfx/animation/slide_animation.h" 8 #include "ui/gfx/animation/slide_animation.h"
9 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget, 169 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
170 bool active) { 170 bool active) {
171 if (close_on_deactivate() && widget == GetWidget() && !active) 171 if (close_on_deactivate() && widget == GetWidget() && !active)
172 GetWidget()->Close(); 172 GetWidget()->Close();
173 } 173 }
174 174
175 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, 175 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget,
176 const gfx::Rect& new_bounds) { 176 const gfx::Rect& new_bounds) {
177 if (move_with_anchor() && anchor_widget() == widget) 177 if (anchor_widget() == widget) {
178 SizeToContents(); 178 if (move_with_anchor())
179 SizeToContents();
180 else
181 GetWidget()->Close();
182 }
179 } 183 }
180 184
181 View* BubbleDelegateView::GetAnchorView() const { 185 View* BubbleDelegateView::GetAnchorView() const {
182 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_); 186 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_);
183 } 187 }
184 188
185 gfx::Rect BubbleDelegateView::GetAnchorRect() { 189 gfx::Rect BubbleDelegateView::GetAnchorRect() {
186 if (!GetAnchorView()) 190 if (!GetAnchorView())
187 return anchor_rect_; 191 return anchor_rect_;
188 192
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 345 }
342 346
343 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { 347 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) {
344 if (widget == GetWidget() && visible && anchor_widget() && 348 if (widget == GetWidget() && visible && anchor_widget() &&
345 anchor_widget()->GetTopLevelWidget()) { 349 anchor_widget()->GetTopLevelWidget()) {
346 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); 350 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering();
347 } 351 }
348 } 352 }
349 353
350 } // namespace views 354 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698