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

Side by Side Diff: chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc

Issue 2715153006: Set desired_image_size when decoding images for NTP Tile icons. (Closed)
Patch Set: comment formatting Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/hats/hats_notification_controller_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/arc/wallpaper/arc_wallpaper_service.h" 5 #include "chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h"
6 6
7 #include "ash/common/wallpaper/wallpaper_controller.h" 7 #include "ash/common/wallpaper/wallpaper_controller.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/task_scheduler/post_task.h" 11 #include "base/task_scheduler/post_task.h"
12 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 12 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
13 #include "components/arc/arc_bridge_service.h" 13 #include "components/arc/arc_bridge_service.h"
14 #include "components/signin/core/account_id/account_id.h" 14 #include "components/signin/core/account_id/account_id.h"
15 #include "components/user_manager/user_manager.h" 15 #include "components/user_manager/user_manager.h"
16 #include "components/wallpaper/wallpaper_files_id.h" 16 #include "components/wallpaper/wallpaper_files_id.h"
17 #include "components/wallpaper/wallpaper_layout.h" 17 #include "components/wallpaper/wallpaper_layout.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "ui/gfx/codec/png_codec.h" 19 #include "ui/gfx/codec/png_codec.h"
20 #include "ui/gfx/geometry/size.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
22 #include "ui/gfx/image/image_util.h" 23 #include "ui/gfx/image/image_util.h"
23 24
24 using user_manager::UserManager; 25 using user_manager::UserManager;
25 26
26 namespace arc { 27 namespace arc {
27 28
28 namespace { 29 namespace {
29 30
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void ArcWallpaperService::OnInstanceClosed() { 103 void ArcWallpaperService::OnInstanceClosed() {
103 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
104 ash::WallpaperController* wc = GetWallpaperController(); 105 ash::WallpaperController* wc = GetWallpaperController();
105 if (wc) 106 if (wc)
106 wc->RemoveObserver(this); 107 wc->RemoveObserver(this);
107 } 108 }
108 109
109 void ArcWallpaperService::SetWallpaper(const std::vector<uint8_t>& data) { 110 void ArcWallpaperService::SetWallpaper(const std::vector<uint8_t>& data) {
110 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
111 ImageDecoder::Cancel(this); 112 ImageDecoder::Cancel(this);
112 ImageDecoder::StartWithOptions(this, data, ImageDecoder::DEFAULT_CODEC, true); 113 ImageDecoder::StartWithOptions(this, data, ImageDecoder::DEFAULT_CODEC, true,
114 gfx::Size());
113 } 115 }
114 116
115 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { 117 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) {
116 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 118 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
117 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller(); 119 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller();
118 gfx::ImageSkia wallpaper = wc->GetWallpaper(); 120 gfx::ImageSkia wallpaper = wc->GetWallpaper();
119 base::PostTaskWithTraitsAndReplyWithResult( 121 base::PostTaskWithTraitsAndReplyWithResult(
120 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 122 FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
121 base::TaskPriority::BACKGROUND), 123 base::TaskPriority::BACKGROUND),
122 base::Bind(&EncodeImagePng, wallpaper), callback); 124 base::Bind(&EncodeImagePng, wallpaper), callback);
(...skipping 12 matching lines...) Expand all
135 void ArcWallpaperService::OnWallpaperDataChanged() { 137 void ArcWallpaperService::OnWallpaperDataChanged() {
136 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
137 auto* wallpaper_instance = ARC_GET_INSTANCE_FOR_METHOD( 139 auto* wallpaper_instance = ARC_GET_INSTANCE_FOR_METHOD(
138 arc_bridge_service()->wallpaper(), OnWallpaperChanged); 140 arc_bridge_service()->wallpaper(), OnWallpaperChanged);
139 if (!wallpaper_instance) 141 if (!wallpaper_instance)
140 return; 142 return;
141 wallpaper_instance->OnWallpaperChanged(); 143 wallpaper_instance->OnWallpaperChanged();
142 } 144 }
143 145
144 } // namespace arc 146 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/hats/hats_notification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698