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

Side by Side 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: Feedback Created 5 years, 3 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 unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698