Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
| diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
| index 08fd8aa9f5aef85aadd6c8d13a61cd186cbec4ab..b13916312643e3e5718f428f3bf40525f11888eb 100644 |
| --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
| +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
| @@ -50,11 +50,15 @@ class WindowStateManager : public aura::WindowObserver { |
| // Minimizes all windows except the active window. |
| static void MinimizeInactiveWindows() { |
| - if (g_window_state_manager) |
| + std::vector<aura::Window*> previous_minimized_windows; |
| + if (g_window_state_manager) { |
| + previous_minimized_windows = g_window_state_manager->windows(); |
| delete g_window_state_manager; |
|
flackr
2012/11/13 16:18:30
Instead of deleting the previous window state mana
bshe
2012/11/13 19:33:22
Reverted the change and will address them in a fol
|
| + } |
| g_window_state_manager = new WindowStateManager(); |
| g_window_state_manager->BuildWindowListAndMinimizeInactive( |
| ash::wm::GetActiveWindow()); |
| + g_window_state_manager->AppendWindows(previous_minimized_windows); |
|
flackr
2012/11/13 16:18:30
This new behavior should be tested in wallpaper_pr
bshe
2012/11/13 19:33:22
Reverted the change and will address them in a fol
|
| } |
| // Activates all minimized windows restoring them to their previous state. |
| @@ -76,6 +80,21 @@ class WindowStateManager : public aura::WindowObserver { |
| } |
| } |
| + std::vector<aura::Window*> windows() const { |
| + return windows_; |
| + } |
| + |
| + // Appends |windows| to the minimized windows list. This should only be |
| + // called after BuildWindowListAndMinimizeInactive. |
| + void AppendWindows(std::vector<aura::Window*> windows) { |
| + for (std::vector<aura::Window*>::iterator iter = windows.begin(); |
| + iter != windows.end(); ++iter) { |
| + // Do not add duplicated window. |
| + if(std::find(windows_.begin(), windows_.end(), *iter) == windows_.end()) |
| + windows_.push_back(*iter); |
| + } |
| + } |
| + |
| void BuildWindowListAndMinimizeInactive(aura::Window* active_window) { |
| windows_ = ash::WindowCycleController::BuildWindowList(NULL); |
| // Remove active window. |
| @@ -97,8 +116,9 @@ class WindowStateManager : public aura::WindowObserver { |
| } |
| void RestoreMinimizedWindows() { |
| - for (std::vector<aura::Window*>::iterator iter = windows_.begin(); |
| - iter != windows_.end(); ++iter) { |
| + // The topmost window is at the front of the list. |
|
flackr
2012/11/13 16:18:30
If you minimize all the windows and then minimize
bshe
2012/11/13 19:33:22
Reverted the change and will address them in a fol
|
| + for (std::vector<aura::Window*>::reverse_iterator iter = windows_.rbegin(); |
| + iter != windows_.rend(); ++iter) { |
| ash::wm::ActivateWindow(*iter); |
| } |
| } |