Chromium Code Reviews| Index: components/arc/intent_helper/arc_intent_helper_bridge.cc |
| diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.cc b/components/arc/intent_helper/arc_intent_helper_bridge.cc |
| index dd326fcfe3ab74f92443c1bdc54402e365066fc4..c2a3e9e1639ea261f7b37800cbfa5d82a496a08c 100644 |
| --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc |
| +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc |
| @@ -4,6 +4,7 @@ |
| #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
| +#include <utility> |
| #include <vector> |
| #include "ash/desktop_background/user_wallpaper_delegate.h" |
| @@ -13,6 +14,7 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "components/arc/intent_helper/activity_icon_loader.h" |
| #include "components/arc/intent_helper/link_handler_model_impl.h" |
| +#include "components/arc/set_wallpaper_delegate.h" |
| #include "ui/base/layout.h" |
| #include "url/gurl.h" |
| @@ -20,31 +22,41 @@ namespace arc { |
| ArcIntentHelperBridge::ArcIntentHelperBridge( |
| ArcBridgeService* bridge_service, |
| - const scoped_refptr<ActivityIconLoader>& icon_loader) |
| - : ArcService(bridge_service), binding_(this), icon_loader_(icon_loader) { |
| + const scoped_refptr<ActivityIconLoader>& icon_loader, |
| + std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate) |
| + : ArcService(bridge_service), |
| + binding_(this), |
| + icon_loader_(icon_loader), |
| + set_wallpaper_delegate_(std::move(set_wallpaper_delegate)) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| arc_bridge_service()->AddObserver(this); |
| } |
| ArcIntentHelperBridge::~ArcIntentHelperBridge() { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| arc_bridge_service()->RemoveObserver(this); |
| } |
| void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| ash::Shell::GetInstance()->set_link_handler_model_factory(this); |
| arc_bridge_service()->intent_helper_instance()->Init( |
| binding_.CreateInterfacePtrAndBind()); |
| } |
| void ArcIntentHelperBridge::OnIntentHelperInstanceClosed() { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| ash::Shell::GetInstance()->set_link_handler_model_factory(nullptr); |
| } |
| void ArcIntentHelperBridge::OnIconInvalidated( |
| const mojo::String& package_name) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| icon_loader_->InvalidateIcons(package_name); |
| } |
| void ArcIntentHelperBridge::OnOpenDownloads() { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| // TODO(607411): If the FileManager is not yet open this will open to |
| // downloads by default, which is what we want. However if it is open it will |
| // simply be brought to the forgeground without forcibly being navigated to |
| @@ -53,16 +65,26 @@ void ArcIntentHelperBridge::OnOpenDownloads() { |
| } |
| void ArcIntentHelperBridge::OnOpenUrl(const mojo::String& url) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| GURL gurl(url.get()); |
| ash::Shell::GetInstance()->delegate()->OpenUrl(gurl); |
| } |
| void ArcIntentHelperBridge::OpenWallpaperPicker() { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| ash::Shell::GetInstance()->user_wallpaper_delegate()->OpenSetWallpaperPage(); |
| } |
| +void ArcIntentHelperBridge::SetWallpaper(mojo::Array<uint8_t> jpeg_data) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + std::string jpeg_data_as_string( |
| + reinterpret_cast<const char*>(&jpeg_data.storage()[0]), jpeg_data.size()); |
| + set_wallpaper_delegate_->SetWallpaper(jpeg_data_as_string); |
|
Yusuke Sato
2016/06/15 19:44:32
nit:
SetWallpaper(jpeg_data.PassStorage()); or s
Shuhei Takahashi
2016/06/15 22:58:39
That sounds better, I've updated the patch to use
|
| +} |
| + |
| std::unique_ptr<ash::LinkHandlerModel> ArcIntentHelperBridge::CreateModel( |
| const GURL& url) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| std::unique_ptr<LinkHandlerModelImpl> impl( |
| new LinkHandlerModelImpl(icon_loader_)); |
| if (!impl->Init(url)) |