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 #ifndef COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 6 #define COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/link_handler_model_factory.h" | 10 #include "ash/link_handler_model_factory.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/task_runner.h" | |
| 15 #include "base/threading/thread_checker.h" | |
| 13 #include "components/arc/arc_bridge_service.h" | 16 #include "components/arc/arc_bridge_service.h" |
| 14 #include "components/arc/arc_service.h" | 17 #include "components/arc/arc_service.h" |
| 15 #include "components/arc/common/intent_helper.mojom.h" | 18 #include "components/arc/common/intent_helper.mojom.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 20 |
| 18 namespace ash { | 21 namespace ash { |
| 19 | 22 |
| 20 class LinkHandlerModel; | 23 class LinkHandlerModel; |
| 21 | 24 |
| 22 } // namespace ash | 25 } // namespace ash |
| 23 | 26 |
| 27 namespace gfx { | |
| 28 | |
| 29 class ImageSkia; | |
| 30 | |
| 31 } // namespace gfx | |
| 32 | |
| 24 namespace arc { | 33 namespace arc { |
| 25 | 34 |
| 26 class ActivityIconLoader; | 35 class ActivityIconLoader; |
| 36 class SetWallpaperDelegate; | |
| 27 | 37 |
| 28 // Receives intents from ARC. | 38 // Receives intents from ARC. |
| 29 class ArcIntentHelperBridge : public ArcService, | 39 class ArcIntentHelperBridge : public ArcService, |
| 30 public ArcBridgeService::Observer, | 40 public ArcBridgeService::Observer, |
| 31 public mojom::IntentHelperHost, | 41 public mojom::IntentHelperHost, |
| 32 public ash::LinkHandlerModelFactory { | 42 public ash::LinkHandlerModelFactory { |
| 33 public: | 43 public: |
| 34 ArcIntentHelperBridge(ArcBridgeService* bridge_service, | 44 ArcIntentHelperBridge( |
| 35 const scoped_refptr<ActivityIconLoader>& icon_loader); | 45 ArcBridgeService* bridge_service, |
| 46 const scoped_refptr<ActivityIconLoader>& icon_loader, | |
| 47 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | |
| 48 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate); | |
| 36 ~ArcIntentHelperBridge() override; | 49 ~ArcIntentHelperBridge() override; |
| 37 | 50 |
| 38 // ArcBridgeService::Observer | 51 // ArcBridgeService::Observer |
| 39 void OnIntentHelperInstanceReady() override; | 52 void OnIntentHelperInstanceReady() override; |
| 40 void OnIntentHelperInstanceClosed() override; | 53 void OnIntentHelperInstanceClosed() override; |
| 41 | 54 |
| 42 // arc::mojom::IntentHelperHost | 55 // arc::mojom::IntentHelperHost |
| 43 void OnIconInvalidated(const mojo::String& package_name) override; | 56 void OnIconInvalidated(const mojo::String& package_name) override; |
| 44 void OnOpenDownloads() override; | 57 void OnOpenDownloads() override; |
| 45 void OnOpenUrl(const mojo::String& url) override; | 58 void OnOpenUrl(const mojo::String& url) override; |
| 46 void OpenWallpaperPicker() override; | 59 void OpenWallpaperPicker() override; |
| 60 void SetWallpaper(mojo::Array<uint8_t> jpeg_data) override; | |
| 47 | 61 |
| 48 // ash::LinkHandlerModelFactory | 62 // ash::LinkHandlerModelFactory |
| 49 std::unique_ptr<ash::LinkHandlerModel> CreateModel(const GURL& url) override; | 63 std::unique_ptr<ash::LinkHandlerModel> CreateModel(const GURL& url) override; |
| 50 | 64 |
| 51 private: | 65 private: |
| 66 void SetImageAsWallpaper(gfx::ImageSkia image); | |
|
Yusuke Sato
2016/06/15 16:45:01
const reference did you mean? (although it's ref-c
Shuhei Takahashi
2016/06/15 18:14:37
Done.
| |
| 67 | |
| 52 mojo::Binding<mojom::IntentHelperHost> binding_; | 68 mojo::Binding<mojom::IntentHelperHost> binding_; |
| 53 scoped_refptr<ActivityIconLoader> icon_loader_; | 69 scoped_refptr<ActivityIconLoader> icon_loader_; |
| 70 scoped_refptr<base::TaskRunner> blocking_task_runner_; | |
| 71 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate_; | |
| 72 | |
| 73 base::ThreadChecker thread_checker_; | |
| 74 | |
| 75 // Note: This should remain the last member so it'll be destroyed and | |
| 76 // invalidate its weak pointers before any other members are destroyed. | |
| 77 base::WeakPtrFactory<ArcIntentHelperBridge> weak_factory_; | |
| 54 | 78 |
| 55 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); | 79 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); |
| 56 }; | 80 }; |
| 57 | 81 |
| 58 } // namespace arc | 82 } // namespace arc |
| 59 | 83 |
| 60 #endif // COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 84 #endif // COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
| OLD | NEW |