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

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

Issue 2357053002: Always use arc::InstanceHolder<T>::GetInstanceForMethod (Closed)
Patch Set: review 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ImageDecoder::Cancel(this); 89 ImageDecoder::Cancel(this);
90 ash::WallpaperController* wc = GetWallpaperController(); 90 ash::WallpaperController* wc = GetWallpaperController();
91 if (wc) 91 if (wc)
92 wc->RemoveObserver(this); 92 wc->RemoveObserver(this);
93 arc_bridge_service()->wallpaper()->RemoveObserver(this); 93 arc_bridge_service()->wallpaper()->RemoveObserver(this);
94 } 94 }
95 95
96 void ArcWallpaperService::OnInstanceReady() { 96 void ArcWallpaperService::OnInstanceReady() {
97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
98 mojom::WallpaperInstance* wallpaper_instance = 98 mojom::WallpaperInstance* wallpaper_instance =
99 arc_bridge_service()->wallpaper()->instance(); 99 arc_bridge_service()->wallpaper()->GetInstanceForMethod("Init");
100 if (!wallpaper_instance) { 100 if (!wallpaper_instance)
101 LOG(DFATAL) << "OnWallpaperInstanceReady called, "
102 << "but no wallpaper instance found";
103 return; 101 return;
104 }
105 wallpaper_instance->Init(binding_.CreateInterfacePtrAndBind()); 102 wallpaper_instance->Init(binding_.CreateInterfacePtrAndBind());
106 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); 103 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this);
107 } 104 }
108 105
109 void ArcWallpaperService::OnInstanceClosed() { 106 void ArcWallpaperService::OnInstanceClosed() {
110 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 107 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
111 ash::WallpaperController* wc = GetWallpaperController(); 108 ash::WallpaperController* wc = GetWallpaperController();
112 if (wc) 109 if (wc)
113 wc->RemoveObserver(this); 110 wc->RemoveObserver(this);
114 } 111 }
(...skipping 28 matching lines...) Expand all
143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 140 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
144 auto* wallpaper_instance = 141 auto* wallpaper_instance =
145 arc_bridge_service()->wallpaper()->GetInstanceForMethod( 142 arc_bridge_service()->wallpaper()->GetInstanceForMethod(
146 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); 143 "OnWallpaperChanged", kMinOnWallpaperChangedVersion);
147 if (!wallpaper_instance) 144 if (!wallpaper_instance)
148 return; 145 return;
149 wallpaper_instance->OnWallpaperChanged(); 146 wallpaper_instance->OnWallpaperChanged();
150 } 147 }
151 148
152 } // namespace arc 149 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698