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

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

Issue 23622020: Fixing the dynamic positioning (move with anchor) for the app launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit test Created 7 years, 3 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
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/animation/slide_animation.h" 7 #include "ui/base/animation/slide_animation.h"
8 #include "ui/gfx/color_utils.h" 8 #include "ui/gfx/color_utils.h"
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 #include "ui/native_theme/native_theme.h" 10 #include "ui/native_theme/native_theme.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 const gfx::Rect& new_bounds) { 250 const gfx::Rect& new_bounds) {
251 if (move_with_anchor() && anchor_widget() == widget) 251 if (move_with_anchor() && anchor_widget() == widget)
252 SizeToContents(); 252 SizeToContents();
253 } 253 }
254 254
255 gfx::Rect BubbleDelegateView::GetAnchorRect() { 255 gfx::Rect BubbleDelegateView::GetAnchorRect() {
256 if (!anchor_view()) 256 if (!anchor_view())
257 return anchor_rect_; 257 return anchor_rect_;
258 gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen(); 258 gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen();
259 anchor_bounds.Inset(anchor_view_insets_); 259 anchor_bounds.Inset(anchor_view_insets_);
260 anchor_bounds.set_x(anchor_bounds.x() + anchor_offset_.x());
261 anchor_bounds.set_y(anchor_bounds.y() + anchor_offset_.y());
260 return anchor_bounds; 262 return anchor_bounds;
261 } 263 }
262 264
263 void BubbleDelegateView::StartFade(bool fade_in) { 265 void BubbleDelegateView::StartFade(bool fade_in) {
264 #if defined(USE_AURA) 266 #if defined(USE_AURA)
265 // Use AURA's window layer animation instead of fading. This ensures that 267 // Use AURA's window layer animation instead of fading. This ensures that
266 // hosts which rely on the layer animation callbacks to close the window 268 // hosts which rely on the layer animation callbacks to close the window
267 // work correctly. 269 // work correctly.
268 if (fade_in) 270 if (fade_in)
269 GetWidget()->Show(); 271 GetWidget()->Show();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 border_widget_->ShowInactive(); 418 border_widget_->ShowInactive();
417 if (anchor_widget() && anchor_widget()->GetTopLevelWidget()) 419 if (anchor_widget() && anchor_widget()->GetTopLevelWidget())
418 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); 420 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering();
419 } else { 421 } else {
420 if (border_widget_) 422 if (border_widget_)
421 border_widget_->Hide(); 423 border_widget_->Hide();
422 } 424 }
423 } 425 }
424 426
425 } // namespace views 427 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698