Chromium Code Reviews| 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); |
| +} |