OLD | NEW |
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 Loading... |
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 DCHECK(wallpaper_instance); |
101 LOG(DFATAL) << "OnWallpaperInstanceReady called, " | |
102 << "but no wallpaper instance found"; | |
103 return; | |
104 } | |
105 wallpaper_instance->Init(binding_.CreateInterfacePtrAndBind()); | 101 wallpaper_instance->Init(binding_.CreateInterfacePtrAndBind()); |
106 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); | 102 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); |
107 } | 103 } |
108 | 104 |
109 void ArcWallpaperService::OnInstanceClosed() { | 105 void ArcWallpaperService::OnInstanceClosed() { |
110 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 106 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
111 ash::WallpaperController* wc = GetWallpaperController(); | 107 ash::WallpaperController* wc = GetWallpaperController(); |
112 if (wc) | 108 if (wc) |
113 wc->RemoveObserver(this); | 109 wc->RemoveObserver(this); |
114 } | 110 } |
(...skipping 28 matching lines...) Expand all Loading... |
143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 139 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
144 auto* wallpaper_instance = | 140 auto* wallpaper_instance = |
145 arc_bridge_service()->wallpaper()->GetInstanceForMethod( | 141 arc_bridge_service()->wallpaper()->GetInstanceForMethod( |
146 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); | 142 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); |
147 if (!wallpaper_instance) | 143 if (!wallpaper_instance) |
148 return; | 144 return; |
149 wallpaper_instance->OnWallpaperChanged(); | 145 wallpaper_instance->OnWallpaperChanged(); |
150 } | 146 } |
151 | 147 |
152 } // namespace arc | 148 } // namespace arc |
OLD | NEW |