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

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

Issue 2332063004: cheets: remove setWallpaper from ArcIntentHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduce setting wallpaper latency. Created 4 years, 1 month 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
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"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); 100 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this);
101 } 101 }
102 102
103 void ArcWallpaperService::OnInstanceClosed() { 103 void ArcWallpaperService::OnInstanceClosed() {
104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
105 ash::WallpaperController* wc = GetWallpaperController(); 105 ash::WallpaperController* wc = GetWallpaperController();
106 if (wc) 106 if (wc)
107 wc->RemoveObserver(this); 107 wc->RemoveObserver(this);
108 } 108 }
109 109
110 void ArcWallpaperService::SetWallpaper(const std::vector<uint8_t>& png_data) { 110 void ArcWallpaperService::SetWallpaper(const std::vector<uint8_t>& data) {
111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
112 ImageDecoder::Cancel(this); 112 ImageDecoder::Cancel(this);
113 ImageDecoder::StartWithOptions(this, png_data, ImageDecoder::ROBUST_PNG_CODEC, 113 ImageDecoder::StartWithOptions(this, data, ImageDecoder::DEFAULT_CODEC, true);
114 true);
115 } 114 }
116 115
117 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { 116 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) {
118 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 117 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
119 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller(); 118 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller();
120 gfx::ImageSkia wallpaper = wc->GetWallpaper(); 119 gfx::ImageSkia wallpaper = wc->GetWallpaper();
121 base::PostTaskAndReplyWithResult( 120 base::PostTaskAndReplyWithResult(
122 content::BrowserThread::GetBlockingPool(), FROM_HERE, 121 content::BrowserThread::GetBlockingPool(), FROM_HERE,
123 base::Bind(&EncodeImagePng, wallpaper), callback); 122 base::Bind(&EncodeImagePng, wallpaper), callback);
124 } 123 }
(...skipping 12 matching lines...) Expand all
137 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 136 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
138 auto* wallpaper_instance = 137 auto* wallpaper_instance =
139 arc_bridge_service()->wallpaper()->GetInstanceForMethod( 138 arc_bridge_service()->wallpaper()->GetInstanceForMethod(
140 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); 139 "OnWallpaperChanged", kMinOnWallpaperChangedVersion);
141 if (!wallpaper_instance) 140 if (!wallpaper_instance)
142 return; 141 return;
143 wallpaper_instance->OnWallpaperChanged(); 142 wallpaper_instance->OnWallpaperChanged();
144 } 143 }
145 144
146 } // namespace arc 145 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h ('k') | components/arc/common/wallpaper.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698