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

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: gn nit 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/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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/chrome_bubble_manager.h ('k') | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698