| 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/web_contents.h" |
| 9 |
| 10 ChromeBubbleManager::ChromeBubbleManager(TabStripModel* tab_strip_model) |
| 11 : tab_strip_model_(tab_strip_model) { |
| 12 DCHECK(tab_strip_model_); |
| 13 tab_strip_model_->AddObserver(this); |
| 14 } |
| 15 |
| 16 ChromeBubbleManager::~ChromeBubbleManager() { |
| 17 tab_strip_model_->RemoveObserver(this); |
| 18 } |
| 19 |
| 20 void ChromeBubbleManager::TabDetachedAt(content::WebContents* contents, |
| 21 int index) { |
| 22 CloseAllBubbles(BUBBLE_CLOSE_TABDETACHED); |
| 23 // Any bubble that didn't close should update its anchor position. |
| 24 UpdateAllBubbleAnchors(); |
| 25 } |
| 26 |
| 27 void ChromeBubbleManager::TabDeactivated(content::WebContents* contents) { |
| 28 CloseAllBubbles(BUBBLE_CLOSE_TABSWITCHED); |
| 29 } |
| 30 |
| 31 void ChromeBubbleManager::ActiveTabChanged(content::WebContents* old_contents, |
| 32 content::WebContents* new_contents, |
| 33 int index, |
| 34 int reason) { |
| 35 Observe(new_contents); |
| 36 } |
| 37 |
| 38 void ChromeBubbleManager::DidToggleFullscreenModeForTab( |
| 39 bool entered_fullscreen) { |
| 40 CloseAllBubbles(BUBBLE_CLOSE_FULLSCREEN_TOGGLED); |
| 41 // Any bubble that didn't close should update its anchor position. |
| 42 UpdateAllBubbleAnchors(); |
| 43 } |
| 44 |
| 45 void ChromeBubbleManager::NavigationEntryCommitted( |
| 46 const content::LoadCommittedDetails& load_details) { |
| 47 CloseAllBubbles(BUBBLE_CLOSE_NAVIGATED); |
| 48 } |
| OLD | NEW |