OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/extensions/wallpaper_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
| 11 #include "ash/wm/window_state.h" |
11 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
12 #include "base/file_util.h" | 13 #include "base/file_util.h" |
13 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
18 #include "base/threading/worker_pool.h" | 19 #include "base/threading/worker_pool.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chromeos/login/user.h" | 21 #include "chrome/browser/chromeos/login/user.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 (*iter)->RemoveObserver(this); | 112 (*iter)->RemoveObserver(this); |
112 } | 113 } |
113 } | 114 } |
114 | 115 |
115 void BuildWindowListAndMinimizeInactive(aura::Window* active_window) { | 116 void BuildWindowListAndMinimizeInactive(aura::Window* active_window) { |
116 windows_ = ash::MruWindowTracker::BuildWindowList(false); | 117 windows_ = ash::MruWindowTracker::BuildWindowList(false); |
117 // Remove active window. | 118 // Remove active window. |
118 std::vector<aura::Window*>::iterator last = | 119 std::vector<aura::Window*>::iterator last = |
119 std::remove(windows_.begin(), windows_.end(), active_window); | 120 std::remove(windows_.begin(), windows_.end(), active_window); |
120 // Removes unfocusable windows. | 121 // Removes unfocusable windows. |
121 last = | 122 last = std::remove_if( |
122 std::remove_if( | 123 windows_.begin(), |
123 windows_.begin(), | 124 last, |
124 last, | 125 std::ptr_fun(ash::wm::IsWindowMinimized)); |
125 std::ptr_fun(ash::wm::IsWindowMinimized)); | |
126 windows_.erase(last, windows_.end()); | 126 windows_.erase(last, windows_.end()); |
127 | 127 |
128 for (std::vector<aura::Window*>::iterator iter = windows_.begin(); | 128 for (std::vector<aura::Window*>::iterator iter = windows_.begin(); |
129 iter != windows_.end(); ++iter) { | 129 iter != windows_.end(); ++iter) { |
130 (*iter)->AddObserver(this); | 130 (*iter)->AddObserver(this); |
131 ash::wm::MinimizeWindow(*iter); | 131 ash::wm::GetWindowState(*iter)->Minimize(); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 void RestoreMinimizedWindows() { | 135 void RestoreMinimizedWindows() { |
136 for (std::vector<aura::Window*>::iterator iter = windows_.begin(); | 136 for (std::vector<aura::Window*>::iterator iter = windows_.begin(); |
137 iter != windows_.end(); ++iter) { | 137 iter != windows_.end(); ++iter) { |
138 ash::wm::ActivateWindow(*iter); | 138 ash::wm::ActivateWindow(*iter); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 this, file_list)); | 803 this, file_list)); |
804 } | 804 } |
805 | 805 |
806 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( | 806 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( |
807 const std::vector<std::string>& file_list) { | 807 const std::vector<std::string>& file_list) { |
808 ListValue* results = new ListValue(); | 808 ListValue* results = new ListValue(); |
809 results->AppendStrings(file_list); | 809 results->AppendStrings(file_list); |
810 SetResult(results); | 810 SetResult(results); |
811 SendResponse(true); | 811 SendResponse(true); |
812 } | 812 } |
OLD | NEW |