| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 10 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 STLDeleteContainerPairSecondPointers(webcontents_to_observer_map_.begin(), | 92 STLDeleteContainerPairSecondPointers(webcontents_to_observer_map_.begin(), |
| 93 webcontents_to_observer_map_.end()); | 93 webcontents_to_observer_map_.end()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void BrowserStatusMonitor::UpdateAppItemState( | 96 void BrowserStatusMonitor::UpdateAppItemState( |
| 97 content::WebContents* contents, | 97 content::WebContents* contents, |
| 98 ChromeLauncherController::AppState app_state) { | 98 ChromeLauncherController::AppState app_state) { |
| 99 DCHECK(contents); | 99 DCHECK(contents); |
| 100 if (launcher_controller_->IsBrowserFromActiveUser( | 100 // It is possible to come here from Browser::SwapTabContent where the contents |
| 101 chrome::FindBrowserWithWebContents(contents))) | 101 // cannot be associated with a browser. |
| 102 Browser* browser = chrome::FindBrowserWithWebContents(contents); |
| 103 if (browser && launcher_controller_->IsBrowserFromActiveUser(browser)) |
| 102 launcher_controller_->UpdateAppState(contents, app_state); | 104 launcher_controller_->UpdateAppState(contents, app_state); |
| 103 } | 105 } |
| 104 | 106 |
| 105 void BrowserStatusMonitor::UpdateBrowserItemState() { | 107 void BrowserStatusMonitor::UpdateBrowserItemState() { |
| 106 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 108 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
| 107 UpdateBrowserItemState(); | 109 UpdateBrowserItemState(); |
| 108 } | 110 } |
| 109 | 111 |
| 110 void BrowserStatusMonitor::OnWindowActivated(aura::Window* gained_active, | 112 void BrowserStatusMonitor::OnWindowActivated(aura::Window* gained_active, |
| 111 aura::Window* lost_active) { | 113 aura::Window* lost_active) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 308 } |
| 307 } | 309 } |
| 308 | 310 |
| 309 void BrowserStatusMonitor::RemoveWebContentsObserver( | 311 void BrowserStatusMonitor::RemoveWebContentsObserver( |
| 310 content::WebContents* contents) { | 312 content::WebContents* contents) { |
| 311 DCHECK(webcontents_to_observer_map_.find(contents) != | 313 DCHECK(webcontents_to_observer_map_.find(contents) != |
| 312 webcontents_to_observer_map_.end()); | 314 webcontents_to_observer_map_.end()); |
| 313 delete webcontents_to_observer_map_[contents]; | 315 delete webcontents_to_observer_map_[contents]; |
| 314 webcontents_to_observer_map_.erase(contents); | 316 webcontents_to_observer_map_.erase(contents); |
| 315 } | 317 } |
| OLD | NEW |