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 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
6 | 6 |
7 #include "ash/shelf/shelf_util.h" | 7 #include "ash/shelf/shelf_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return; | 220 return; |
221 | 221 |
222 if (browser->is_type_popup() && browser->is_app()) | 222 if (browser->is_type_popup() && browser->is_app()) |
223 RemoveV1AppFromShelf(browser); | 223 RemoveV1AppFromShelf(browser); |
224 else | 224 else |
225 browser->tab_strip_model()->RemoveObserver(this); | 225 browser->tab_strip_model()->RemoveObserver(this); |
226 | 226 |
227 UpdateBrowserItemState(); | 227 UpdateBrowserItemState(); |
228 } | 228 } |
229 | 229 |
230 void BrowserStatusMonitor::OnDisplayBoundsChanged( | |
231 const gfx::Display& display) { | |
232 // Do nothing here. | |
233 } | |
234 | |
235 void BrowserStatusMonitor::OnDisplayAdded(const gfx::Display& new_display) { | 230 void BrowserStatusMonitor::OnDisplayAdded(const gfx::Display& new_display) { |
236 // Add a new RootWindow and its ActivationClient to observed list. | 231 // Add a new RootWindow and its ActivationClient to observed list. |
237 aura::Window* root_window = ash::Shell::GetInstance()-> | 232 aura::Window* root_window = ash::Shell::GetInstance()-> |
238 display_controller()->GetRootWindowForDisplayId(new_display.id()); | 233 display_controller()->GetRootWindowForDisplayId(new_display.id()); |
239 // When the primary root window's display get removed, the existing root | 234 // When the primary root window's display get removed, the existing root |
240 // window is taken over by the new display and the observer is already set. | 235 // window is taken over by the new display and the observer is already set. |
241 if (!observed_root_windows_.IsObserving(root_window)) { | 236 if (!observed_root_windows_.IsObserving(root_window)) { |
242 observed_root_windows_.Add(static_cast<aura::Window*>(root_window)); | 237 observed_root_windows_.Add(static_cast<aura::Window*>(root_window)); |
243 observed_activation_clients_.Add( | 238 observed_activation_clients_.Add( |
244 aura::client::GetActivationClient(root_window)); | 239 aura::client::GetActivationClient(root_window)); |
245 } | 240 } |
246 } | 241 } |
247 | 242 |
248 void BrowserStatusMonitor::OnDisplayRemoved(const gfx::Display& old_display) { | 243 void BrowserStatusMonitor::OnDisplayRemoved(const gfx::Display& old_display) { |
249 // When this is called, RootWindow of |old_display| is already removed. | 244 // When this is called, RootWindow of |old_display| is already removed. |
250 // Instead, we can remove RootWindow and its ActivationClient in the | 245 // Instead, we can remove RootWindow and its ActivationClient in the |
251 // OnWindowRemoved(). | 246 // OnWindowRemoved(). |
252 // Do nothing here. | 247 // Do nothing here. |
253 } | 248 } |
254 | 249 |
| 250 void BrowserStatusMonitor::OnDisplayMetricsChanged( |
| 251 const gfx::Display&, DisplayObserver::DisplayMetrics) { |
| 252 // Do nothing here. |
| 253 } |
| 254 |
255 void BrowserStatusMonitor::ActiveTabChanged(content::WebContents* old_contents, | 255 void BrowserStatusMonitor::ActiveTabChanged(content::WebContents* old_contents, |
256 content::WebContents* new_contents, | 256 content::WebContents* new_contents, |
257 int index, | 257 int index, |
258 int reason) { | 258 int reason) { |
259 Browser* browser = NULL; | 259 Browser* browser = NULL; |
260 // Use |new_contents|. |old_contents| could be NULL. | 260 // Use |new_contents|. |old_contents| could be NULL. |
261 DCHECK(new_contents); | 261 DCHECK(new_contents); |
262 browser = chrome::FindBrowserWithWebContents(new_contents); | 262 browser = chrome::FindBrowserWithWebContents(new_contents); |
263 | 263 |
264 if (browser && browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) | 264 if (browser && browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 content::WebContents* contents) { | 384 content::WebContents* contents) { |
385 return launcher_controller_->GetShelfIDForWebContents(contents); | 385 return launcher_controller_->GetShelfIDForWebContents(contents); |
386 } | 386 } |
387 | 387 |
388 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( | 388 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( |
389 Browser* browser, | 389 Browser* browser, |
390 content::WebContents* web_contents) { | 390 content::WebContents* web_contents) { |
391 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 391 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
392 SetShelfIDForBrowserWindowContents(browser, web_contents); | 392 SetShelfIDForBrowserWindowContents(browser, web_contents); |
393 } | 393 } |
OLD | NEW |