Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_view.cc |
| diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc |
| index aafd2a700a3ef5181fd7640a782098d4081cf0c8..86cc0b826b466f353f9e818cd9949ea547d2df3a 100644 |
| --- a/chrome/browser/ui/views/frame/browser_view.cc |
| +++ b/chrome/browser/ui/views/frame/browser_view.cc |
| @@ -51,6 +51,8 @@ |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_list.h" |
| #include "chrome/browser/ui/browser_window_state.h" |
| +#include "chrome/browser/ui/chrome_bubble_manager.h" |
| +#include "chrome/browser/ui/chrome_bubble_manager_factory.h" |
| #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| #include "chrome/browser/ui/search/search_delegate.h" |
| @@ -870,14 +872,18 @@ void BrowserView::OnActiveTabChanged(content::WebContents* old_contents, |
| infobar_container_->ChangeInfoBarManager( |
| InfoBarService::FromWebContents(new_contents)); |
| - if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) |
| - PermissionBubbleManager::FromWebContents(old_contents)->HideBubble(); |
|
groby-ooo-7-16
2015/08/06 21:32:56
Who's invoking the HideBubble behavior now?
hcarmona
2015/08/07 02:12:58
This was redundant because TabDeactivated is alway
|
| - |
| - if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { |
| - PermissionBubbleManager::FromWebContents(new_contents) |
| - ->DisplayPendingRequests(browser_.get()); |
| + if (new_contents) { |
| + PermissionBubbleManager* manager = |
| + PermissionBubbleManager::FromWebContents(new_contents); |
| + if (manager) |
| + manager->SetBrowser(browser_.get()); |
|
groby-ooo-7-16
2015/08/06 21:32:56
Why do we need to update the browser here, just fo
hcarmona
2015/08/07 02:12:58
Yes, changing the tab can make the PBM have a diff
|
| } |
| + ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile()) |
| + ->ListenToWebContents(new_contents); |
| + ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile()) |
| + ->TabFocus(new_contents); |
| + |
| UpdateUIForContents(new_contents); |
| // Layout for DevTools _before_ setting the both main and devtools WebContents |
| @@ -1559,8 +1565,8 @@ void BrowserView::TabInsertedAt(WebContents* contents, |
| } |
| void BrowserView::TabDetachedAt(WebContents* contents, int index) { |
| - if (PermissionBubbleManager::FromWebContents(contents)) |
| - PermissionBubbleManager::FromWebContents(contents)->HideBubble(); |
| + ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile()) |
|
groby-ooo-7-16
2015/08/06 21:32:56
I'm wondering if ChromeBubbleManager shouldn't jus
hcarmona
2015/08/07 02:12:58
Sounds good. It would let us remove all the code f
|
| + ->TabDetached(contents); |
| // We use index here rather than comparing |contents| because by this time |
| // the model has already removed |contents| from its list, so |
| @@ -1577,8 +1583,8 @@ void BrowserView::TabDetachedAt(WebContents* contents, int index) { |
| } |
| void BrowserView::TabDeactivated(WebContents* contents) { |
| - if (PermissionBubbleManager::FromWebContents(contents)) |
| - PermissionBubbleManager::FromWebContents(contents)->HideBubble(); |
| + ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile()) |
| + ->TabBlur(contents); |
| // We do not store the focus when closing the tab to work-around bug 4633. |
| // Some reports seem to show that the focus manager and/or focused view can |
| @@ -2319,8 +2325,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen, |
| ToolbarSizeChanged(false); |
| WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); |
| - if (contents && PermissionBubbleManager::FromWebContents(contents)) |
| - PermissionBubbleManager::FromWebContents(contents)->UpdateAnchorPosition(); |
| + ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile()) |
| + ->FullscreenToggle(contents); |
| } |
| bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { |