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

Side by Side Diff: ash/desktop_background/desktop_background_controller.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | base/debug/proc_maps_linux.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 (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 "ash/desktop_background/desktop_background_controller.h" 5 #include "ash/desktop_background/desktop_background_controller.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/desktop_background/desktop_background_controller_observer.h" 8 #include "ash/desktop_background/desktop_background_controller_observer.h"
9 #include "ash/desktop_background/desktop_background_view.h" 9 #include "ash/desktop_background/desktop_background_view.h"
10 #include "ash/desktop_background/desktop_background_widget_controller.h" 10 #include "ash/desktop_background/desktop_background_widget_controller.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 private: 108 private:
109 friend class base::RefCountedThreadSafe< 109 friend class base::RefCountedThreadSafe<
110 DesktopBackgroundController::WallpaperLoader>; 110 DesktopBackgroundController::WallpaperLoader>;
111 111
112 // Loads a JPEG image from |path|, a trusted file -- note that the image 112 // Loads a JPEG image from |path|, a trusted file -- note that the image
113 // is not loaded in a sandboxed process. Returns an empty pointer on 113 // is not loaded in a sandboxed process. Returns an empty pointer on
114 // error. 114 // error.
115 static scoped_ptr<SkBitmap> LoadSkBitmapFromJPEGFile( 115 static scoped_ptr<SkBitmap> LoadSkBitmapFromJPEGFile(
116 const base::FilePath& path) { 116 const base::FilePath& path) {
117 std::string data; 117 std::string data;
118 if (!file_util::ReadFileToString(path, &data)) { 118 if (!base::ReadFileToString(path, &data)) {
119 LOG(ERROR) << "Unable to read data from " << path.value(); 119 LOG(ERROR) << "Unable to read data from " << path.value();
120 return scoped_ptr<SkBitmap>(); 120 return scoped_ptr<SkBitmap>();
121 } 121 }
122 122
123 scoped_ptr<SkBitmap> bitmap(gfx::JPEGCodec::Decode( 123 scoped_ptr<SkBitmap> bitmap(gfx::JPEGCodec::Decode(
124 reinterpret_cast<const unsigned char*>(data.data()), data.size())); 124 reinterpret_cast<const unsigned char*>(data.data()), data.size()));
125 if (!bitmap) 125 if (!bitmap)
126 LOG(ERROR) << "Unable to decode JPEG data from " << path.value(); 126 LOG(ERROR) << "Unable to decode JPEG data from " << path.value();
127 return bitmap.Pass(); 127 return bitmap.Pass();
128 } 128 }
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 return moved; 466 return moved;
467 } 467 }
468 468
469 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { 469 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) {
470 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : 470 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer :
471 internal::kShellWindowId_DesktopBackgroundContainer; 471 internal::kShellWindowId_DesktopBackgroundContainer;
472 } 472 }
473 473
474 } // namespace ash 474 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | base/debug/proc_maps_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698