Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: chrome/browser/chromeos/extensions/wallpaper_private_api.cc

Issue 11028121: Convert wallpaper picker to v2 app (Closed) Base URL: http://git.chromium.org/chromium/src.git@AppsV2
Patch Set: add the list of previous minimized window to new window state manager Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
}

Powered by Google App Engine
This is Rietveld 408576698