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

Side by Side Diff: chrome/browser/views/browser_bubble.cc

Issue 211027: Change BrowserBubble to use Close instead of CloseNow. This should make (Closed)
Patch Set: gtk Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/views/browser_bubble.h" 5 #include "chrome/browser/views/browser_bubble.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/views/frame/browser_view.h" 8 #include "chrome/browser/views/frame/browser_view.h"
9 #include "views/widget/root_view.h" 9 #include "views/widget/root_view.h"
10 #include "views/window/window.h" 10 #include "views/window/window.h"
11 11
12 BrowserBubble::BrowserBubble(views::View* view, views::Widget* frame, 12 BrowserBubble::BrowserBubble(views::View* view, views::Widget* frame,
13 const gfx::Point& origin) 13 const gfx::Point& origin)
14 : frame_(frame), 14 : frame_(frame),
15 view_(view), 15 view_(view),
16 visible_(false), 16 visible_(false),
17 delegate_(NULL), 17 delegate_(NULL),
18 attached_(false) { 18 attached_(false) {
19 frame_native_view_ = frame_->GetNativeView(); 19 frame_native_view_ = frame_->GetNativeView();
20 gfx::Size size = view->GetPreferredSize(); 20 gfx::Size size = view->GetPreferredSize();
21 bounds_.SetRect(origin.x(), origin.y(), size.width(), size.height()); 21 bounds_.SetRect(origin.x(), origin.y(), size.width(), size.height());
22 InitPopup(); 22 InitPopup();
23 } 23 }
24 24
25 BrowserBubble::~BrowserBubble() { 25 BrowserBubble::~BrowserBubble() {
26 DCHECK(!attached_); 26 DCHECK(!attached_);
27 popup_->CloseNow(); 27 popup_->Close();
28
28 // Don't call DetachFromBrowser from here. It needs to talk to the 29 // Don't call DetachFromBrowser from here. It needs to talk to the
29 // BrowserView to deregister itself, and if BrowserBubble is owned 30 // BrowserView to deregister itself, and if BrowserBubble is owned
30 // by a child of BrowserView, then it's possible that this stack frame 31 // by a child of BrowserView, then it's possible that this stack frame
31 // is a descendant of BrowserView's destructor, which leads to problems. 32 // is a descendant of BrowserView's destructor, which leads to problems.
32 // In that case, Detach doesn't need to get called anyway since BrowserView 33 // In that case, Detach doesn't need to get called anyway since BrowserView
33 // will do the necessary cleanup. 34 // will do the necessary cleanup.
34 } 35 }
35 36
36 void BrowserBubble::DetachFromBrowser() { 37 void BrowserBubble::DetachFromBrowser() {
37 DCHECK(attached_); 38 DCHECK(attached_);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 MovePopup(top_left.x() + bounds_.x(), 91 MovePopup(top_left.x() + bounds_.x(),
91 top_left.y() + bounds_.y(), 92 top_left.y() + bounds_.y(),
92 bounds_.width(), 93 bounds_.width(),
93 bounds_.height()); 94 bounds_.height());
94 } 95 }
95 96
96 void BrowserBubble::ResizeToView() { 97 void BrowserBubble::ResizeToView() {
97 gfx::Size size = view_->GetPreferredSize(); 98 gfx::Size size = view_->GetPreferredSize();
98 SetBounds(bounds_.x(), bounds_.y(), size.width(), size.height()); 99 SetBounds(bounds_.x(), bounds_.y(), size.width(), size.height());
99 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698