| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 observed_activation_clients_(this), | 53 observed_activation_clients_(this), |
| 54 observed_root_windows_(this) { | 54 observed_root_windows_(this) { |
| 55 DCHECK(launcher_controller_); | 55 DCHECK(launcher_controller_); |
| 56 BrowserList::AddObserver(this); | 56 BrowserList::AddObserver(this); |
| 57 | 57 |
| 58 // This check needs for win7_aura. Without this, all tests in | 58 // This check needs for win7_aura. Without this, all tests in |
| 59 // ChromeLauncherController will fail in win7_aura. | 59 // ChromeLauncherController will fail in win7_aura. |
| 60 if (ash::Shell::HasInstance()) { | 60 if (ash::Shell::HasInstance()) { |
| 61 // We can't assume all RootWindows have the same ActivationClient. | 61 // We can't assume all RootWindows have the same ActivationClient. |
| 62 // Add a RootWindow and its ActivationClient to the observed list. | 62 // Add a RootWindow and its ActivationClient to the observed list. |
| 63 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 63 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
| 64 aura::Window::Windows::const_iterator iter = root_windows.begin(); | 64 ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
| 65 for (; iter != root_windows.end(); ++iter) { | 65 for (; iter != root_windows.end(); ++iter) { |
| 66 // |observed_activation_clients_| can have the same activation client | 66 // |observed_activation_clients_| can have the same activation client |
| 67 // multiple times - which would be handled by the used | 67 // multiple times - which would be handled by the used |
| 68 // |ScopedObserverWithDuplicatedSources|. | 68 // |ScopedObserverWithDuplicatedSources|. |
| 69 observed_activation_clients_.Add( | 69 observed_activation_clients_.Add( |
| 70 aura::client::GetActivationClient(*iter)); | 70 aura::client::GetActivationClient(*iter)); |
| 71 observed_root_windows_.Add(static_cast<aura::Window*>(*iter)); | 71 observed_root_windows_.Add(static_cast<aura::Window*>(*iter)); |
| 72 } | 72 } |
| 73 ash::Shell::GetInstance()->GetScreen()->AddObserver(this); | 73 ash::Shell::GetInstance()->GetScreen()->AddObserver(this); |
| 74 } | 74 } |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 void BrowserStatusMonitor::RemoveWebContentsObserver( | 311 void BrowserStatusMonitor::RemoveWebContentsObserver( |
| 312 content::WebContents* contents) { | 312 content::WebContents* contents) { |
| 313 DCHECK(webcontents_to_observer_map_.find(contents) != | 313 DCHECK(webcontents_to_observer_map_.find(contents) != |
| 314 webcontents_to_observer_map_.end()); | 314 webcontents_to_observer_map_.end()); |
| 315 delete webcontents_to_observer_map_[contents]; | 315 delete webcontents_to_observer_map_[contents]; |
| 316 webcontents_to_observer_map_.erase(contents); | 316 webcontents_to_observer_map_.erase(contents); |
| 317 } | 317 } |
| OLD | NEW |