| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |