| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if (app_state == ChromeLauncherController::APP_STATE_REMOVED || | 157 if (app_state == ChromeLauncherController::APP_STATE_REMOVED || |
| 158 (browser && launcher_controller_->IsBrowserFromActiveUser(browser))) | 158 (browser && launcher_controller_->IsBrowserFromActiveUser(browser))) |
| 159 launcher_controller_->UpdateAppState(contents, app_state); | 159 launcher_controller_->UpdateAppState(contents, app_state); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void BrowserStatusMonitor::UpdateBrowserItemState() { | 162 void BrowserStatusMonitor::UpdateBrowserItemState() { |
| 163 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 163 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
| 164 UpdateBrowserItemState(); | 164 UpdateBrowserItemState(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void BrowserStatusMonitor::OnWindowActivated(aura::Window* gained_active, | 167 void BrowserStatusMonitor::OnWindowActivated( |
| 168 aura::Window* lost_active) { | 168 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 169 aura::Window* gained_active, |
| 170 aura::Window* lost_active) { |
| 169 Browser* browser = NULL; | 171 Browser* browser = NULL; |
| 170 content::WebContents* contents_from_gained = NULL; | 172 content::WebContents* contents_from_gained = NULL; |
| 171 content::WebContents* contents_from_lost = NULL; | 173 content::WebContents* contents_from_lost = NULL; |
| 172 // Update active webcontents's app item state of |lost_active|, if existed. | 174 // Update active webcontents's app item state of |lost_active|, if existed. |
| 173 if (lost_active) { | 175 if (lost_active) { |
| 174 browser = chrome::FindBrowserWithWindow(lost_active); | 176 browser = chrome::FindBrowserWithWindow(lost_active); |
| 175 if (browser) | 177 if (browser) |
| 176 contents_from_lost = browser->tab_strip_model()->GetActiveWebContents(); | 178 contents_from_lost = browser->tab_strip_model()->GetActiveWebContents(); |
| 177 if (contents_from_lost) { | 179 if (contents_from_lost) { |
| 178 UpdateAppItemState( | 180 UpdateAppItemState( |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 content::WebContents* contents) { | 389 content::WebContents* contents) { |
| 388 return launcher_controller_->GetShelfIDForWebContents(contents); | 390 return launcher_controller_->GetShelfIDForWebContents(contents); |
| 389 } | 391 } |
| 390 | 392 |
| 391 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( | 393 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( |
| 392 Browser* browser, | 394 Browser* browser, |
| 393 content::WebContents* web_contents) { | 395 content::WebContents* web_contents) { |
| 394 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 396 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
| 395 SetShelfIDForBrowserWindowContents(browser, web_contents); | 397 SetShelfIDForBrowserWindowContents(browser, web_contents); |
| 396 } | 398 } |
| OLD | NEW |