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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/wallpaper_source.cc

Issue 10827368: ash: Avoid implicit conversion from ImageSkia into SkBitmap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « ash/launcher/tabbed_launcher_button.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/options2/chromeos/wallpaper_source.h" 5 #include "chrome/browser/ui/webui/options2/chromeos/wallpaper_source.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/synchronization/cancellation_flag.h" 10 #include "base/synchronization/cancellation_flag.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 std::string WallpaperImageSource::GetMimeType(const std::string&) const { 122 std::string WallpaperImageSource::GetMimeType(const std::string&) const {
123 return "images/png"; 123 return "images/png";
124 } 124 }
125 125
126 // Get current background image and store it to |data|. 126 // Get current background image and store it to |data|.
127 void WallpaperImageSource::GetCurrentUserWallpaper(int request_id) { 127 void WallpaperImageSource::GetCurrentUserWallpaper(int request_id) {
128 SkBitmap image; 128 SkBitmap image;
129 TRACE_EVENT0("LOCK_SCREEN", "GetCurrentUserWallpaper"); 129 TRACE_EVENT0("LOCK_SCREEN", "GetCurrentUserWallpaper");
130 if (chromeos::UserManager::Get()->IsUserLoggedIn()) { 130 if (chromeos::UserManager::Get()->IsUserLoggedIn()) {
131 SkBitmap wallpaper = ash::Shell::GetInstance()-> 131 // TODO(sad|bshe): It maybe necessary to include the scale factor in the
132 desktop_background_controller()-> 132 // request (as is done for user-image and wallpaper-thumbnails).
133 GetCurrentWallpaperImage(); 133 SkBitmap wallpaper;
134 gfx::ImageSkia wallpaper_skia = ash::Shell::GetInstance()->
135 desktop_background_controller()->GetCurrentWallpaperImage();
136 if (!wallpaper_skia.empty())
137 wallpaper = *wallpaper_skia.bitmap();
134 SkBitmap copy; 138 SkBitmap copy;
135 if (wallpaper.deepCopyTo(&copy, wallpaper.config())) 139 if (wallpaper.deepCopyTo(&copy, wallpaper.config()))
136 image = copy; 140 image = copy;
137 } 141 }
138 content::BrowserThread::PostTask( 142 content::BrowserThread::PostTask(
139 content::BrowserThread::IO, 143 content::BrowserThread::IO,
140 FROM_HERE, 144 FROM_HERE,
141 base::Bind(&WallpaperImageSource::ImageAcquired, this, image, request_id)); 145 base::Bind(&WallpaperImageSource::ImageAcquired, this, image, request_id));
142 } 146 }
143 147
(...skipping 30 matching lines...) Expand all
174 178
175 void WallpaperImageSource::SendCurrentUserWallpaper(int request_id, 179 void WallpaperImageSource::SendCurrentUserWallpaper(int request_id,
176 scoped_refptr<base::RefCountedBytes> data) { 180 scoped_refptr<base::RefCountedBytes> data) {
177 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 181 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
178 SendResponse(request_id, data); 182 SendResponse(request_id, data);
179 TRACE_EVENT_ASYNC_END0("SCREEN_LOCK", "GetUserWallpaper", request_id); 183 TRACE_EVENT_ASYNC_END0("SCREEN_LOCK", "GetUserWallpaper", request_id);
180 } 184 }
181 185
182 } // namespace options2 186 } // namespace options2
183 } // namespace chromeos 187 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/launcher/tabbed_launcher_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698