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

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

Issue 2495913002: arc: Convert more Mojo types to STL (Closed)
Patch Set: Rebased to ToT 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
« no previous file with comments | « chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h ('k') | components/arc/BUILD.gn » ('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 <vector>
8
9 #include "ash/common/wallpaper/wallpaper_controller.h" 7 #include "ash/common/wallpaper/wallpaper_controller.h"
10 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
11 #include "base/logging.h" 9 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
13 #include "base/task_runner_util.h" 11 #include "base/task_runner_util.h"
14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 12 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
15 #include "components/arc/arc_bridge_service.h" 13 #include "components/arc/arc_bridge_service.h"
16 #include "components/signin/core/account_id/account_id.h" 14 #include "components/signin/core/account_id/account_id.h"
17 #include "components/user_manager/user_manager.h" 15 #include "components/user_manager/user_manager.h"
18 #include "components/wallpaper/wallpaper_files_id.h" 16 #include "components/wallpaper/wallpaper_files_id.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); 100 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this);
103 } 101 }
104 102
105 void ArcWallpaperService::OnInstanceClosed() { 103 void ArcWallpaperService::OnInstanceClosed() {
106 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
107 ash::WallpaperController* wc = GetWallpaperController(); 105 ash::WallpaperController* wc = GetWallpaperController();
108 if (wc) 106 if (wc)
109 wc->RemoveObserver(this); 107 wc->RemoveObserver(this);
110 } 108 }
111 109
112 void ArcWallpaperService::SetWallpaper(mojo::Array<uint8_t> png_data) { 110 void ArcWallpaperService::SetWallpaper(const std::vector<uint8_t>& png_data) {
113 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
114 ImageDecoder::Cancel(this); 112 ImageDecoder::Cancel(this);
115 ImageDecoder::StartWithOptions(this, png_data.PassStorage(), 113 ImageDecoder::StartWithOptions(this, png_data, ImageDecoder::ROBUST_PNG_CODEC,
116 ImageDecoder::ROBUST_PNG_CODEC, true); 114 true);
117 } 115 }
118 116
119 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { 117 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) {
120 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 118 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
121 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller(); 119 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller();
122 gfx::ImageSkia wallpaper = wc->GetWallpaper(); 120 gfx::ImageSkia wallpaper = wc->GetWallpaper();
123 base::PostTaskAndReplyWithResult( 121 base::PostTaskAndReplyWithResult(
124 content::BrowserThread::GetBlockingPool(), FROM_HERE, 122 content::BrowserThread::GetBlockingPool(), FROM_HERE,
125 base::Bind(&EncodeImagePng, wallpaper), callback); 123 base::Bind(&EncodeImagePng, wallpaper), callback);
126 } 124 }
(...skipping 12 matching lines...) Expand all
139 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 137 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
140 auto* wallpaper_instance = 138 auto* wallpaper_instance =
141 arc_bridge_service()->wallpaper()->GetInstanceForMethod( 139 arc_bridge_service()->wallpaper()->GetInstanceForMethod(
142 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); 140 "OnWallpaperChanged", kMinOnWallpaperChangedVersion);
143 if (!wallpaper_instance) 141 if (!wallpaper_instance)
144 return; 142 return;
145 wallpaper_instance->OnWallpaperChanged(); 143 wallpaper_instance->OnWallpaperChanged();
146 } 144 }
147 145
148 } // namespace arc 146 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h ('k') | components/arc/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698