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

Unified Diff: chrome/browser/ui/chrome_bubble_manager.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: gn nit 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/chrome_bubble_manager.cc
diff --git a/chrome/browser/ui/chrome_bubble_manager.cc b/chrome/browser/ui/chrome_bubble_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..60d3f42d1b21997b39a1447cbcf56aeb66c11dab
--- /dev/null
+++ b/chrome/browser/ui/chrome_bubble_manager.cc
@@ -0,0 +1,50 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/chrome_bubble_manager.h"
+
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/web_contents.h"
+
+ChromeBubbleManager::ChromeBubbleManager(TabStripModel* tab_strip_model)
+ : tab_strip_model_(tab_strip_model) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(tab_strip_model_);
+ tab_strip_model_->AddObserver(this);
+}
+
+ChromeBubbleManager::~ChromeBubbleManager() {
+ tab_strip_model_->RemoveObserver(this);
+}
+
+void ChromeBubbleManager::TabDetachedAt(content::WebContents* contents,
+ int index) {
+ CloseAllBubbles(BUBBLE_CLOSE_TABDETACHED);
+ // Any bubble that didn't close should update its anchor position.
+ UpdateAllBubbleAnchors();
+}
+
+void ChromeBubbleManager::TabDeactivated(content::WebContents* contents) {
+ CloseAllBubbles(BUBBLE_CLOSE_TABSWITCHED);
+}
+
+void ChromeBubbleManager::ActiveTabChanged(content::WebContents* old_contents,
+ content::WebContents* new_contents,
+ int index,
+ int reason) {
+ Observe(new_contents);
+}
+
+void ChromeBubbleManager::DidToggleFullscreenModeForTab(
+ bool entered_fullscreen) {
+ CloseAllBubbles(BUBBLE_CLOSE_FULLSCREEN_TOGGLED);
+ // Any bubble that didn't close should update its anchor position.
+ UpdateAllBubbleAnchors();
+}
+
+void ChromeBubbleManager::NavigationEntryCommitted(
+ const content::LoadCommittedDetails& load_details) {
+ CloseAllBubbles(BUBBLE_CLOSE_NAVIGATED);
+}
« no previous file with comments | « chrome/browser/ui/chrome_bubble_manager.h ('k') | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698