| 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 "chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.
h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.
h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_resources.h" | 7 #include "ash/desktop_background/desktop_background_resources.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "chrome/browser/chromeos/login/user_manager.h" | 15 #include "chrome/browser/chromeos/login/user_manager.h" |
| 16 #include "chrome/browser/io_thread.h" | 16 #include "chrome/browser/io_thread.h" |
| 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "grit/ui_resources.h" | 20 #include "grit/ui_resources.h" |
| 21 #include "net/base/mime_util.h" | 21 #include "net/base/mime_util.h" |
| 22 #include "ui/base/layout.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/gfx/codec/png_codec.h" | 24 #include "ui/gfx/codec/png_codec.h" |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 namespace options2 { | 27 namespace options2 { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 const char kDefaultWallpaperPrefix[] = "default_"; | 31 const char kDefaultWallpaperPrefix[] = "default_"; |
| 31 const char kCustomWallpaperPrefix[] = "custom_"; | 32 const char kCustomWallpaperPrefix[] = "custom_"; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 gfx::PNGCodec::EncodeBGRASkBitmap(user->wallpaper_thumbnail(), | 101 gfx::PNGCodec::EncodeBGRASkBitmap(user->wallpaper_thumbnail(), |
| 101 false, &data); | 102 false, &data); |
| 102 SendResponse(request_id, new base::RefCountedBytes(data)); | 103 SendResponse(request_id, new base::RefCountedBytes(data)); |
| 103 return; | 104 return; |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 int idr = PathToIDR(path); | 107 int idr = PathToIDR(path); |
| 107 if (idr != -1) { | 108 if (idr != -1) { |
| 108 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 109 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 109 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 110 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 110 SendResponse(request_id, rb.LoadDataResourceBytes(idr)); | 111 SendResponse(request_id, rb.LoadDataResourceBytes(idr, |
| 112 ui::SCALE_FACTOR_100P)); |
| 111 } | 113 } |
| 112 } | 114 } |
| 113 | 115 |
| 114 std::string WallpaperThumbnailSource::GetMimeType(const std::string&) const { | 116 std::string WallpaperThumbnailSource::GetMimeType(const std::string&) const { |
| 115 return "images/png"; | 117 return "images/png"; |
| 116 } | 118 } |
| 117 | 119 |
| 118 } // namespace options2 | 120 } // namespace options2 |
| 119 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |