Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / chrome_bubble_manager.cc
blob60d3f42d1b21997b39a1447cbcf56aeb66c11dab
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/chrome_bubble_manager.h"
7 #include "chrome/browser/ui/tabs/tab_strip_model.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/web_contents.h"
11 ChromeBubbleManager::ChromeBubbleManager(TabStripModel* tab_strip_model)
12 : tab_strip_model_(tab_strip_model) {
13 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
14 DCHECK(tab_strip_model_);
15 tab_strip_model_->AddObserver(this);
18 ChromeBubbleManager::~ChromeBubbleManager() {
19 tab_strip_model_->RemoveObserver(this);
22 void ChromeBubbleManager::TabDetachedAt(content::WebContents* contents,
23 int index) {
24 CloseAllBubbles(BUBBLE_CLOSE_TABDETACHED);
25 // Any bubble that didn't close should update its anchor position.
26 UpdateAllBubbleAnchors();
29 void ChromeBubbleManager::TabDeactivated(content::WebContents* contents) {
30 CloseAllBubbles(BUBBLE_CLOSE_TABSWITCHED);
33 void ChromeBubbleManager::ActiveTabChanged(content::WebContents* old_contents,
34 content::WebContents* new_contents,
35 int index,
36 int reason) {
37 Observe(new_contents);
40 void ChromeBubbleManager::DidToggleFullscreenModeForTab(
41 bool entered_fullscreen) {
42 CloseAllBubbles(BUBBLE_CLOSE_FULLSCREEN_TOGGLED);
43 // Any bubble that didn't close should update its anchor position.
44 UpdateAllBubbleAnchors();
47 void ChromeBubbleManager::NavigationEntryCommitted(
48 const content::LoadCommittedDetails& load_details) {
49 CloseAllBubbles(BUBBLE_CLOSE_NAVIGATED);