Chromium Code Reviews| 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/wallpaper/arc_wallpaper_service.h" | 5 #include "chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
|
Yusuke Sato
2016/11/11 22:42:10
nit: remove
Luis Héctor Chávez
2016/11/12 02:08:01
Done.
| |
| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 15 #include "components/arc/arc_bridge_service.h" | 15 #include "components/arc/arc_bridge_service.h" |
| 16 #include "components/signin/core/account_id/account_id.h" | 16 #include "components/signin/core/account_id/account_id.h" |
| 17 #include "components/user_manager/user_manager.h" | 17 #include "components/user_manager/user_manager.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); | 102 ash::WmShell::Get()->wallpaper_controller()->AddObserver(this); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ArcWallpaperService::OnInstanceClosed() { | 105 void ArcWallpaperService::OnInstanceClosed() { |
| 106 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 106 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 107 ash::WallpaperController* wc = GetWallpaperController(); | 107 ash::WallpaperController* wc = GetWallpaperController(); |
| 108 if (wc) | 108 if (wc) |
| 109 wc->RemoveObserver(this); | 109 wc->RemoveObserver(this); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void ArcWallpaperService::SetWallpaper(mojo::Array<uint8_t> png_data) { | 112 void ArcWallpaperService::SetWallpaper(const std::vector<uint8_t>& png_data) { |
| 113 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 113 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 114 ImageDecoder::Cancel(this); | 114 ImageDecoder::Cancel(this); |
| 115 ImageDecoder::StartWithOptions(this, png_data.PassStorage(), | 115 ImageDecoder::StartWithOptions(this, png_data, ImageDecoder::ROBUST_PNG_CODEC, |
| 116 ImageDecoder::ROBUST_PNG_CODEC, true); | 116 true); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { | 119 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { |
| 120 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 120 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 121 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller(); | 121 ash::WallpaperController* wc = ash::WmShell::Get()->wallpaper_controller(); |
| 122 gfx::ImageSkia wallpaper = wc->GetWallpaper(); | 122 gfx::ImageSkia wallpaper = wc->GetWallpaper(); |
| 123 base::PostTaskAndReplyWithResult( | 123 base::PostTaskAndReplyWithResult( |
| 124 content::BrowserThread::GetBlockingPool(), FROM_HERE, | 124 content::BrowserThread::GetBlockingPool(), FROM_HERE, |
| 125 base::Bind(&EncodeImagePng, wallpaper), callback); | 125 base::Bind(&EncodeImagePng, wallpaper), callback); |
| 126 } | 126 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 139 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 139 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 140 auto* wallpaper_instance = | 140 auto* wallpaper_instance = |
| 141 arc_bridge_service()->wallpaper()->GetInstanceForMethod( | 141 arc_bridge_service()->wallpaper()->GetInstanceForMethod( |
| 142 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); | 142 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); |
| 143 if (!wallpaper_instance) | 143 if (!wallpaper_instance) |
| 144 return; | 144 return; |
| 145 wallpaper_instance->OnWallpaperChanged(); | 145 wallpaper_instance->OnWallpaperChanged(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace arc | 148 } // namespace arc |
| OLD | NEW |