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 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "ash/link_handler_model_factory.h" | 11 #include "ash/link_handler_model_factory.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "components/arc/arc_bridge_service.h" | 15 #include "components/arc/arc_bridge_service.h" |
| 16 #include "components/arc/arc_service.h" | 16 #include "components/arc/arc_service.h" |
| 17 #include "components/arc/common/intent_helper.mojom.h" | 17 #include "components/arc/common/intent_helper.mojom.h" |
| 18 #include "mojo/public/cpp/bindings/binding.h" | 18 #include "mojo/public/cpp/bindings/binding.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 | 21 |
| 22 class LinkHandlerModel; | 22 class LinkHandlerModel; |
| 23 | 23 |
| 24 } // namespace ash | 24 } // namespace ash |
| 25 | 25 |
| 26 namespace arc { | 26 namespace arc { |
| 27 | 27 |
| 28 class ActivityIconLoader; | 28 class ActivityIconLoader; |
| 29 class SetWallpaperDelegate; | 29 class SetWallpaperDelegate; |
| 30 class LocalActivityResolver; | |
|
Yusuke Sato
2016/06/17 23:14:32
nit: sort?
zentaro
2016/06/17 23:37:35
Done.
| |
| 30 | 31 |
| 31 // Receives intents from ARC. | 32 // Receives intents from ARC. |
| 32 class ArcIntentHelperBridge : public ArcService, | 33 class ArcIntentHelperBridge : public ArcService, |
| 33 public ArcBridgeService::Observer, | 34 public ArcBridgeService::Observer, |
| 34 public mojom::IntentHelperHost, | 35 public mojom::IntentHelperHost, |
| 35 public ash::LinkHandlerModelFactory { | 36 public ash::LinkHandlerModelFactory { |
| 36 public: | 37 public: |
| 37 ArcIntentHelperBridge( | 38 ArcIntentHelperBridge( |
| 38 ArcBridgeService* bridge_service, | 39 ArcBridgeService* bridge_service, |
| 39 const scoped_refptr<ActivityIconLoader>& icon_loader, | 40 const scoped_refptr<ActivityIconLoader>& icon_loader, |
| 40 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate); | 41 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate, |
| 42 const scoped_refptr<LocalActivityResolver>& activity_resolver); | |
| 41 ~ArcIntentHelperBridge() override; | 43 ~ArcIntentHelperBridge() override; |
| 42 | 44 |
| 43 // ArcBridgeService::Observer | 45 // ArcBridgeService::Observer |
| 44 void OnIntentHelperInstanceReady() override; | 46 void OnIntentHelperInstanceReady() override; |
| 45 void OnIntentHelperInstanceClosed() override; | 47 void OnIntentHelperInstanceClosed() override; |
| 46 | 48 |
| 47 // arc::mojom::IntentHelperHost | 49 // arc::mojom::IntentHelperHost |
| 48 void OnIconInvalidated(const mojo::String& package_name) override; | 50 void OnIconInvalidated(const mojo::String& package_name) override; |
| 51 void OnIntentFiltersUpdated( | |
| 52 mojo::Array<mojom::IntentFilterPtr> intent_filters) override; | |
| 49 void OnOpenDownloads() override; | 53 void OnOpenDownloads() override; |
| 50 void OnOpenUrl(const mojo::String& url) override; | 54 void OnOpenUrl(const mojo::String& url) override; |
| 51 void OpenWallpaperPicker() override; | 55 void OpenWallpaperPicker() override; |
| 52 void SetWallpaper(mojo::Array<uint8_t> jpeg_data) override; | 56 void SetWallpaper(mojo::Array<uint8_t> jpeg_data) override; |
| 53 | 57 |
| 54 // ash::LinkHandlerModelFactory | 58 // ash::LinkHandlerModelFactory |
| 55 std::unique_ptr<ash::LinkHandlerModel> CreateModel(const GURL& url) override; | 59 std::unique_ptr<ash::LinkHandlerModel> CreateModel(const GURL& url) override; |
| 56 | 60 |
| 57 // Returns false if |package_name| is for the intent_helper apk. | 61 // Returns false if |package_name| is for the intent_helper apk. |
| 58 static bool IsIntentHelperPackage(const std::string& package_name); | 62 static bool IsIntentHelperPackage(const std::string& package_name); |
| 59 | 63 |
| 60 // Filters out handlers that belong to the intent_helper apk and returns | 64 // Filters out handlers that belong to the intent_helper apk and returns |
| 61 // a new array. | 65 // a new array. |
| 62 static mojo::Array<mojom::UrlHandlerInfoPtr> FilterOutIntentHelper( | 66 static mojo::Array<mojom::UrlHandlerInfoPtr> FilterOutIntentHelper( |
| 63 mojo::Array<mojom::UrlHandlerInfoPtr> handlers); | 67 mojo::Array<mojom::UrlHandlerInfoPtr> handlers); |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 mojo::Binding<mojom::IntentHelperHost> binding_; | 70 mojo::Binding<mojom::IntentHelperHost> binding_; |
| 67 scoped_refptr<ActivityIconLoader> icon_loader_; | 71 scoped_refptr<ActivityIconLoader> icon_loader_; |
| 68 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate_; | 72 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate_; |
| 73 scoped_refptr<LocalActivityResolver> activity_resolver_; | |
| 69 | 74 |
| 70 base::ThreadChecker thread_checker_; | 75 base::ThreadChecker thread_checker_; |
| 71 | 76 |
| 72 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); | 77 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); |
| 73 }; | 78 }; |
| 74 | 79 |
| 75 } // namespace arc | 80 } // namespace arc |
| 76 | 81 |
| 77 #endif // COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 82 #endif // COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
| OLD | NEW |