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