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

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: 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/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..6a6976a8df4022aaba5b82b5b4b8e4fbf8989bdc
--- /dev/null
+++ b/chrome/browser/ui/chrome_bubble_manager.cc
@@ -0,0 +1,51 @@
+// 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/chrome_web_contents_observer.h"
+#include "content/public/browser/web_contents.h"
+
+ChromeBubbleManager::ChromeBubbleManager() {}
+
+ChromeBubbleManager::~ChromeBubbleManager() {}
+
+void ChromeBubbleManager::ListenToWebContents(
+ content::WebContents* web_contents) {
+ ChromeWebContentsObserver::CreateForWebContents(web_contents);
+ ChromeWebContentsObserver::FromWebContents(web_contents)
+ ->SetBubbleManager(this);
+}
+
+void ChromeBubbleManager::FullscreenToggle(content::WebContents* context) {
+ UpdateMatchingBubbles(context);
+}
+
+void ChromeBubbleManager::TabBlur(content::WebContents* context) {
+ HideMatchingBubbles(context, BUBBLE_CLOSE_TABSWITCH);
+}
+
+void ChromeBubbleManager::TabFocus(content::WebContents* context) {
+ // TODO(hcarmona): Figure out when bubbles should be re-shown.
+ // ShowMatchingBubbles(context);
please use gerrit instead 2015/08/05 18:05:25 Why does ShowMatchingBubbles(context); not work?
hcarmona 2015/08/05 18:43:47 Showing bubbles is easy. Figuring out which bubble
+}
+
+void ChromeBubbleManager::TabDetached(content::WebContents* context) {
+ HideMatchingBubbles(context, BUBBLE_CLOSE_TABSWITCH);
+}
+
+void ChromeBubbleManager::NavigationEntryCommitted(
+ content::WebContents* context,
+ const content::LoadCommittedDetails& details) {
+ // Hide bubbles if the URL changes or the page is refreshed.
+ if (!details.is_in_page ||
+ details.type == content::NAVIGATION_TYPE_SAME_PAGE ||
+ details.type == content::NAVIGATION_TYPE_EXISTING_PAGE) {
+ HideMatchingBubbles(context, BUBBLE_CLOSE_IGNORE);
+ }
+}
+
+void ChromeBubbleManager::WebContentsDestroyed(content::WebContents* context) {
+ HideMatchingBubbles(context, BUBBLE_CLOSE_IGNORE);
+}

Powered by Google App Engine
This is Rietveld 408576698