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

Unified Diff: components/arc/intent_helper/arc_intent_helper_bridge.cc

Issue 2061183002: arc: IPC method to set custom wallpaper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style fix. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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 15814543e66fe75fe9e6117a6815fa9f54635636..7810a3ff3754ccbb7b6840d1ecd95a17556986ce 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"
@@ -26,31 +28,41 @@ constexpr char kArcIntentHelperPackageName[] = "org.chromium.arc.intent_helper";
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
@@ -59,16 +71,24 @@ 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());
+ set_wallpaper_delegate_->SetWallpaper(jpeg_data.PassStorage());
+}
+
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))

Powered by Google App Engine
This is Rietveld 408576698