| 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/display/window_tree_host_manager.h" | 7 #include "ash/display/window_tree_host_manager.h" |
| 8 #include "ash/shelf/shelf_util.h" | 8 #include "ash/shelf/shelf_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 13 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/settings_window_manager.h" | 20 #include "chrome/browser/ui/settings_window_manager.h" |
| 20 #include "chrome/browser/ui/settings_window_manager_observer.h" | 21 #include "chrome/browser/ui/settings_window_manager_observer.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 22 #include "chrome/browser/web_applications/web_app.h" | 23 #include "chrome/browser/web_applications/web_app.h" |
| 23 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 void BrowserStatusMonitor::UpdateAppItemState( | 154 void BrowserStatusMonitor::UpdateAppItemState( |
| 154 content::WebContents* contents, | 155 content::WebContents* contents, |
| 155 ChromeLauncherController::AppState app_state) { | 156 ChromeLauncherController::AppState app_state) { |
| 156 DCHECK(contents); | 157 DCHECK(contents); |
| 157 // It is possible to come here from Browser::SwapTabContent where the contents | 158 // It is possible to come here from Browser::SwapTabContent where the contents |
| 158 // cannot be associated with a browser. A removal however should be properly | 159 // cannot be associated with a browser. A removal however should be properly |
| 159 // processed. | 160 // processed. |
| 160 Browser* browser = chrome::FindBrowserWithWebContents(contents); | 161 Browser* browser = chrome::FindBrowserWithWebContents(contents); |
| 161 if (app_state == ChromeLauncherController::APP_STATE_REMOVED || | 162 if (app_state == ChromeLauncherController::APP_STATE_REMOVED || |
| 162 (browser && launcher_controller_->IsBrowserFromActiveUser(browser))) | 163 (browser && IsBrowserFromActiveUser(browser))) |
| 163 launcher_controller_->UpdateAppState(contents, app_state); | 164 launcher_controller_->UpdateAppState(contents, app_state); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void BrowserStatusMonitor::UpdateBrowserItemState() { | 167 void BrowserStatusMonitor::UpdateBrowserItemState() { |
| 167 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 168 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
| 168 UpdateBrowserItemState(); | 169 UpdateBrowserItemState(); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void BrowserStatusMonitor::OnWindowActivated( | 172 void BrowserStatusMonitor::OnWindowActivated( |
| 172 aura::client::ActivationChangeObserver::ActivationReason reason, | 173 aura::client::ActivationChangeObserver::ActivationReason reason, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 content::WebContents* contents) { | 380 content::WebContents* contents) { |
| 380 return launcher_controller_->GetShelfIDForWebContents(contents); | 381 return launcher_controller_->GetShelfIDForWebContents(contents); |
| 381 } | 382 } |
| 382 | 383 |
| 383 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( | 384 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( |
| 384 Browser* browser, | 385 Browser* browser, |
| 385 content::WebContents* web_contents) { | 386 content::WebContents* web_contents) { |
| 386 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 387 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
| 387 SetShelfIDForBrowserWindowContents(browser, web_contents); | 388 SetShelfIDForBrowserWindowContents(browser, web_contents); |
| 388 } | 389 } |
| OLD | NEW |