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

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

Issue 2347293002: arc: Add InstanceHelper::GetInstanceForMethod() (Closed)
Patch Set: No more DCHECK Created 4 years, 3 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
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/arc_wallpaper_service.h" 5 #include "chrome/browser/chromeos/arc/arc_wallpaper_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/wallpaper/wallpaper_controller.h" 9 #include "ash/common/wallpaper/wallpaper_controller.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 SetBitmapAsWallpaper(bitmap); 134 SetBitmapAsWallpaper(bitmap);
135 } 135 }
136 136
137 void ArcWallpaperService::OnDecodeImageFailed() { 137 void ArcWallpaperService::OnDecodeImageFailed() {
138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
139 LOG(ERROR) << "Failed to decode wallpaper image."; 139 LOG(ERROR) << "Failed to decode wallpaper image.";
140 } 140 }
141 141
142 void ArcWallpaperService::OnWallpaperDataChanged() { 142 void ArcWallpaperService::OnWallpaperDataChanged() {
143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
144 mojom::WallpaperInstance* instance = 144 auto* wallpaper_instance =
145 GetWallpaperInstance(kMinOnWallpaperChangedVersion); 145 arc_bridge_service()->wallpaper()->GetInstanceForMethod(
146 if (!instance) 146 "OnWallpaperChanged", kMinOnWallpaperChangedVersion);
147 if (!wallpaper_instance)
147 return; 148 return;
148 instance->OnWallpaperChanged(); 149 wallpaper_instance->OnWallpaperChanged();
149 }
150
151 mojom::WallpaperInstance* ArcWallpaperService::GetWallpaperInstance(
152 uint32_t min_version) {
153 uint32_t version = arc_bridge_service()->wallpaper()->version();
154 if (version < min_version) {
155 VLOG(1) << "ARC wallpaper instance is too old. required: " << min_version
156 << ", actual: " << version;
157 return nullptr;
158 }
159
160 mojom::WallpaperInstance* instance =
161 arc_bridge_service()->wallpaper()->instance();
162 if (!instance)
163 VLOG(2) << "ARC wallpaper instance is not ready.";
164 return instance;
165 } 150 }
166 151
167 } // namespace arc 152 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_wallpaper_service.h ('k') | chrome/browser/task_manager/providers/arc/arc_process_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698