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

Side by Side Diff: chrome/browser/ui/ash/launcher/browser_status_monitor.h

Issue 2185743002: Remove ash::ScopedObserverWithDuplicatedSources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 12
13 #include "ash/shelf/scoped_observer_with_duplicated_sources.h"
14 #include "base/compiler_specific.h"
15 #include "base/macros.h" 13 #include "base/macros.h"
16 #include "base/scoped_observer.h"
17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
18 #include "chrome/browser/ui/browser_list_observer.h" 15 #include "chrome/browser/ui/browser_list_observer.h"
19 #include "chrome/browser/ui/browser_tab_strip_tracker.h" 16 #include "chrome/browser/ui/browser_tab_strip_tracker.h"
20 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h" 17 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
22 #include "ui/aura/window_observer.h"
23 #include "ui/display/display_observer.h"
24 #include "ui/wm/public/activation_change_observer.h" 19 #include "ui/wm/public/activation_change_observer.h"
25 20
26 namespace aura { 21 namespace aura {
27 class Window; 22 class Window;
28
29 namespace client {
30 class ActivationClient;
31 }
32 } // namespace aura 23 } // namespace aura
33 24
34 class Browser; 25 class Browser;
35 26
36 // BrowserStatusMonitor monitors creation/deletion of Browser and its 27 // BrowserStatusMonitor monitors creation/deletion of Browser and its
37 // TabStripModel to keep the launcher representation up to date as the 28 // TabStripModel to keep the launcher representation up to date as the
38 // active tab changes. 29 // active tab changes.
39 class BrowserStatusMonitor : public aura::client::ActivationChangeObserver, 30 class BrowserStatusMonitor : public aura::client::ActivationChangeObserver,
40 public aura::WindowObserver,
41 public BrowserTabStripTrackerDelegate, 31 public BrowserTabStripTrackerDelegate,
42 public chrome::BrowserListObserver, 32 public chrome::BrowserListObserver,
43 public display::DisplayObserver,
44 public TabStripModelObserver { 33 public TabStripModelObserver {
45 public: 34 public:
46 explicit BrowserStatusMonitor(ChromeLauncherController* launcher_controller); 35 explicit BrowserStatusMonitor(ChromeLauncherController* launcher_controller);
47 ~BrowserStatusMonitor() override; 36 ~BrowserStatusMonitor() override;
48 37
49 // A function which gets called when the current user has changed. 38 // A function which gets called when the current user has changed.
50 // Note that this function is called by the ChromeLauncherController to be 39 // Note that this function is called by the ChromeLauncherController to be
51 // able to do the activation in a proper order - rather then setting an 40 // able to do the activation in a proper order - rather then setting an
52 // observer. 41 // observer.
53 virtual void ActiveUserChanged(const std::string& user_email) {} 42 virtual void ActiveUserChanged(const std::string& user_email) {}
54 43
55 // A shortcut to call the ChromeLauncherController's UpdateAppState(). 44 // A shortcut to call the ChromeLauncherController's UpdateAppState().
56 void UpdateAppItemState(content::WebContents* contents, 45 void UpdateAppItemState(content::WebContents* contents,
57 ChromeLauncherController::AppState app_state); 46 ChromeLauncherController::AppState app_state);
58 47
59 // A shortcut to call the BrowserShortcutLauncherItemController's 48 // A shortcut to call the BrowserShortcutLauncherItemController's
60 // UpdateBrowserItemState(). 49 // UpdateBrowserItemState().
61 void UpdateBrowserItemState(); 50 void UpdateBrowserItemState();
62 51
63 // aura::client::ActivationChangeObserver overrides: 52 // aura::client::ActivationChangeObserver overrides:
64 void OnWindowActivated( 53 void OnWindowActivated(
65 aura::client::ActivationChangeObserver::ActivationReason reason, 54 aura::client::ActivationChangeObserver::ActivationReason reason,
66 aura::Window* gained_active, 55 aura::Window* gained_active,
67 aura::Window* lost_active) override; 56 aura::Window* lost_active) override;
68 57
69 // aura::WindowObserver overrides:
70 void OnWindowDestroyed(aura::Window* window) override;
71
72 // BrowserTabStripTrackerDelegate overrides: 58 // BrowserTabStripTrackerDelegate overrides:
73 bool ShouldTrackBrowser(Browser* browser) override; 59 bool ShouldTrackBrowser(Browser* browser) override;
74 60
75 // chrome::BrowserListObserver overrides: 61 // chrome::BrowserListObserver overrides:
76 void OnBrowserAdded(Browser* browser) override; 62 void OnBrowserAdded(Browser* browser) override;
77 void OnBrowserRemoved(Browser* browser) override; 63 void OnBrowserRemoved(Browser* browser) override;
78 64
79 // display::DisplayObserver overrides:
80 void OnDisplayAdded(const display::Display& new_display) override;
81 void OnDisplayRemoved(const display::Display& old_display) override;
82 void OnDisplayMetricsChanged(const display::Display& display,
83 uint32_t metrics) override;
84
85 // TabStripModelObserver overrides: 65 // TabStripModelObserver overrides:
86 void ActiveTabChanged(content::WebContents* old_contents, 66 void ActiveTabChanged(content::WebContents* old_contents,
87 content::WebContents* new_contents, 67 content::WebContents* new_contents,
88 int index, 68 int index,
89 int reason) override; 69 int reason) override;
90 void TabReplacedAt(TabStripModel* tab_strip_model, 70 void TabReplacedAt(TabStripModel* tab_strip_model,
91 content::WebContents* old_contents, 71 content::WebContents* old_contents,
92 content::WebContents* new_contents, 72 content::WebContents* new_contents,
93 int index) override; 73 int index) override;
94 void TabInsertedAt(content::WebContents* contents, 74 void TabInsertedAt(content::WebContents* contents,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 111
132 // Returns the ShelfID for |contents|. 112 // Returns the ShelfID for |contents|.
133 ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents); 113 ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents);
134 114
135 // Sets the shelf id for browsers represented by the browser shortcut item. 115 // Sets the shelf id for browsers represented by the browser shortcut item.
136 void SetShelfIDForBrowserWindowContents(Browser* browser, 116 void SetShelfIDForBrowserWindowContents(Browser* browser,
137 content::WebContents* web_contents); 117 content::WebContents* web_contents);
138 118
139 ChromeLauncherController* launcher_controller_; 119 ChromeLauncherController* launcher_controller_;
140 120
141 // Hold all observed activation clients.
142 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient,
143 aura::client::ActivationChangeObserver> observed_activation_clients_;
144
145 // Hold all observed root windows.
146 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_;
147
148 BrowserToAppIDMap browser_to_app_id_map_; 121 BrowserToAppIDMap browser_to_app_id_map_;
149 WebContentsToObserverMap webcontents_to_observer_map_; 122 WebContentsToObserverMap webcontents_to_observer_map_;
150 std::unique_ptr<SettingsWindowObserver> settings_window_observer_; 123 std::unique_ptr<SettingsWindowObserver> settings_window_observer_;
151 124
152 BrowserTabStripTracker browser_tab_strip_tracker_; 125 BrowserTabStripTracker browser_tab_strip_tracker_;
153 126
154 DISALLOW_COPY_AND_ASSIGN(BrowserStatusMonitor); 127 DISALLOW_COPY_AND_ASSIGN(BrowserStatusMonitor);
155 }; 128 };
156 129
157 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_ 130 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698