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/media/desktop_media_list_ash.h" | 5 #include "chrome/browser/media/desktop_media_list_ash.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 observer_->OnSourceNameChanged(pos); | 142 observer_->OnSourceNameChanged(pos); |
143 } | 143 } |
144 ++pos; | 144 ++pos; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void DesktopMediaListAsh::EnumerateWindowsForRoot( | 148 void DesktopMediaListAsh::EnumerateWindowsForRoot( |
149 std::vector<DesktopMediaListAsh::SourceDescription>* sources, | 149 std::vector<DesktopMediaListAsh::SourceDescription>* sources, |
150 aura::Window* root_window, | 150 aura::Window* root_window, |
151 int container_id) { | 151 int container_id) { |
152 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 152 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
153 | 153 |
154 aura::Window* container = ash::Shell::GetContainer(root_window, container_id); | 154 aura::Window* container = ash::Shell::GetContainer(root_window, container_id); |
155 if (!container) | 155 if (!container) |
156 return; | 156 return; |
157 for (aura::Window::Windows::const_iterator it = container->children().begin(); | 157 for (aura::Window::Windows::const_iterator it = container->children().begin(); |
158 it != container->children().end(); ++it) { | 158 it != container->children().end(); ++it) { |
159 if (!(*it)->IsVisible() || !(*it)->CanFocus()) | 159 if (!(*it)->IsVisible() || !(*it)->CanFocus()) |
160 continue; | 160 continue; |
161 content::DesktopMediaID id = | 161 content::DesktopMediaID id = |
162 content::DesktopMediaID::RegisterAuraWindow(*it); | 162 content::DesktopMediaID::RegisterAuraWindow(*it); |
163 if (id.id == view_dialog_id_) | 163 if (id.id == view_dialog_id_) |
164 continue; | 164 continue; |
165 SourceDescription window_source(id, (*it)->title()); | 165 SourceDescription window_source(id, (*it)->title()); |
166 sources->push_back(window_source); | 166 sources->push_back(window_source); |
167 | 167 |
168 CaptureThumbnail(window_source.id, *it); | 168 CaptureThumbnail(window_source.id, *it); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 void DesktopMediaListAsh::EnumerateSources( | 172 void DesktopMediaListAsh::EnumerateSources( |
173 std::vector<DesktopMediaListAsh::SourceDescription>* sources) { | 173 std::vector<DesktopMediaListAsh::SourceDescription>* sources) { |
174 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 174 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
175 | 175 |
176 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 176 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
177 | 177 |
178 for (size_t i = 0; i < root_windows.size(); ++i) { | 178 for (size_t i = 0; i < root_windows.size(); ++i) { |
179 if (source_types_ & SCREENS) { | 179 if (source_types_ & SCREENS) { |
180 SourceDescription screen_source( | 180 SourceDescription screen_source( |
181 content::DesktopMediaID::RegisterAuraWindow(root_windows[i]), | 181 content::DesktopMediaID::RegisterAuraWindow(root_windows[i]), |
182 root_windows[i]->title()); | 182 root_windows[i]->title()); |
183 | 183 |
184 if (root_windows[i] == ash::Shell::GetPrimaryRootWindow()) | 184 if (root_windows[i] == ash::Shell::GetPrimaryRootWindow()) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 if (!pending_window_capture_requests_) { | 244 if (!pending_window_capture_requests_) { |
245 // Once we've finished capturing all windows post a task for the next list | 245 // Once we've finished capturing all windows post a task for the next list |
246 // update. | 246 // update. |
247 BrowserThread::PostDelayedTask( | 247 BrowserThread::PostDelayedTask( |
248 BrowserThread::UI, FROM_HERE, | 248 BrowserThread::UI, FROM_HERE, |
249 base::Bind(&DesktopMediaListAsh::Refresh, | 249 base::Bind(&DesktopMediaListAsh::Refresh, |
250 weak_factory_.GetWeakPtr()), | 250 weak_factory_.GetWeakPtr()), |
251 update_period_); | 251 update_period_); |
252 } | 252 } |
253 } | 253 } |
OLD | NEW |