From cff386ccf5eb4de8bc409b85da0855e610824b24 Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Tue, 19 Jan 2010 21:09:14 +0000 Subject: Port BrowserActionApiTest.BrowserActionPopup to linux. Also make the test proprely wait for the EXTENSION_HOST_DID_STOP_LOADING signal. BUG=29710 TEST=compiles Review URL: http://codereview.chromium.org/515065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36544 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/extension_popup_gtk.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'chrome/browser/gtk/extension_popup_gtk.cc') diff --git a/chrome/browser/gtk/extension_popup_gtk.cc b/chrome/browser/gtk/extension_popup_gtk.cc index e14ff90..75fab2df 100644 --- a/chrome/browser/gtk/extension_popup_gtk.cc +++ b/chrome/browser/gtk/extension_popup_gtk.cc @@ -16,6 +16,8 @@ #include "chrome/common/notification_service.h" #include "googleurl/src/gurl.h" +ExtensionPopupGtk* ExtensionPopupGtk::current_extension_popup_ = NULL; + ExtensionPopupGtk::ExtensionPopupGtk(Browser* browser, ExtensionHost* host, const gfx::Rect& relative_to) @@ -61,6 +63,10 @@ void ExtensionPopupGtk::ShowPopup() { return; } + // Only one instance should be showing at a time. + DCHECK(!current_extension_popup_); + current_extension_popup_ = this; + // We'll be in the upper-right corner of the window for LTR languages, so we // want to put the arrow at the upper-right corner of the bubble to match the // page and app menus. @@ -77,17 +83,19 @@ void ExtensionPopupGtk::ShowPopup() { this); } -void ExtensionPopupGtk::DestroyPopup() { +bool ExtensionPopupGtk::DestroyPopup() { if (!bubble_) { NOTREACHED(); - return; + return false; } bubble_->Close(); + return true; } void ExtensionPopupGtk::InfoBubbleClosing(InfoBubbleGtk* bubble, bool closed_by_escape) { + current_extension_popup_ = NULL; delete this; } @@ -104,3 +112,7 @@ void ExtensionPopupGtk::Show(const GURL& url, Browser* browser, // This object will delete itself when the info bubble is closed. new ExtensionPopupGtk(browser, host, relative_to); } + +gfx::Rect ExtensionPopupGtk::GetViewBounds() { + return gfx::Rect(host_->view()->native_view()->allocation); +} -- cgit v1.1