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

Side by Side Diff: chrome/browser/media/desktop_media_list_ash.cc

Issue 119753007: Add GrabWindowSnapshotAsync tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, compiling Created 6 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::GrabWindowSnapshotAsync( 184 ui::GrabWindowSnapshotAndScaleAsync(
185 window, window_rect, 185 window,
186 window_rect,
186 scaled_rect.size(), 187 scaled_rect.size(),
187 BrowserThread::GetBlockingPool(), 188 BrowserThread::GetBlockingPool(),
188 base::Bind(&DesktopMediaListAsh::OnThumbnailCaptured, 189 base::Bind(&DesktopMediaListAsh::OnThumbnailCaptured,
189 weak_factory_.GetWeakPtr(), 190 weak_factory_.GetWeakPtr(),
190 id)); 191 id));
191 } 192 }
192 193
193 void DesktopMediaListAsh::OnThumbnailCaptured(content::DesktopMediaID id, 194 void DesktopMediaListAsh::OnThumbnailCaptured(content::DesktopMediaID id,
194 const gfx::Image& image) { 195 const gfx::Image& image) {
195 for (size_t i = 0; i < sources_.size(); ++i) { 196 for (size_t i = 0; i < sources_.size(); ++i) {
(...skipping 10 matching lines...) Expand all
206 if (!pending_window_capture_requests_) { 207 if (!pending_window_capture_requests_) {
207 // Once we've finished capturing all windows post a task for the next list 208 // Once we've finished capturing all windows post a task for the next list
208 // update. 209 // update.
209 BrowserThread::PostDelayedTask( 210 BrowserThread::PostDelayedTask(
210 BrowserThread::UI, FROM_HERE, 211 BrowserThread::UI, FROM_HERE,
211 base::Bind(&DesktopMediaListAsh::Refresh, 212 base::Bind(&DesktopMediaListAsh::Refresh,
212 weak_factory_.GetWeakPtr()), 213 weak_factory_.GetWeakPtr()),
213 update_period_); 214 update_period_);
214 } 215 }
215 } 216 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698