| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/ui/chrome_bubble_manager.h" |
| 6 |
| 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" |
| 10 |
| 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); |
| 16 } |
| 17 |
| 18 ChromeBubbleManager::~ChromeBubbleManager() { |
| 19 tab_strip_model_->RemoveObserver(this); |
| 20 } |
| 21 |
| 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(); |
| 27 } |
| 28 |
| 29 void ChromeBubbleManager::TabDeactivated(content::WebContents* contents) { |
| 30 CloseAllBubbles(BUBBLE_CLOSE_TABSWITCHED); |
| 31 } |
| 32 |
| 33 void ChromeBubbleManager::ActiveTabChanged(content::WebContents* old_contents, |
| 34 content::WebContents* new_contents, |
| 35 int index, |
| 36 int reason) { |
| 37 Observe(new_contents); |
| 38 } |
| 39 |
| 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(); |
| 45 } |
| 46 |
| 47 void ChromeBubbleManager::NavigationEntryCommitted( |
| 48 const content::LoadCommittedDetails& load_details) { |
| 49 CloseAllBubbles(BUBBLE_CLOSE_NAVIGATED); |
| 50 } |
| OLD | NEW |