diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 20:32:33 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 20:32:33 +0000 |
commit | 43cb919add660ef0c3ea1c3b49ac9a2e2a1d2f7d (patch) | |
tree | 042fef0235a2a0c9fb196c2f0af2ed4d312c3ead /chrome | |
parent | b948c26a3962a30a3ee6cb85373a5b5c22bb4228 (diff) | |
download | chromium_src-43cb919add660ef0c3ea1c3b49ac9a2e2a1d2f7d.zip chromium_src-43cb919add660ef0c3ea1c3b49ac9a2e2a1d2f7d.tar.gz chromium_src-43cb919add660ef0c3ea1c3b49ac9a2e2a1d2f7d.tar.bz2 |
Remove unused BrowserBubble remnants.
The only use of BrowserBubble was deprecated in crrev.com/111886.
ExtensionPopup now uses the new views bubble; this code is dead.
BUG=97248,98323
TEST=ExtensionPopup bubbles work as before.
Review URL: http://codereview.chromium.org/8673009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/automation_provider_win.cc | 4 | ||||
-rw-r--r-- | chrome/browser/external_tab_container_win.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_actions_container.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_bubble.cc | 130 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_bubble.h | 142 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_bubble_aura.cc | 24 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_bubble_gtk.cc | 159 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_bubble_win.cc | 154 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_bubble_host.cc | 47 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_bubble_host.h | 44 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_frame_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.h | 5 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 14 |
14 files changed, 2 insertions, 730 deletions
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index c2de6ab..7397ca0b 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -343,9 +343,7 @@ void AutomationProvider::ConnectExternalTab( void AutomationProvider::OnBrowserMoved(int tab_handle) { ExternalTabContainer* external_tab = GetExternalTabForHandle(tab_handle); - if (external_tab) { - external_tab->WindowMoved(); - } else { + if (!external_tab) { DLOG(WARNING) << "AutomationProvider::OnBrowserMoved called with invalid tab handle."; } diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index cdfa0da..f2b87c1 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -18,7 +18,6 @@ #include "chrome/browser/infobars/infobar_container.h" #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.h" -#include "chrome/browser/ui/views/frame/browser_bubble_host.h" #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents_observer.h" @@ -51,7 +50,6 @@ class ExternalTabContainer : public TabContentsDelegate, public base::RefCounted<ExternalTabContainer>, public ui::AcceleratorTarget, public InfoBarContainer::Delegate, - public BrowserBubbleHost, public BlockedContentTabHelperDelegate { public: typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h index cf03078..a13a3d0 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -16,7 +16,6 @@ #include "chrome/browser/extensions/extension_context_menu_model.h" #include "chrome/browser/extensions/extension_toolbar_model.h" #include "chrome/browser/extensions/image_loading_tracker.h" -#include "chrome/browser/ui/views/browser_bubble.h" #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h" #include "chrome/browser/ui/views/extensions/extension_popup.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/ui/views/browser_bubble.cc b/chrome/browser/ui/views/browser_bubble.cc deleted file mode 100644 index 71a92765..0000000 --- a/chrome/browser/ui/views/browser_bubble.cc +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/browser_bubble.h" - -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "ui/views/widget/widget.h" - -BrowserBubble::BrowserBubble(Browser* browser, - views::View* view, - const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location) - : frame_(NULL), - view_(view), - relative_to_(relative_to), - arrow_location_(arrow_location), - delegate_(NULL), - attached_(false), - bubble_host_(NULL) { - BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); - frame_ = browser_view->GetWidget(); - bubble_host_ = browser_view; - // Keep relative_to_ in frame-relative coordinates to aid in drag - // positioning. - gfx::Point origin = relative_to_.origin(); - views::View::ConvertPointToView(NULL, frame_->GetRootView(), &origin); - relative_to_.set_origin(origin); - - // Use half the corner radius as contents margins so that contents fit better - // in the bubble. See http://crbug.com/80416. - int corner_inset = views::BubbleBorder::GetCornerRadius() / 2; - gfx::Insets content_margins(corner_inset, corner_inset, - corner_inset, corner_inset); - InitPopup(content_margins); -} - -BrowserBubble::~BrowserBubble() { - DCHECK(!attached_); - popup_->Close(); - - // Don't call DetachFromBrowser from here. It needs to talk to the - // BrowserView to deregister itself, and if BrowserBubble is owned - // by a child of BrowserView, then it's possible that this stack frame - // is a descendant of BrowserView's destructor, which leads to problems. - // In that case, Detach doesn't need to get called anyway since BrowserView - // will do the necessary cleanup. -} - -void BrowserBubble::DetachFromBrowser() { - DCHECK(attached_); - if (!attached_) - return; - attached_ = false; - - if (bubble_host_) - bubble_host_->DetachBrowserBubble(this); -} - -void BrowserBubble::AttachToBrowser() { - DCHECK(!attached_); - if (attached_) - return; - - if (bubble_host_) - bubble_host_->AttachBrowserBubble(this); - - attached_ = true; -} - -void BrowserBubble::BrowserWindowMoved() { - if (delegate_) - delegate_->BubbleBrowserWindowMoved(this); - else - Hide(); - if (popup_->IsVisible()) - Reposition(); -} - -void BrowserBubble::BrowserWindowClosing() { - if (delegate_) - delegate_->BubbleBrowserWindowClosing(this); - else - Hide(); -} - -void BrowserBubble::SetBounds(int x, int y, int w, int h) { - // If the UI layout is RTL, we don't need to mirror coordinates, since - // View logic will do that for us. - bounds_.SetRect(x, y, w, h); - Reposition(); -} - -void BrowserBubble::MoveTo(int x, int y) { - SetBounds(x, y, bounds_.width(), bounds_.height()); -} - -void BrowserBubble::Reposition() { - gfx::Point top_left; - views::View::ConvertPointToScreen(frame_->GetRootView(), &top_left); - MovePopup(top_left.x() + bounds_.x(), - top_left.y() + bounds_.y(), - bounds_.width(), - bounds_.height()); -} - -gfx::Rect BrowserBubble::GetAbsoluteRelativeTo() { - // |relative_to_| is in browser-relative coordinates, so convert it to - // screen coordinates for use in placing the popup widgets. - gfx::Rect relative_rect = relative_to_; - gfx::Point relative_origin = relative_rect.origin(); - views::View::ConvertPointToScreen(frame_->GetRootView(), &relative_origin); - relative_rect.set_origin(relative_origin); - - return relative_rect; -} - -void BrowserBubble::SetAbsoluteBounds(const gfx::Rect& window_bounds) { - // Convert screen coordinates to frame relative. - gfx::Point relative_origin = window_bounds.origin(); - views::View::ConvertPointToView(NULL, frame_->GetRootView(), - &relative_origin); - SetBounds(relative_origin.x(), relative_origin.y(), - window_bounds.width(), window_bounds.height()); -} - -void BrowserBubble::MovePopup(int x, int y, int w, int h) { - popup_->SetBounds(gfx::Rect(x, y, w, h)); -} diff --git a/chrome/browser/ui/views/browser_bubble.h b/chrome/browser/ui/views/browser_bubble.h deleted file mode 100644 index f16e8d4..0000000 --- a/chrome/browser/ui/views/browser_bubble.h +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ -#define CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ -#pragma once - -#include "ui/views/bubble/bubble_border.h" -#include "ui/views/widget/widget.h" -#include "views/view.h" - -class Browser; -class BrowserBubbleHost; - -// A class for creating a floating window that is "attached" to a particular -// Browser. If you don't install a delegate, the bubble will hide -// automatically when the browser moves. The bubble is only shown manually. -// Users are expected to delete the bubble when finished with it. -// Class assumes that RTL related mirroring is done by the view. -class BrowserBubble { - public: - // Delegate to browser bubble events. - class Delegate { - public: - // Called when the Browser Window that this bubble is attached to moves. - virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {} - - // Called with the Browser Window that this bubble is attached to is - // about to close. - virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {} - - // Called when the bubble became active / got focus. - virtual void BubbleGotFocus(BrowserBubble* bubble) {} - - // Called when the bubble became inactive / lost focus. - // |lost_focus_to_child| is true when a child window became active. - virtual void BubbleLostFocus(BrowserBubble* bubble, - bool lost_focus_to_child) {} - }; - - // Note that the bubble will size itself to the preferred size of |view| plus - // insets of bubble border. |view| is the embedded view, |browser| is the - // browser that the bubble is being positioned relative to, |relative_to| is - // the location that the bubble is showing relative to in screen coordinates, - // e.g. if the buuble is showing for a toolbar button, |relative_to| usually - // would be the bounds of the toolbar button in screen coordiates, - // |arrow_location| is the location where the arrow should on the bubble. - BrowserBubble(Browser* browser, - views::View* view, - const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location); - virtual ~BrowserBubble(); - - // Call manually if you need to detach the bubble from tracking the browser's - // position. Note that you must call this manually before deleting this - // object since it can't be safely called from the destructor. - void DetachFromBrowser(); - - // Normally called automatically during construction, but if DetachFromBrowser - // has been called manually, then this call will reattach. - void AttachToBrowser(); - bool attached() const { return attached_; } - - // Get/Set the delegate. - Delegate* delegate() const { return delegate_; } - void set_delegate(Delegate* del) { delegate_ = del; } - - // Notifications from BrowserBubbleHost. - // With no delegate, both of these default to Hiding the bubble. - virtual void BrowserWindowMoved(); - virtual void BrowserWindowClosing(); - - // Show or hide the bubble. - virtual void Show(bool activate); - virtual void Hide(); - - // The contained view. - views::View* view() const { return view_; } - - // Set the bounds of the bubble relative to the browser window. - void SetBounds(int x, int y, int w, int h); - void MoveTo(int x, int y); - int width() { return bounds_.width(); } - int height() { return bounds_.height(); } - const gfx::Rect& bounds() const { return bounds_; } - - // Reposition the bubble - as we are using a WS_POPUP for the bubble, - // we have to manually position it when the browser window moves. - void Reposition(); - - // Resize the bubble to fit the view. - void ResizeToView(); - - // Returns the NativeView containing that popup. - gfx::NativeView native_view() const { return popup_->GetNativeView(); } - - protected: - // Create the popup widget. - virtual void InitPopup(const gfx::Insets& content_margins); - - // Get |relative_to_| rect in screen coordinates. - gfx::Rect GetAbsoluteRelativeTo(); - - // Set bounds using screen coordinates. - void SetAbsoluteBounds(const gfx::Rect& window_bounds); - - // Move the popup to an absolute position. - void MovePopup(int x, int y, int w, int h); - - // The widget that this bubble is in. - views::Widget* popup_; - - // The frame that this bubble is attached to. - views::Widget* frame_; - - private: - // The view that is displayed in this bubble. - views::View* view_; - - // Anchor rect that this bubble is shown relative to, in frame coordinates. - gfx::Rect relative_to_; - - // Arrow location of this bubble. - views::BubbleBorder::ArrowLocation arrow_location_; - - // The bounds relative to the frame. - gfx::Rect bounds_; - - // The delegate isn't owned by the bubble. - Delegate* delegate_; - - // Is the bubble attached to a Browser window. - bool attached_; - - // Non-owning pointer to the host of this bubble. - BrowserBubbleHost* bubble_host_; - - DISALLOW_COPY_AND_ASSIGN(BrowserBubble); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ diff --git a/chrome/browser/ui/views/browser_bubble_aura.cc b/chrome/browser/ui/views/browser_bubble_aura.cc deleted file mode 100644 index ea75266..0000000 --- a/chrome/browser/ui/views/browser_bubble_aura.cc +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/browser_bubble.h" - -// TODO(msw|oshima): This will be replaced with new bubble. -// See crbug.com/97248. - -void BrowserBubble::InitPopup(const gfx::Insets& content_margins) { - NOTIMPLEMENTED(); -} - -void BrowserBubble::Show(bool activate) { - NOTIMPLEMENTED(); -} - -void BrowserBubble::Hide() { - NOTIMPLEMENTED(); -} - -void BrowserBubble::ResizeToView() { - NOTIMPLEMENTED(); -} diff --git a/chrome/browser/ui/views/browser_bubble_gtk.cc b/chrome/browser/ui/views/browser_bubble_gtk.cc deleted file mode 100644 index c4ef16a..0000000 --- a/chrome/browser/ui/views/browser_bubble_gtk.cc +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/browser_bubble.h" - -#include <vector> - -#include "chrome/browser/ui/views/bubble/border_contents.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "ui/views/widget/native_widget_gtk.h" -#include "ui/views/widget/root_view.h" - -#if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) -#include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" -#include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" -#endif - -using std::vector; - -namespace { - -class BubbleWidget : public views::NativeWidgetGtk { - public: - BubbleWidget(BrowserBubble* bubble, const gfx::Insets& content_margins) - : views::NativeWidgetGtk(new views::Widget), - bubble_(bubble), - border_contents_(new BorderContents) { - border_contents_->Init(); - border_contents_->set_content_margins(content_margins); - } - - void ShowAndActivate(bool activate) { - // TODO: honor activate. - views::NativeWidgetGtk::Show(); - } - - virtual void Close() OVERRIDE { - if (!bubble_) - return; // We have already been closed. - if (IsActive()) { - BrowserBubble::Delegate* delegate = bubble_->delegate(); - if (delegate) - delegate->BubbleLostFocus(bubble_, false); - } - views::NativeWidgetGtk::Close(); - bubble_ = NULL; - } - - virtual void Hide() OVERRIDE { - if (IsActive() && bubble_) { - BrowserBubble::Delegate* delegate = bubble_->delegate(); - if (delegate) - delegate->BubbleLostFocus(bubble_, false); - } - views::NativeWidgetGtk::Hide(); - } - - virtual void OnActiveChanged() OVERRIDE { - if (IsActive() || !bubble_) - return; - BrowserBubble::Delegate* delegate = bubble_->delegate(); - if (!delegate) { - bubble_->DetachFromBrowser(); - delete bubble_; - return; - } - - // TODO(jcampan): http://crbugs.com/29131 Check if the window we are losing - // focus to is a child window and pass that to the call - // below. - delegate->BubbleLostFocus(bubble_, false); - } - - virtual gboolean OnFocusIn(GtkWidget* widget, GdkEventFocus* event) OVERRIDE { - if (bubble_ && bubble_->delegate()) - bubble_->delegate()->BubbleGotFocus(bubble_); - return views::NativeWidgetGtk::OnFocusIn(widget, event); - } - - BorderContents* border_contents() { - return border_contents_; - } - - private: - BrowserBubble* bubble_; - BorderContents* border_contents_; // Owned by root view of this widget. - - DISALLOW_COPY_AND_ASSIGN(BubbleWidget); -}; - -} // namespace - -void BrowserBubble::InitPopup(const gfx::Insets& content_margins) { - // TODO(port) - BubbleWidget* bubble_widget = new BubbleWidget(this, content_margins); - popup_ = bubble_widget->GetWidget(); - views::Widget::InitParams params( - views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); - params.transparent = true; - params.parent = frame_->GetNativeView(); - params.native_widget = bubble_widget; - popup_->Init(params); -#if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) - { - vector<int> params; - params.push_back(0); // don't show while screen is locked - chromeos::WmIpc::instance()->SetWindowType( - popup_->GetNativeView(), - chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, - ¶ms); - } -#endif - - views::View* contents_view = new views::View; - - // We add |contents_view| to ourselves before the AddChildView() call below so - // that when |contents| gets added, it will already have a widget, and thus - // any NativeButtons it creates in ViewHierarchyChanged() will be functional - // (e.g. calling SetChecked() on checkboxes is safe). - popup_->SetContentsView(contents_view); - - // Added border_contents before |view_| so it will paint under it. - contents_view->AddChildView(bubble_widget->border_contents()); - contents_view->AddChildView(view_); - - ResizeToView(); - Reposition(); - AttachToBrowser(); -} - -void BrowserBubble::Show(bool activate) { - if (!popup_->IsVisible()) { - static_cast<BubbleWidget*>(popup_->native_widget())->ShowAndActivate( - activate); - } -} - -void BrowserBubble::Hide() { - if (popup_->IsVisible()) - static_cast<BubbleWidget*>(popup_->native_widget())->Hide(); -} - -void BrowserBubble::ResizeToView() { - BorderContents* border_contents = - static_cast<BubbleWidget*>(popup_->native_widget())->border_contents(); - - // Calculate and set the bounds for all windows and views. - gfx::Rect window_bounds; - gfx::Rect contents_bounds; - border_contents->SizeAndGetBounds(GetAbsoluteRelativeTo(), - arrow_location_, false, view_->size(), - &contents_bounds, &window_bounds); - - border_contents->SetBoundsRect(gfx::Rect(gfx::Point(), window_bounds.size())); - view_->SetBoundsRect(contents_bounds); - - SetAbsoluteBounds(window_bounds); -} diff --git a/chrome/browser/ui/views/browser_bubble_win.cc b/chrome/browser/ui/views/browser_bubble_win.cc deleted file mode 100644 index aa3de5a..0000000 --- a/chrome/browser/ui/views/browser_bubble_win.cc +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/browser_bubble.h" - -#include "chrome/browser/ui/views/bubble/border_contents.h" -#include "chrome/browser/ui/views/bubble/border_widget_win.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "ui/views/widget/native_widget_win.h" -#include "ui/views/widget/root_view.h" -#include "ui/views/widget/widget.h" - -class BubbleWidget : public views::NativeWidgetWin { - public: - explicit BubbleWidget(BrowserBubble* bubble) - : views::NativeWidgetWin(new views::Widget), - bubble_(bubble), - border_widget_(new BorderWidgetWin) { - set_window_style(WS_POPUP | WS_CLIPCHILDREN); - set_window_ex_style(WS_EX_TOOLWINDOW); - } - - void ShowAndActivate(bool activate) { - // Show the border first, then the popup overlaid on top. - border_widget_->Show(); - if (activate) - ShowWindow(SW_SHOW); - else - views::NativeWidgetWin::Show(); - } - - void Close() { - if (!bubble_) - return; // We have already been closed. - if (IsActive()) { - BrowserBubble::Delegate* delegate = bubble_->delegate(); - if (delegate) - delegate->BubbleLostFocus(bubble_, NULL); - } - border_widget_->Close(); - views::NativeWidgetWin::Close(); - bubble_ = NULL; - } - - void Hide() { - if (IsActive() && bubble_) { - BrowserBubble::Delegate* delegate = bubble_->delegate(); - if (delegate) - delegate->BubbleLostFocus(bubble_, NULL); - } - views::NativeWidgetWin::Hide(); - border_widget_->Hide(); - } - - void OnActivate(UINT action, BOOL minimized, HWND window) { - NativeWidgetWin::OnActivate(action, minimized, window); - if (!bubble_) - return; - - BrowserBubble::Delegate* delegate = bubble_->delegate(); - if (!delegate) { - if (action == WA_INACTIVE) { - bubble_->DetachFromBrowser(); - delete bubble_; - } - return; - } - - if (action == WA_INACTIVE) { - bool lost_focus_to_child = false; - - // Are we a parent of this window? - gfx::NativeView parent = window; - while (parent = ::GetParent(parent)) { - if (window == GetNativeView()) { - lost_focus_to_child = true; - break; - } - } - - // Do we own this window? - if (!lost_focus_to_child && - ::GetWindow(window, GW_OWNER) == GetNativeView()) { - lost_focus_to_child = true; - } - - delegate->BubbleLostFocus(bubble_, lost_focus_to_child); - } - } - - virtual void OnSetFocus(HWND focused_window) { - NativeWidgetWin::OnSetFocus(focused_window); - if (bubble_ && bubble_->delegate()) - bubble_->delegate()->BubbleGotFocus(bubble_); - } - - BorderWidgetWin* border_widget() { - return border_widget_; - } - - private: - BrowserBubble* bubble_; - BorderWidgetWin* border_widget_; - - DISALLOW_COPY_AND_ASSIGN(BubbleWidget); -}; - -void BrowserBubble::InitPopup(const gfx::Insets& content_margins) { - // popup_ is a Widget, but we need to do some NativeWidgetWin stuff first, - // then we'll assign it into popup_. - BubbleWidget* bubble_widget = new BubbleWidget(this); - - BorderWidgetWin* border_widget = bubble_widget->border_widget(); - border_widget->InitBorderWidgetWin(new BorderContents, - frame_->GetNativeView()); - border_widget->border_contents()->set_content_margins(content_margins); - - popup_ = bubble_widget->GetWidget(); - // We make the BorderWidgetWin the owner of the Bubble HWND, so that the - // latter is displayed on top of the former. - views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); - params.native_widget = bubble_widget; - params.parent = border_widget->GetNativeView(); - popup_->Init(params); - popup_->SetContentsView(view_); - - ResizeToView(); - Reposition(); - AttachToBrowser(); -} - -void BrowserBubble::Show(bool activate) { - if (!popup_->IsVisible()) { - static_cast<BubbleWidget*>(popup_->native_widget())->ShowAndActivate( - activate); - } -} - -void BrowserBubble::Hide() { - if (popup_->IsVisible()) - static_cast<BubbleWidget*>(popup_->native_widget())->Hide(); -} - -void BrowserBubble::ResizeToView() { - BorderWidgetWin* border_widget = - static_cast<BubbleWidget*>(popup_->native_widget())->border_widget(); - - gfx::Rect window_bounds; - window_bounds = border_widget->SizeAndGetBounds(GetAbsoluteRelativeTo(), - arrow_location_, view_->size()); - - SetAbsoluteBounds(window_bounds); -} diff --git a/chrome/browser/ui/views/frame/browser_bubble_host.cc b/chrome/browser/ui/views/frame/browser_bubble_host.cc deleted file mode 100644 index 4a08f86..0000000 --- a/chrome/browser/ui/views/frame/browser_bubble_host.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/frame/browser_bubble_host.h" - -#include "base/logging.h" -#include "chrome/browser/ui/views/browser_bubble.h" - -BrowserBubbleHost::BrowserBubbleHost() {} - -BrowserBubbleHost::~BrowserBubbleHost() {} - -void BrowserBubbleHost::WindowMoved() { - // Do safe iteration in case the bubble winds up closing as a result of this - // message. - for (BubbleSet::iterator i = browser_bubbles_.begin(); - i != browser_bubbles_.end();) { - BubbleSet::iterator bubble = i++; - (*bubble)->BrowserWindowMoved(); - } -} - -void BrowserBubbleHost::AttachBrowserBubble(BrowserBubble* bubble) { - DCHECK(browser_bubbles_.find(bubble) == browser_bubbles_.end()) << - "Attempt to register the same BrowserBubble multiple times."; - browser_bubbles_.insert(bubble); -} - -void BrowserBubbleHost::DetachBrowserBubble(BrowserBubble* bubble) { - BubbleSet::iterator it = browser_bubbles_.find(bubble); - DCHECK(it != browser_bubbles_.end()) << - "Attempt to detach an unrecognized BrowserBubble."; - if (it != browser_bubbles_.end()) - browser_bubbles_.erase(it); -} - -void BrowserBubbleHost::Close() { - // BrowserWindowClosing will usually cause the bubble to remove itself from - // the set, so we need to iterate in a way that's safe against deletion. - for (BubbleSet::iterator i = browser_bubbles_.begin(); - i != browser_bubbles_.end();) { - BubbleSet::iterator bubble = i++; - (*bubble)->BrowserWindowClosing(); - } -} - diff --git a/chrome/browser/ui/views/frame/browser_bubble_host.h b/chrome/browser/ui/views/frame/browser_bubble_host.h deleted file mode 100644 index 139befb..0000000 --- a/chrome/browser/ui/views/frame/browser_bubble_host.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_ -#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_ -#pragma once - -#include <set> - -#include "base/basictypes.h" - -class BrowserBubble; - -// A class providing a hosting environment for BrowserBubble instances. -// Allows for notification to attached BrowserBubbles of browser move, and -// close events. -class BrowserBubbleHost { - public: - BrowserBubbleHost(); - ~BrowserBubbleHost(); - - // Invoked when the window containing the attached browser-bubbles is moved. - // Calls BrowserBubble::BrowserWindowMoved on all attached bubbles. - void WindowMoved(); - - // To be called when the frame containing the BrowserBubbleHost is closing. - // Calls BrowserBubble::BrowserWindowClosing on all attached bubbles. - void Close(); - - // Registers/Unregisters |bubble| to receive notifications when the host moves - // or is closed. - void AttachBrowserBubble(BrowserBubble* bubble); - void DetachBrowserBubble(BrowserBubble* bubble); - - private: - // The set of bubbles associated with this host. - typedef std::set<BrowserBubble*> BubbleSet; - BubbleSet browser_bubbles_; - - DISALLOW_COPY_AND_ASSIGN(BrowserBubbleHost); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_ diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc index a9fb6e5..2cccddc 100644 --- a/chrome/browser/ui/views/frame/browser_frame_gtk.cc +++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc @@ -77,11 +77,9 @@ gboolean BrowserFrameGtk::OnWindowStateEvent(GtkWidget* widget, gboolean BrowserFrameGtk::OnConfigureEvent(GtkWidget* widget, GdkEventConfigure* event) { - browser_view_->WindowMoved(); return views::NativeWidgetGtk::OnConfigureEvent(widget, event); } - //////////////////////////////////////////////////////////////////////////////// // NativeBrowserFrame, public: diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 5f9ed64..099e161 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -628,8 +628,6 @@ void BrowserView::SetBounds(const gfx::Rect& bounds) { } void BrowserView::Close() { - BrowserBubbleHost::Close(); - frame_->Close(); } @@ -1677,8 +1675,6 @@ void BrowserView::OnWidgetMove() { if (status_bubble_.get()) status_bubble_->Reposition(); - BrowserBubbleHost::WindowMoved(); - browser::HideBookmarkBubbleView(); // Close the omnibox popup, if any. diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 430bf73..1d8444c 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -18,7 +18,6 @@ #include "chrome/browser/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/views/frame/browser_bubble_host.h" #include "chrome/browser/ui/views/frame/browser_frame.h" #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" @@ -41,7 +40,6 @@ class BookmarkBarView; class Browser; -class BrowserBubble; class BrowserViewLayout; class ContentsContainer; class DownloadShelfView; @@ -81,8 +79,7 @@ class Menu; // A ClientView subclass that provides the contents of a browser window, // including the TabStrip, toolbars, download shelves, the content area etc. // -class BrowserView : public BrowserBubbleHost, - public BrowserWindow, +class BrowserView : public BrowserWindow, public BrowserWindowTesting, public content::NotificationObserver, public TabStripModelObserver, diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 3792350..daaf61e 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3304,11 +3304,6 @@ 'browser/ui/views/bookmarks/bookmark_menu_delegate.h', 'browser/ui/views/browser_actions_container.cc', 'browser/ui/views/browser_actions_container.h', - 'browser/ui/views/browser_bubble.cc', - 'browser/ui/views/browser_bubble.h', - 'browser/ui/views/browser_bubble_aura.cc', - 'browser/ui/views/browser_bubble_gtk.cc', - 'browser/ui/views/browser_bubble_win.cc', 'browser/ui/views/browser_dialogs.h', 'browser/ui/views/bubble/border_contents.cc', 'browser/ui/views/bubble/border_contents.h', @@ -3398,8 +3393,6 @@ 'browser/ui/views/first_run_search_engine_view.h', 'browser/ui/views/frame/app_panel_browser_frame_view.cc', 'browser/ui/views/frame/app_panel_browser_frame_view.h', - 'browser/ui/views/frame/browser_bubble_host.cc', - 'browser/ui/views/frame/browser_bubble_host.h', 'browser/ui/views/frame/browser_frame.cc', 'browser/ui/views/frame/browser_frame.h', 'browser/ui/views/frame/browser_frame_aura.cc', @@ -4190,7 +4183,6 @@ ['exclude', '^browser/ui/views/app_menu_button_win.cc'], ['exclude', '^browser/ui/views/bookmarks/bookmark_editor_view.cc'], ['exclude', '^browser/ui/views/bookmarks/bookmark_editor_view.h'], - ['exclude', '^browser/ui/views/browser_bubble_win.cc'], ['exclude', '^browser/ui/views/bubble/border_widget_win.cc'], ['exclude', '^browser/ui/views/bubble/border_widget_win.h'], ['exclude', '^browser/ui/views/certificate_viewer_win.cc'], @@ -4704,9 +4696,6 @@ ['include', '^browser/ui/views/bookmarks/bookmark_menu_delegate.h'], ['include', '^browser/ui/views/browser_actions_container.cc'], ['include', '^browser/ui/views/browser_actions_container.h'], - ['include', '^browser/ui/views/browser_bubble.cc'], - ['include', '^browser/ui/views/browser_bubble.h'], - ['include', '^browser/ui/views/browser_bubble_gtk.cc'], ['include', '^browser/ui/views/bubble/border_contents.cc'], ['include', '^browser/ui/views/bubble/border_contents.h'], ['include', '^browser/ui/views/bubble/bubble.cc'], @@ -4760,8 +4749,6 @@ ['include', '^browser/ui/views/find_bar_view.cc'], ['include', '^browser/ui/views/find_bar_view.h'], ['include', '^browser/ui/views/first_run_bubble.cc'], - ['include', '^browser/ui/views/frame/browser_bubble_host.cc'], - ['include', '^browser/ui/views/frame/browser_bubble_host.h'], ['include', '^browser/ui/views/frame/browser_frame.cc'], ['include', '^browser/ui/views/frame/browser_frame.h'], ['include', '^browser/ui/views/frame/browser_frame_gtk.cc'], @@ -5120,7 +5107,6 @@ ['exclude', '^browser/ui/input_window_dialog.h'], ['exclude', '^browser/ui/input_window_dialog_win.cc'], ['include', '^browser/ui/views/aura/'], - ['include', '^browser/ui/views/browser_bubble_aura.cc'], ['include', '^browser/ui/views/constrained_html_delegate_views.cc'], ['include', '^browser/ui/views/constrained_window_views.cc'], ['include', '^browser/ui/views/dropdown_bar_host_aura.cc'], |