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

Unified Diff: ui/views/bubble/bubble_delegate.h

Issue 24469006: Fixing crash Report - Magic Signature: views::View::ConvertPointToScreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed - git what are you doing today? 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/bubble/bubble_delegate.h
diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h
index 4a0bb30ec0160b49e25167769261f49be2894b10..eab65bd32fa5ae693a97a11b9ec110a3653b2b65 100644
--- a/ui/views/bubble/bubble_delegate.h
+++ b/ui/views/bubble/bubble_delegate.h
@@ -59,10 +59,13 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
bool close_on_deactivate() const { return close_on_deactivate_; }
void set_close_on_deactivate(bool close) { close_on_deactivate_ = close; }
- View* anchor_view() const { return anchor_view_; }
+ View* GetAnchorView() const;
Widget* anchor_widget() const { return anchor_widget_; }
+ // Even though AnchorView might return NULL, the bubble might have an
+ // anchor_view attached to it upon creation.
+ bool has_anchor_view() const { return has_anchor_view_; }
- // The anchor rect is used in the absence of an anchor view.
+ // The anchor rect is used in the absence of an assigned anchor view.
const gfx::Rect& anchor_rect() const { return anchor_rect_; }
BubbleBorder::Arrow arrow() const { return arrow_; }
@@ -141,8 +144,11 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
// Perform view initialization on the contents for bubble sizing.
virtual void Init();
- // Set the anchor view or rect; set these before CreateBubble or Show.
- void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; }
+ // Set the anchor view or rect; set these before CreateBubble or Show. Note
+ // that if a valid view gets passed, the anchor rect will get ignored. If the
+ // view gets deleted, but no new view gets set, the last known anchor postion
+ // will get returned.
+ void SetAnchorView(View* anchor_view);
void set_anchor_rect(const gfx::Rect& rect) { anchor_rect_ = rect; }
// Resize and potentially move the bubble to fit the content's preferred size.
@@ -167,6 +173,9 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
// Handles widget visibility changes.
void HandleVisibilityChanged(Widget* widget, bool visible);
+ // Detach the bubble from the anchor (has no effect if there is no anchor).
+ void DetachFromAnchor();
+
// Fade animation for bubble.
scoped_ptr<gfx::SlideAnimation> fade_animation_;
@@ -174,8 +183,11 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
bool close_on_esc_;
bool close_on_deactivate_;
- // The view and widget to which this bubble is anchored.
- View* anchor_view_;
+ // The view and widget to which this bubble is anchored. Since an anchor view
+ // can be deleted without notice, we store it in the ViewStorage and retrieve
+ // it from there. It will make sure that the view is still valid.
+ bool has_anchor_view_;
+ int anchor_view_storage_id_;
Widget* anchor_widget_;
// The anchor rect used in the absence of an anchor view.

Powered by Google App Engine
This is Rietveld 408576698