| 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 <map> | 7 #include <map> |
| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void DesktopMediaListAsh::CaptureThumbnail(content::DesktopMediaID id, | 177 void DesktopMediaListAsh::CaptureThumbnail(content::DesktopMediaID id, |
| 178 aura::Window* window) { | 178 aura::Window* window) { |
| 179 gfx::Rect window_rect(window->bounds().width(), window->bounds().height()); | 179 gfx::Rect window_rect(window->bounds().width(), window->bounds().height()); |
| 180 gfx::Rect scaled_rect = media::ComputeLetterboxRegion( | 180 gfx::Rect scaled_rect = media::ComputeLetterboxRegion( |
| 181 gfx::Rect(thumbnail_size_), window_rect.size()); | 181 gfx::Rect(thumbnail_size_), window_rect.size()); |
| 182 | 182 |
| 183 ++pending_window_capture_requests_; | 183 ++pending_window_capture_requests_; |
| 184 ui::GrapWindowSnapshotAsync( | 184 ui::GrabWindowSnapshotAsync( |
| 185 window, window_rect, | 185 window, window_rect, |
| 186 scaled_rect.size(), | 186 scaled_rect.size(), |
| 187 BrowserThread::GetBlockingPool(), | 187 BrowserThread::GetBlockingPool(), |
| 188 base::Bind(&DesktopMediaListAsh::OnThumbnailCaptured, | 188 base::Bind(&DesktopMediaListAsh::OnThumbnailCaptured, |
| 189 weak_factory_.GetWeakPtr(), | 189 weak_factory_.GetWeakPtr(), |
| 190 id)); | 190 id)); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void DesktopMediaListAsh::OnThumbnailCaptured(content::DesktopMediaID id, | 193 void DesktopMediaListAsh::OnThumbnailCaptured(content::DesktopMediaID id, |
| 194 const gfx::Image& image) { | 194 const gfx::Image& image) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 206 if (!pending_window_capture_requests_) { | 206 if (!pending_window_capture_requests_) { |
| 207 // Once we've finished capturing all windows post a task for the next list | 207 // Once we've finished capturing all windows post a task for the next list |
| 208 // update. | 208 // update. |
| 209 BrowserThread::PostDelayedTask( | 209 BrowserThread::PostDelayedTask( |
| 210 BrowserThread::UI, FROM_HERE, | 210 BrowserThread::UI, FROM_HERE, |
| 211 base::Bind(&DesktopMediaListAsh::Refresh, | 211 base::Bind(&DesktopMediaListAsh::Refresh, |
| 212 weak_factory_.GetWeakPtr()), | 212 weak_factory_.GetWeakPtr()), |
| 213 update_period_); | 213 update_period_); |
| 214 } | 214 } |
| 215 } | 215 } |
| OLD | NEW |