Commit 0caeced0 authored by derat's avatar derat Committed by Commit bot

arc: Add action to IntentHandlerInfo and rename enum fields.

Rename IntentHandlerInfo's ActionType field from "action" to
"action_type" and add a new string "action" field. Update
Chrome to use the enum field's new name.

In the IntentHelperInstance interface, also rename
HandleUrlList and HandleUrlListDeprecated's ActionType
parameters from "action" to "action_type". The method
signatures remain unchanged.

BUG=647802

Review-Url: https://codereview.chromium.org/2396633002
Cr-Commit-Position: refs/heads/master@{#422994}
parent be15d9ac
...@@ -75,8 +75,8 @@ scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { ...@@ -75,8 +75,8 @@ scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() {
return arc_service_manager->icon_loader(); return arc_service_manager->icon_loader();
} }
std::string ArcActionToString(arc::mojom::ActionType action) { std::string ArcActionTypeToString(arc::mojom::ActionType action_type) {
switch (action) { switch (action_type) {
case arc::mojom::ActionType::VIEW: case arc::mojom::ActionType::VIEW:
return "view"; return "view";
case arc::mojom::ActionType::SEND: case arc::mojom::ActionType::SEND:
...@@ -88,7 +88,7 @@ std::string ArcActionToString(arc::mojom::ActionType action) { ...@@ -88,7 +88,7 @@ std::string ArcActionToString(arc::mojom::ActionType action) {
return ""; return "";
} }
arc::mojom::ActionType StringToArcAction(const std::string& str) { arc::mojom::ActionType StringToArcActionType(const std::string& str) {
if (str == "view") if (str == "view")
return arc::mojom::ActionType::VIEW; return arc::mojom::ActionType::VIEW;
if (str == "send") if (str == "send")
...@@ -253,8 +253,8 @@ void OnArcIconEncoded( ...@@ -253,8 +253,8 @@ void OnArcIconEncoded(
for (const arc::mojom::IntentHandlerInfoPtr& handler : handlers) { for (const arc::mojom::IntentHandlerInfoPtr& handler : handlers) {
std::string name(handler->name); std::string name(handler->name);
Verb handler_verb = Verb::VERB_NONE; Verb handler_verb = Verb::VERB_NONE;
if (handler->action == arc::mojom::ActionType::SEND || if (handler->action_type == arc::mojom::ActionType::SEND ||
handler->action == arc::mojom::ActionType::SEND_MULTIPLE) { handler->action_type == arc::mojom::ActionType::SEND_MULTIPLE) {
handler_verb = Verb::VERB_SHARE_WITH; handler_verb = Verb::VERB_SHARE_WITH;
} }
const GURL& icon_url = (*icons)[arc::ActivityIconLoader::ActivityName( const GURL& icon_url = (*icons)[arc::ActivityIconLoader::ActivityName(
...@@ -262,9 +262,9 @@ void OnArcIconEncoded( ...@@ -262,9 +262,9 @@ void OnArcIconEncoded(
result_list->push_back(FullTaskDescriptor( result_list->push_back(FullTaskDescriptor(
TaskDescriptor( TaskDescriptor(
ActivityNameToAppId(handler->package_name, handler->activity_name), ActivityNameToAppId(handler->package_name, handler->activity_name),
TASK_TYPE_ARC_APP, ArcActionToString(handler->action)), TASK_TYPE_ARC_APP, ArcActionTypeToString(handler->action_type)),
name, handler_verb, icon_url, false /* is_default */, name, handler_verb, icon_url, false /* is_default */,
handler->action != arc::mojom::ActionType::VIEW /* is_generic */)); handler->action_type != arc::mojom::ActionType::VIEW /* is_generic */));
} }
callback.Run(std::move(result_list)); callback.Run(std::move(result_list));
} }
...@@ -341,11 +341,11 @@ bool ExecuteArcTask(Profile* profile, ...@@ -341,11 +341,11 @@ bool ExecuteArcTask(Profile* profile,
kArcIntentHelperVersionWithFullActivityName)) { kArcIntentHelperVersionWithFullActivityName)) {
arc_intent_helper->HandleUrlList(std::move(urls), arc_intent_helper->HandleUrlList(std::move(urls),
AppIdToActivityName(task.app_id), AppIdToActivityName(task.app_id),
StringToArcAction(task.action_id)); StringToArcActionType(task.action_id));
} else { } else {
arc_intent_helper->HandleUrlListDeprecated( arc_intent_helper->HandleUrlListDeprecated(
std::move(urls), AppIdToActivityName(task.app_id)->package_name, std::move(urls), AppIdToActivityName(task.app_id)->package_name,
StringToArcAction(task.action_id)); StringToArcActionType(task.action_id));
} }
return true; return true;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Next MinVersion: 11 // Next MinVersion: 12
module arc.mojom; module arc.mojom;
...@@ -46,8 +46,9 @@ struct IntentHandlerInfo { ...@@ -46,8 +46,9 @@ struct IntentHandlerInfo {
string name; string name;
string package_name; string package_name;
string activity_name; // A hint for retrieving the package's icon. string activity_name; // A hint for retrieving the package's icon.
[MinVersion=4] ActionType action; [MinVersion=4] ActionType action_type;
[MinVersion=6] bool is_preferred; [MinVersion=6] bool is_preferred;
[MinVersion=11] string? action; // e.g. "android.intent.action.VIEW"
}; };
// Describes an activity. // Describes an activity.
...@@ -112,12 +113,12 @@ interface IntentHelperInstance { ...@@ -112,12 +113,12 @@ interface IntentHelperInstance {
// Handles the list of URLs by sending a specified intent to the handler. // Handles the list of URLs by sending a specified intent to the handler.
[MinVersion=5] HandleUrlList@7(array<UrlWithMimeType> urls, [MinVersion=5] HandleUrlList@7(array<UrlWithMimeType> urls,
ActivityName activity, ActivityName activity,
ActionType action); ActionType action_type);
// Deprecated. Use HandleUrlList. // Deprecated. Use HandleUrlList.
[MinVersion=4] HandleUrlListDeprecated@5(array<UrlWithMimeType> urls, [MinVersion=4] HandleUrlListDeprecated@5(array<UrlWithMimeType> urls,
string package_name, string package_name,
ActionType action); ActionType action_type);
// Establishes full-duplex communication with the host. // Establishes full-duplex communication with the host.
Init@0(IntentHelperHost host_ptr); Init@0(IntentHelperHost host_ptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment