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

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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..f965fb65adafc3ff42c8cc86cb5f0be6c4ecf7a6 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -870,12 +870,17 @@ 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();
-
- if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) {
- PermissionBubbleManager::FromWebContents(new_contents)
- ->DisplayPendingRequests(browser_.get());
+ browser_->bubble_manager()->ListenToWebContents(new_contents);
+ browser_->bubble_manager()->TabFocus(new_contents);
+
+ // TODO(hcarmona): Move the re-showing logic into the bubble manager.
+ if (new_contents) {
+ PermissionBubbleManager* manager =
+ PermissionBubbleManager::FromWebContents(new_contents);
+ if (manager) {
+ manager->SetBrowser(browser_.get());
+ manager->DisplayPendingRequests();
+ }
}
UpdateUIForContents(new_contents);
@@ -1559,8 +1564,7 @@ void BrowserView::TabInsertedAt(WebContents* contents,
}
void BrowserView::TabDetachedAt(WebContents* contents, int index) {
- if (PermissionBubbleManager::FromWebContents(contents))
- PermissionBubbleManager::FromWebContents(contents)->HideBubble();
+ browser_->bubble_manager()->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 +1581,7 @@ void BrowserView::TabDetachedAt(WebContents* contents, int index) {
}
void BrowserView::TabDeactivated(WebContents* contents) {
- if (PermissionBubbleManager::FromWebContents(contents))
- PermissionBubbleManager::FromWebContents(contents)->HideBubble();
+ browser_->bubble_manager()->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 +2322,7 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
ToolbarSizeChanged(false);
WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents();
- if (contents && PermissionBubbleManager::FromWebContents(contents))
- PermissionBubbleManager::FromWebContents(contents)->UpdateAnchorPosition();
+ browser_->bubble_manager()->FullscreenToggle(contents);
}
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {

Powered by Google App Engine
This is Rietveld 408576698