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_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 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 ~Broadcast(); | 27 ~Broadcast(); |
| 28 | 28 |
| 29 Broadcast(const Broadcast& broadcast); | 29 Broadcast(const Broadcast& broadcast); |
| 30 | 30 |
| 31 std::string action; | 31 std::string action; |
| 32 std::string package_name; | 32 std::string package_name; |
| 33 std::string cls; | 33 std::string cls; |
| 34 std::string extras; | 34 std::string extras; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Parameters passed to HandleIntent(). Optional fields are saved as empty | |
| 38 // strings. | |
| 39 struct HandledIntent { | |
|
Daniel Erat
2016/12/16 02:29:03
i tried hard to make this class have IntentInfoPtr
hidehiko
2016/12/16 04:27:12
How about;
struct HandledIntent {
HandledIntent
Daniel Erat
2016/12/16 05:41:04
i tried something similar to this earlier, but i'm
hidehiko
2016/12/16 06:30:20
Wow, the copied error message is very easy to unde
| |
| 40 HandledIntent(const mojom::IntentInfoPtr& intent, | |
| 41 const mojom::ActivityNamePtr& activity); | |
| 42 HandledIntent(const HandledIntent& other); | |
| 43 ~HandledIntent(); | |
| 44 | |
| 45 std::string action; | |
| 46 std::vector<std::string> categories; | |
| 47 std::string data; | |
| 48 std::string type; | |
| 49 std::string clip_data_uri; | |
| 50 std::string package; | |
| 51 std::string activity; | |
| 52 }; | |
| 53 | |
| 37 void clear_broadcasts() { broadcasts_.clear(); } | 54 void clear_broadcasts() { broadcasts_.clear(); } |
| 55 void clear_handled_intents() { handled_intents_.clear(); } | |
| 38 | 56 |
| 39 const std::vector<Broadcast>& broadcasts() const { return broadcasts_; } | 57 const std::vector<Broadcast>& broadcasts() const { return broadcasts_; } |
| 58 const std::vector<HandledIntent>& handled_intents() const { | |
| 59 return handled_intents_; | |
| 60 } | |
| 61 | |
| 62 // Sets a list of intent handlers to be returned in response to a | |
| 63 // RequestIntentHandlerList() call with an intent containing |action|. Note | |
| 64 // that the handlers will need to be set again after the | |
| 65 // RequestIntentHandlerList() call is made. | |
|
Daniel Erat
2016/12/16 02:29:03
do you know of any way to duplicate the IntentHand
hidehiko
2016/12/16 04:27:12
IntentHandlerInfoPtr::Clone() is what you need?
ht
Daniel Erat
2016/12/16 05:41:04
thanks, i missed this when i was looking through t
| |
| 66 void SetIntentHandlers( | |
| 67 const std::string& action, | |
| 68 std::vector<mojom::IntentHandlerInfoPtr> handlers); | |
| 40 | 69 |
| 41 // mojom::IntentHelperInstance: | 70 // mojom::IntentHelperInstance: |
| 42 ~FakeIntentHelperInstance() override; | 71 ~FakeIntentHelperInstance() override; |
| 43 | 72 |
| 44 void AddPreferredPackage(const std::string& package_name) override; | 73 void AddPreferredPackage(const std::string& package_name) override; |
| 45 | 74 |
| 46 void GetFileSizeDeprecated( | 75 void GetFileSizeDeprecated( |
| 47 const std::string& url, | 76 const std::string& url, |
| 48 const GetFileSizeDeprecatedCallback& callback) override; | 77 const GetFileSizeDeprecatedCallback& callback) override; |
| 49 | 78 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 const RequestUrlListHandlerListCallback& callback) override; | 110 const RequestUrlListHandlerListCallback& callback) override; |
| 82 | 111 |
| 83 void SendBroadcast(const std::string& action, | 112 void SendBroadcast(const std::string& action, |
| 84 const std::string& package_name, | 113 const std::string& package_name, |
| 85 const std::string& cls, | 114 const std::string& cls, |
| 86 const std::string& extras) override; | 115 const std::string& extras) override; |
| 87 | 116 |
| 88 private: | 117 private: |
| 89 std::vector<Broadcast> broadcasts_; | 118 std::vector<Broadcast> broadcasts_; |
| 90 | 119 |
| 120 // Information about calls to HandleIntent(). | |
| 121 std::vector<HandledIntent> handled_intents_; | |
| 122 | |
| 123 // Map from action names to intent handlers to be returned by | |
| 124 // RequestIntentHandlerList(). | |
| 125 std::map<std::string, std::vector<mojom::IntentHandlerInfoPtr>> | |
|
hidehiko
2016/12/16 04:27:12
Could you add #include <map>?
Daniel Erat
2016/12/16 05:41:04
whoops, done.
| |
| 126 intent_handlers_; | |
| 127 | |
| 91 DISALLOW_COPY_AND_ASSIGN(FakeIntentHelperInstance); | 128 DISALLOW_COPY_AND_ASSIGN(FakeIntentHelperInstance); |
| 92 }; | 129 }; |
| 93 | 130 |
| 94 } // namespace arc | 131 } // namespace arc |
| 95 | 132 |
| 96 #endif // COMPONENTS_ARC_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ | 133 #endif // COMPONENTS_ARC_TEST_FAKE_INTENT_HELPER_INSTANCE_H_ |
| OLD | NEW |