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

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

Issue 615133002: Add support for a virtual display on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on ToT Created 5 years, 10 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
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 <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"
11 #include "base/hash.h" 11 #include "base/hash.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/sys_info.h"
14 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
15 #include "chrome/browser/media/desktop_media_list_observer.h" 16 #include "chrome/browser/media/desktop_media_list_observer.h"
16 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "media/base/video_util.h" 19 #include "media/base/video_util.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/compositor/dip_util.h" 21 #include "ui/compositor/dip_util.h"
22 #include "ui/display/chromeos/display_configurator.h"
21 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
22 #include "ui/snapshot/snapshot.h" 24 #include "ui/snapshot/snapshot.h"
23 25
24 using content::BrowserThread; 26 using content::BrowserThread;
25 using content::DesktopMediaID; 27 using content::DesktopMediaID;
26 28
27 namespace { 29 namespace {
28 30
29 // Update the list twice per second. 31 // Update the list twice per second.
30 const int kDefaultUpdatePeriod = 500; 32 const int kDefaultUpdatePeriod = 500;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 204
203 if (source_types_ & WINDOWS) { 205 if (source_types_ & WINDOWS) {
204 EnumerateWindowsForRoot( 206 EnumerateWindowsForRoot(
205 sources, root_windows[i], ash::kShellWindowId_DefaultContainer); 207 sources, root_windows[i], ash::kShellWindowId_DefaultContainer);
206 EnumerateWindowsForRoot( 208 EnumerateWindowsForRoot(
207 sources, root_windows[i], ash::kShellWindowId_AlwaysOnTopContainer); 209 sources, root_windows[i], ash::kShellWindowId_AlwaysOnTopContainer);
208 EnumerateWindowsForRoot( 210 EnumerateWindowsForRoot(
209 sources, root_windows[i], ash::kShellWindowId_DockedContainer); 211 sources, root_windows[i], ash::kShellWindowId_DockedContainer);
210 } 212 }
211 } 213 }
214 #if defined(OS_CHROMEOS)
215 // DisplayConfigurator only works when running on ChromeOS
achuithb 2015/02/11 23:41:43 nit: period at end of comment
216 if (base::SysInfo::IsRunningOnChromeOS()) {
217 ui::DisplayConfigurator* configurator =
218 ash::Shell::GetInstance()->display_configurator();
219 if (configurator->GetVirtualDisplayId() ==
220 gfx::Display::kInvalidDisplayID) {
221 SourceDescription virtual_screen_source(
222 content::DesktopMediaID(
223 content::DesktopMediaID::TYPE_AURA_VIRTUAL_SCREEN, 0),
224 l10n_util::GetStringUTF16(
225 IDS_DESTOP_MEDIA_PICKER_VIRTUAL_SCREEN_NAME));
226 sources->push_back(virtual_screen_source);
227 // TODO: There is no thumbnail for the virtual screen right now
achuithb 2015/02/11 23:41:43 period at the end. Add your name in the TODO(<name
228 }
229 }
230 #endif
212 } 231 }
213 232
214 void DesktopMediaListAsh::CaptureThumbnail(content::DesktopMediaID id, 233 void DesktopMediaListAsh::CaptureThumbnail(content::DesktopMediaID id,
215 aura::Window* window) { 234 aura::Window* window) {
216 gfx::Rect window_rect(window->bounds().width(), window->bounds().height()); 235 gfx::Rect window_rect(window->bounds().width(), window->bounds().height());
217 gfx::Rect scaled_rect = media::ComputeLetterboxRegion( 236 gfx::Rect scaled_rect = media::ComputeLetterboxRegion(
218 gfx::Rect(thumbnail_size_), window_rect.size()); 237 gfx::Rect(thumbnail_size_), window_rect.size());
219 238
220 ++pending_window_capture_requests_; 239 ++pending_window_capture_requests_;
221 ui::GrabWindowSnapshotAndScaleAsync( 240 ui::GrabWindowSnapshotAndScaleAsync(
(...skipping 22 matching lines...) Expand all
244 if (!pending_window_capture_requests_) { 263 if (!pending_window_capture_requests_) {
245 // Once we've finished capturing all windows post a task for the next list 264 // Once we've finished capturing all windows post a task for the next list
246 // update. 265 // update.
247 BrowserThread::PostDelayedTask( 266 BrowserThread::PostDelayedTask(
248 BrowserThread::UI, FROM_HERE, 267 BrowserThread::UI, FROM_HERE,
249 base::Bind(&DesktopMediaListAsh::Refresh, 268 base::Bind(&DesktopMediaListAsh::Refresh,
250 weak_factory_.GetWeakPtr()), 269 weak_factory_.GetWeakPtr()),
251 update_period_); 270 update_period_);
252 } 271 }
253 } 272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698