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

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

Issue 8909013: Patch AvatarMenuBubbleView crash; only SizeToContents if GetBubbleFrameView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Run OnAvatarMenuModelChanged on Init, not ctor. Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/bubble/bubble_frame_view.h" 9 #include "ui/views/bubble/bubble_frame_view.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 #if defined(OS_WIN) && !defined(USE_AURA) 272 #if defined(OS_WIN) && !defined(USE_AURA)
273 border_widget_->SetBounds(GetBubbleBounds()); 273 border_widget_->SetBounds(GetBubbleBounds());
274 GetWidget()->SetBounds(GetBubbleClientBounds()); 274 GetWidget()->SetBounds(GetBubbleClientBounds());
275 #else 275 #else
276 GetWidget()->SetBounds(GetBubbleBounds()); 276 GetWidget()->SetBounds(GetBubbleBounds());
277 #endif 277 #endif
278 } 278 }
279 279
280 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const { 280 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const {
281 const Widget* widget = border_widget_ ? border_widget_ : GetWidget(); 281 const Widget* widget = border_widget_ ? border_widget_ : GetWidget();
282 return static_cast<BubbleFrameView*>(widget->non_client_view()->frame_view()); 282 const NonClientView* view = widget ? widget->non_client_view() : NULL;
283 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL;
283 } 284 }
284 285
285 gfx::Rect BubbleDelegateView::GetBubbleBounds() { 286 gfx::Rect BubbleDelegateView::GetBubbleBounds() {
286 // The argument rect has its origin at the bubble's arrow anchor point; 287 // The argument rect has its origin at the bubble's arrow anchor point;
287 // its size is the preferred size of the bubble's client view (this view). 288 // its size is the preferred size of the bubble's client view (this view).
288 return GetBubbleFrameView()->GetWindowBoundsForAnchorAndClientSize( 289 return GetBubbleFrameView()->GetWindowBoundsForAnchorAndClientSize(
289 GetAnchorRect(), GetPreferredSize()); 290 GetAnchorRect(), GetPreferredSize());
290 } 291 }
291 292
292 #if defined(OS_WIN) && !defined(USE_AURA) 293 #if defined(OS_WIN) && !defined(USE_AURA)
293 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { 294 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
294 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); 295 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
295 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); 296 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin());
296 return client_bounds; 297 return client_bounds;
297 } 298 }
298 #endif 299 #endif
299 300
300 } // namespace views 301 } // namespace views
OLDNEW
« chrome/browser/ui/views/avatar_menu_bubble_view.cc ('K') | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698