OLD | NEW |
---|---|
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/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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 color_(kBackgroundColor), | 131 color_(kBackgroundColor), |
132 margin_(kDefaultMargin), | 132 margin_(kDefaultMargin), |
133 original_opacity_(255), | 133 original_opacity_(255), |
134 border_widget_(NULL), | 134 border_widget_(NULL), |
135 use_focusless_(false), | 135 use_focusless_(false), |
136 parent_window_(NULL) { | 136 parent_window_(NULL) { |
137 set_background(views::Background::CreateSolidBackground(color_)); | 137 set_background(views::Background::CreateSolidBackground(color_)); |
138 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0)); | 138 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0)); |
139 } | 139 } |
140 | 140 |
141 BubbleDelegateView::~BubbleDelegateView() {} | 141 BubbleDelegateView::~BubbleDelegateView() { |
142 if (anchor_widget_) | |
143 anchor_widget_->RemoveObserver(this); | |
msw
2012/04/24 14:49:06
Try OnWidgetClosing, but even then, I find this is
sadrul
2012/04/24 15:15:53
I am not sure I understand what you mean.
msw
2012/04/24 17:01:43
Sorry, I meant to say try putting this in a Widget
sadrul
2012/04/24 18:00:49
Done.
| |
144 } | |
142 | 145 |
143 // static | 146 // static |
144 Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) { | 147 Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) { |
145 bubble_delegate->Init(); | 148 bubble_delegate->Init(); |
146 // Determine the anchor widget from the anchor view at bubble creation time. | 149 // Determine the anchor widget from the anchor view at bubble creation time. |
147 bubble_delegate->anchor_widget_ = bubble_delegate->anchor_view() ? | 150 bubble_delegate->anchor_widget_ = bubble_delegate->anchor_view() ? |
148 bubble_delegate->anchor_view()->GetWidget() : NULL; | 151 bubble_delegate->anchor_view()->GetWidget() : NULL; |
149 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); | 152 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); |
150 | 153 |
151 #if defined(OS_WIN) && !defined(USE_AURA) | 154 #if defined(OS_WIN) && !defined(USE_AURA) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 | 328 |
326 #if defined(OS_WIN) && !defined(USE_AURA) | 329 #if defined(OS_WIN) && !defined(USE_AURA) |
327 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 330 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
328 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 331 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
329 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); | 332 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); |
330 return client_bounds; | 333 return client_bounds; |
331 } | 334 } |
332 #endif | 335 #endif |
333 | 336 |
334 } // namespace views | 337 } // namespace views |
OLD | NEW |