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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 1130603005: [PermissionBubble] Remove bubble from previous manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Managers can be NULL at shutdown - account for that. Created 5 years, 7 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
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index b176b641400a2f937443ab322da898476ab793bf..b33ec488621ba561c59ebb17e5724564451745a7 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -395,9 +395,6 @@ using content::WebContents;
// Create the bridge for the status bubble.
statusBubble_ = new StatusBubbleMac([self window], self);
- // Create the permissions bubble.
- permissionBubbleCocoa_.reset(new PermissionBubbleCocoa([self window]));
-
// Register for application hide/unhide notifications.
[[NSNotificationCenter defaultCenter]
addObserver:self
@@ -1269,6 +1266,26 @@ using content::WebContents;
[toolbarController_ setTranslateIconLit:on];
}
+- (void)onActiveTabChanged:(content::WebContents*)oldContents
rohitrao (ping after 24h) 2015/05/15 18:38:02 How is this different from onActivateTabWithConten
groby-ooo-7-16 2015/05/15 19:06:58 onActivateTabWithContents is called at a very spec
+ to:(content::WebContents*)newContents {
+ // No need to remove previous bubble. It will close itself.
+ PermissionBubbleManager* manager(nullptr);
+ if (oldContents) {
+ manager = PermissionBubbleManager::FromWebContents(oldContents);
+ if (manager)
+ manager->SetView(nullptr);
+ }
+
+ if (newContents) {
+ if (!permissionBubbleCocoa_.get()) {
+ permissionBubbleCocoa_.reset(new PermissionBubbleCocoa([self window]));
+ }
+ manager = PermissionBubbleManager::FromWebContents(newContents);
+ if (manager)
+ manager->SetView(permissionBubbleCocoa_.get());
+ }
+}
+
- (void)zoomChangedForActiveTab:(BOOL)canShowBubble {
[toolbarController_ zoomChangedForActiveTab:canShowBubble];
}
@@ -1651,14 +1668,6 @@ using content::WebContents;
[infoBarContainerController_ changeWebContents:contents];
- // No need to remove previous bubble. It will close itself.
- // TODO(leng): The PermissionBubbleManager for the previous contents should
- // have SetView(NULL) called. Fix this when the previous contents are
- // available here or move to BrowserWindowCocoa::OnActiveTabChanged().
- // crbug.com/340720
- PermissionBubbleManager::FromWebContents(contents)->SetView(
- permissionBubbleCocoa_.get());
-
// Must do this after bookmark and infobar updates to avoid
// unnecesary resize in contents.
[devToolsController_ updateDevToolsForWebContents:contents
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698