diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 23:31:07 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 23:31:07 +0000 |
commit | e831ec341c403862b0123184efa5d382a40ab62f (patch) | |
tree | 957b62c0937b08222de8dd06b92b10e3d895ab06 | |
parent | d2e2ccf29df48310fbffb3b9d38463872bd28d17 (diff) | |
download | chromium_src-e831ec341c403862b0123184efa5d382a40ab62f.zip chromium_src-e831ec341c403862b0123184efa5d382a40ab62f.tar.gz chromium_src-e831ec341c403862b0123184efa5d382a40ab62f.tar.bz2 |
Reveal the toolbar (and the remainder of the top chrome) for:
- The bubble which notifies the extension is installed
- The bubble for browser actions and page actions.
The bubbles are anchored to the toolbar so not showing the top chrome when the bubbles are visible is weird.
BUG=250708
TEST=Manual
Review URL: https://chromiumcodereview.appspot.com/17293003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207952 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 32 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index abb0c06..7d43187 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -23,6 +23,7 @@ #include "chrome/browser/ui/views/browser_action_view.h" #include "chrome/browser/ui/views/browser_actions_container.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/frame/immersive_mode_controller.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar_view.h" @@ -653,6 +654,15 @@ void ExtensionInstalledBubble::ShowInternal() { SetLayoutManager(new views::FillLayout()); AddChildView( new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); + + // If we are in immersive fullscreen, reveal the top-of-window views + // (omnibox, toolbar) so that the view the bubble is anchored to is visible. + // We do not need to hold onto the lock because ImmersiveModeController will + // keep the top-of-window views revealed as long as the popup is active. + // TODO(pkotwicz): Move logic to ImmersiveModeController. + scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( + browser_view->immersive_mode_controller()->GetRevealedLock( + ImmersiveModeController::ANIMATE_REVEAL_NO)); views::BubbleDelegateView::CreateBubble(this); // The bubble widget is now the parent and owner of |this| and takes care of diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index d02e840..0c36f22 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -13,6 +13,9 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/frame/immersive_mode_controller.h" +#include "chrome/browser/ui/views/frame/top_container_view.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_manager.h" @@ -67,6 +70,7 @@ ExtensionPopup::ExtensionPopup(Browser* browser, views::BubbleBorder::Arrow arrow, ShowAction show_action) : BubbleDelegateView(anchor_view, arrow), + browser_(browser), extension_host_(host), devtools_callback_(base::Bind( &ExtensionPopup::OnDevToolsStateChanged, base::Unretained(this))) { @@ -193,6 +197,21 @@ ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url, } void ExtensionPopup::ShowBubble() { + BrowserView* browser_view = browser_ ? + BrowserView::GetBrowserViewForBrowser(browser_) : NULL; + scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock; + if (browser_view && + browser_view->top_container()->Contains(anchor_view())) { + // If we are in immersive fullscreen and we are anchored to a view in the + // top-of-window views (eg omnibox, toolbar), trigger an immersive reveal. + // We do not need to hold onto the lock because ImmersiveModeController will + // keep the top-of-window views revealed as long as the popup is active. + // TODO(pkotwicz): Move logic to ImmersiveModeController. + immersive_reveal_lock.reset( + browser_view->immersive_mode_controller()->GetRevealedLock( + ImmersiveModeController::ANIMATE_REVEAL_NO)); + SizeToContents(); + } GetWidget()->Show(); // Focus on the host contents when the bubble is first shown. diff --git a/chrome/browser/ui/views/extensions/extension_popup.h b/chrome/browser/ui/views/extensions/extension_popup.h index f8b3237..b3b031a 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.h +++ b/chrome/browser/ui/views/extensions/extension_popup.h @@ -84,6 +84,9 @@ class ExtensionPopup : public views::BubbleDelegateView, void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); + // The browser to which the popup is anchored. Not owned. + Browser* browser_; + // The contained host for the view. scoped_ptr<extensions::ExtensionHost> extension_host_; |