| 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_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ | 5 #ifndef COMPONENTS_ARC_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ |
| 6 #define COMPONENTS_ARC_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ | 6 #define COMPONENTS_ARC_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "components/arc/common/intent_helper.mojom.h" | 12 #include "components/arc/common/intent_helper.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | |
| 14 | 13 |
| 15 namespace arc { | 14 namespace arc { |
| 16 | 15 |
| 17 class FakeIntentHelperInstance : public mojom::IntentHelperInstance { | 16 class FakeIntentHelperInstance : public mojom::IntentHelperInstance { |
| 18 public: | 17 public: |
| 19 FakeIntentHelperInstance(); | 18 FakeIntentHelperInstance(); |
| 20 | 19 |
| 21 class Broadcast { | 20 class Broadcast { |
| 22 public: | 21 public: |
| 23 Broadcast(const mojo::String& action, | 22 Broadcast(const std::string& action, |
| 24 const mojo::String& package_name, | 23 const std::string& package_name, |
| 25 const mojo::String& cls, | 24 const std::string& cls, |
| 26 const mojo::String& extras); | 25 const std::string& extras); |
| 27 | 26 |
| 28 ~Broadcast(); | 27 ~Broadcast(); |
| 29 | 28 |
| 30 Broadcast(const Broadcast& broadcast); | 29 Broadcast(const Broadcast& broadcast); |
| 31 | 30 |
| 32 std::string action; | 31 std::string action; |
| 33 std::string package_name; | 32 std::string package_name; |
| 34 std::string cls; | 33 std::string cls; |
| 35 std::string extras; | 34 std::string extras; |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 void clear_broadcasts() { broadcasts_.clear(); } | 37 void clear_broadcasts() { broadcasts_.clear(); } |
| 39 | 38 |
| 40 const std::vector<Broadcast>& broadcasts() const { return broadcasts_; } | 39 const std::vector<Broadcast>& broadcasts() const { return broadcasts_; } |
| 41 | 40 |
| 42 // mojom::IntentHelperInstance: | 41 // mojom::IntentHelperInstance: |
| 43 ~FakeIntentHelperInstance() override; | 42 ~FakeIntentHelperInstance() override; |
| 44 | 43 |
| 45 void AddPreferredPackage(const mojo::String& package_name) override; | 44 void AddPreferredPackage(const std::string& package_name) override; |
| 46 | 45 |
| 47 void GetFileSize(const mojo::String& url, | 46 void GetFileSize(const std::string& url, |
| 48 const GetFileSizeCallback& callback) override; | 47 const GetFileSizeCallback& callback) override; |
| 49 | 48 |
| 50 void HandleIntent(mojom::IntentInfoPtr intent, | 49 void HandleIntent(mojom::IntentInfoPtr intent, |
| 51 mojom::ActivityNamePtr activity) override; | 50 mojom::ActivityNamePtr activity) override; |
| 52 | 51 |
| 53 void HandleUrl(const mojo::String& url, | 52 void HandleUrl(const std::string& url, |
| 54 const mojo::String& package_name) override; | 53 const std::string& package_name) override; |
| 55 | 54 |
| 56 void HandleUrlList(mojo::Array<mojom::UrlWithMimeTypePtr> urls, | 55 void HandleUrlList(std::vector<mojom::UrlWithMimeTypePtr> urls, |
| 57 mojom::ActivityNamePtr activity, | 56 mojom::ActivityNamePtr activity, |
| 58 mojom::ActionType action) override; | 57 mojom::ActionType action) override; |
| 59 | 58 |
| 60 void Init(mojom::IntentHelperHostPtr host_ptr) override; | 59 void Init(mojom::IntentHelperHostPtr host_ptr) override; |
| 61 | 60 |
| 62 void OpenFileToRead(const mojo::String& url, | 61 void OpenFileToRead(const std::string& url, |
| 63 const OpenFileToReadCallback& callback) override; | 62 const OpenFileToReadCallback& callback) override; |
| 64 | 63 |
| 65 void RequestActivityIcons( | 64 void RequestActivityIcons( |
| 66 mojo::Array<mojom::ActivityNamePtr> activities, | 65 std::vector<mojom::ActivityNamePtr> activities, |
| 67 ::arc::mojom::ScaleFactor scale_factor, | 66 ::arc::mojom::ScaleFactor scale_factor, |
| 68 const RequestActivityIconsCallback& callback) override; | 67 const RequestActivityIconsCallback& callback) override; |
| 69 | 68 |
| 70 void RequestIntentHandlerList( | 69 void RequestIntentHandlerList( |
| 71 mojom::IntentInfoPtr intent, | 70 mojom::IntentInfoPtr intent, |
| 72 const RequestIntentHandlerListCallback& callback) override; | 71 const RequestIntentHandlerListCallback& callback) override; |
| 73 | 72 |
| 74 void RequestUrlHandlerList( | 73 void RequestUrlHandlerList( |
| 75 const mojo::String& url, | 74 const std::string& url, |
| 76 const RequestUrlHandlerListCallback& callback) override; | 75 const RequestUrlHandlerListCallback& callback) override; |
| 77 | 76 |
| 78 void RequestUrlListHandlerList( | 77 void RequestUrlListHandlerList( |
| 79 mojo::Array<mojom::UrlWithMimeTypePtr> urls, | 78 std::vector<mojom::UrlWithMimeTypePtr> urls, |
| 80 const RequestUrlListHandlerListCallback& callback) override; | 79 const RequestUrlListHandlerListCallback& callback) override; |
| 81 | 80 |
| 82 void SendBroadcast(const mojo::String& action, | 81 void SendBroadcast(const std::string& action, |
| 83 const mojo::String& package_name, | 82 const std::string& package_name, |
| 84 const mojo::String& cls, | 83 const std::string& cls, |
| 85 const mojo::String& extras) override; | 84 const std::string& extras) override; |
| 86 | 85 |
| 87 private: | 86 private: |
| 88 std::vector<Broadcast> broadcasts_; | 87 std::vector<Broadcast> broadcasts_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(FakeIntentHelperInstance); | 89 DISALLOW_COPY_AND_ASSIGN(FakeIntentHelperInstance); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace arc | 92 } // namespace arc |
| 94 | 93 |
| 95 #endif // COMPONENTS_ARC_TEST_FAKE_POLICY_INSTANCE_H_ | 94 #endif // COMPONENTS_ARC_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ |
| OLD | NEW |