OLD | NEW |
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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // BrowserStatusMonitor monitors creation/deletion of Browser and its | 32 // BrowserStatusMonitor monitors creation/deletion of Browser and its |
33 // TabStripModel to keep the launcher representation up to date as the | 33 // TabStripModel to keep the launcher representation up to date as the |
34 // active tab changes. | 34 // active tab changes. |
35 class BrowserStatusMonitor : public aura::client::ActivationChangeObserver, | 35 class BrowserStatusMonitor : public aura::client::ActivationChangeObserver, |
36 public aura::WindowObserver, | 36 public aura::WindowObserver, |
37 public chrome::BrowserListObserver, | 37 public chrome::BrowserListObserver, |
38 public gfx::DisplayObserver, | 38 public gfx::DisplayObserver, |
39 public TabStripModelObserver { | 39 public TabStripModelObserver { |
40 public: | 40 public: |
41 explicit BrowserStatusMonitor(ChromeLauncherController* launcher_controller); | 41 explicit BrowserStatusMonitor(ChromeLauncherController* launcher_controller); |
42 virtual ~BrowserStatusMonitor(); | 42 ~BrowserStatusMonitor() override; |
43 | 43 |
44 // A function which gets called when the current user has changed. | 44 // A function which gets called when the current user has changed. |
45 // Note that this function is called by the ChromeLauncherController to be | 45 // Note that this function is called by the ChromeLauncherController to be |
46 // able to do the activation in a proper order - rather then setting an | 46 // able to do the activation in a proper order - rather then setting an |
47 // observer. | 47 // observer. |
48 virtual void ActiveUserChanged(const std::string& user_email) {} | 48 virtual void ActiveUserChanged(const std::string& user_email) {} |
49 | 49 |
50 // A shortcut to call the ChromeLauncherController's UpdateAppState(). | 50 // A shortcut to call the ChromeLauncherController's UpdateAppState(). |
51 void UpdateAppItemState(content::WebContents* contents, | 51 void UpdateAppItemState(content::WebContents* contents, |
52 ChromeLauncherController::AppState app_state); | 52 ChromeLauncherController::AppState app_state); |
53 | 53 |
54 // A shortcut to call the BrowserShortcutLauncherItemController's | 54 // A shortcut to call the BrowserShortcutLauncherItemController's |
55 // UpdateBrowserItemState(). | 55 // UpdateBrowserItemState(). |
56 void UpdateBrowserItemState(); | 56 void UpdateBrowserItemState(); |
57 | 57 |
58 // aura::client::ActivationChangeObserver overrides: | 58 // aura::client::ActivationChangeObserver overrides: |
59 virtual void OnWindowActivated(aura::Window* gained_active, | 59 void OnWindowActivated(aura::Window* gained_active, |
60 aura::Window* lost_active) override; | 60 aura::Window* lost_active) override; |
61 | 61 |
62 // aura::WindowObserver overrides: | 62 // aura::WindowObserver overrides: |
63 virtual void OnWindowDestroyed(aura::Window* window) override; | 63 void OnWindowDestroyed(aura::Window* window) override; |
64 | 64 |
65 // chrome::BrowserListObserver overrides: | 65 // chrome::BrowserListObserver overrides: |
66 virtual void OnBrowserAdded(Browser* browser) override; | 66 void OnBrowserAdded(Browser* browser) override; |
67 virtual void OnBrowserRemoved(Browser* browser) override; | 67 void OnBrowserRemoved(Browser* browser) override; |
68 | 68 |
69 // gfx::DisplayObserver overrides: | 69 // gfx::DisplayObserver overrides: |
70 virtual void OnDisplayAdded(const gfx::Display& new_display) override; | 70 void OnDisplayAdded(const gfx::Display& new_display) override; |
71 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; | 71 void OnDisplayRemoved(const gfx::Display& old_display) override; |
72 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 72 void OnDisplayMetricsChanged(const gfx::Display& display, |
73 uint32_t metrics) override; | 73 uint32_t metrics) override; |
74 | 74 |
75 // TabStripModelObserver overrides: | 75 // TabStripModelObserver overrides: |
76 virtual void ActiveTabChanged(content::WebContents* old_contents, | 76 void ActiveTabChanged(content::WebContents* old_contents, |
77 content::WebContents* new_contents, | 77 content::WebContents* new_contents, |
78 int index, | 78 int index, |
79 int reason) override; | 79 int reason) override; |
80 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 80 void TabReplacedAt(TabStripModel* tab_strip_model, |
81 content::WebContents* old_contents, | 81 content::WebContents* old_contents, |
82 content::WebContents* new_contents, | 82 content::WebContents* new_contents, |
83 int index) override; | 83 int index) override; |
84 virtual void TabInsertedAt(content::WebContents* contents, | 84 void TabInsertedAt(content::WebContents* contents, |
85 int index, | 85 int index, |
86 bool foreground) override; | 86 bool foreground) override; |
87 virtual void TabClosingAt(TabStripModel* tab_strip_mode, | 87 void TabClosingAt(TabStripModel* tab_strip_mode, |
88 content::WebContents* contents, | 88 content::WebContents* contents, |
89 int index) override; | 89 int index) override; |
90 | 90 |
91 // Called from our own |LocalWebContentsObserver| when web contents did go | 91 // Called from our own |LocalWebContentsObserver| when web contents did go |
92 // away without any other notification. This might happen in case of | 92 // away without any other notification. This might happen in case of |
93 // application uninstalls, page crashes, ...). | 93 // application uninstalls, page crashes, ...). |
94 void WebContentsDestroyed(content::WebContents* web_contents); | 94 void WebContentsDestroyed(content::WebContents* web_contents); |
95 | 95 |
96 protected: | 96 protected: |
97 // Add a V1 application to the shelf. This can get overwritten for multi | 97 // Add a V1 application to the shelf. This can get overwritten for multi |
98 // profile implementations. | 98 // profile implementations. |
99 virtual void AddV1AppToShelf(Browser* browser); | 99 virtual void AddV1AppToShelf(Browser* browser); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; | 136 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; |
137 | 137 |
138 BrowserToAppIDMap browser_to_app_id_map_; | 138 BrowserToAppIDMap browser_to_app_id_map_; |
139 WebContentsToObserverMap webcontents_to_observer_map_; | 139 WebContentsToObserverMap webcontents_to_observer_map_; |
140 scoped_ptr<SettingsWindowObserver> settings_window_observer_; | 140 scoped_ptr<SettingsWindowObserver> settings_window_observer_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(BrowserStatusMonitor); | 142 DISALLOW_COPY_AND_ASSIGN(BrowserStatusMonitor); |
143 }; | 143 }; |
144 | 144 |
145 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_ | 145 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_STATUS_MONITOR_H_ |
OLD | NEW |