Commit 4bf506a2 authored by hscham's avatar hscham Committed by Commit Bot

Sync component/arc/mojom/ directory with arc

* Add copyright header to app.typemap
* Remove HandleUrlListDeprecated in intent_helper.mojom; it was deleted
  on pi-arc and rvc-arc already
  (ag/q/I5a0c28adfc77fe68710b1efd3d8db02a156a25a4)

BUG=b:147599855, b:149070836, 163091058
TEST=autoninja -C out/Default chrome

Change-Id: I1b88c146327f165111462cd74c455ada12611892
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352306
Commit-Queue: Naoki Fukino <fukino@chromium.org>
Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarSatoshi Niwa <niwa@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Auto-Submit: Grace Cham <hscham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800061}
parent b95fe817
...@@ -92,22 +92,6 @@ arc::mojom::ActivityNamePtr AppIdToActivityName(const std::string& id) { ...@@ -92,22 +92,6 @@ arc::mojom::ActivityNamePtr AppIdToActivityName(const std::string& id) {
return name; return name;
} }
// Constructs a vector of UrlWithMimeType to be passed to
// IntentHelperInstance.HandleUrlListDeprecated.
std::vector<arc::mojom::UrlWithMimeTypePtr> ConstructUrlWithMimeTypeList(
const std::vector<GURL>& content_urls,
const std::vector<std::string>& mime_types) {
std::vector<arc::mojom::UrlWithMimeTypePtr> urls;
for (size_t i = 0; i < content_urls.size(); ++i) {
arc::mojom::UrlWithMimeTypePtr url_with_type =
arc::mojom::UrlWithMimeType::New();
url_with_type->url = content_urls[i].spec();
url_with_type->mime_type = mime_types[i];
urls.push_back(std::move(url_with_type));
}
return urls;
}
// Constructs an OpenUrlsRequest to be passed to // Constructs an OpenUrlsRequest to be passed to
// FileSystemInstance.OpenUrlsWithPermission. // FileSystemInstance.OpenUrlsWithPermission.
arc::mojom::OpenUrlsRequestPtr ConstructOpenUrlsRequest( arc::mojom::OpenUrlsRequestPtr ConstructOpenUrlsRequest(
...@@ -292,51 +276,26 @@ void ExecuteArcTaskAfterContentUrlsResolved( ...@@ -292,51 +276,26 @@ void ExecuteArcTaskAfterContentUrlsResolved(
return; return;
} }
// Try FileSystemInstance.OpenUrlsWithPermission first.
arc::mojom::FileSystemInstance* arc_file_system = ARC_GET_INSTANCE_FOR_METHOD( arc::mojom::FileSystemInstance* arc_file_system = ARC_GET_INSTANCE_FOR_METHOD(
arc_service_manager->arc_bridge_service()->file_system(), arc_service_manager->arc_bridge_service()->file_system(),
OpenUrlsWithPermission); OpenUrlsWithPermission);
if (arc_file_system) { if (!arc_file_system) {
arc::mojom::OpenUrlsRequestPtr request =
ConstructOpenUrlsRequest(task, content_urls, mime_types);
arc_file_system->OpenUrlsWithPermission(std::move(request),
base::DoNothing());
std::move(done).Run( std::move(done).Run(
extensions::api::file_manager_private::TASK_RESULT_MESSAGE_SENT, ""); extensions::api::file_manager_private::TASK_RESULT_FAILED,
"OpenUrlsWithPermission is not supported");
UMA_HISTOGRAM_ENUMERATION(
"Arc.UserInteraction",
arc::UserInteractionType::APP_STARTED_FROM_FILE_MANAGER);
return; return;
} }
// Use IntentHelperInstance.HandleUrlListDeprecated as a fallback if arc::mojom::OpenUrlsRequestPtr request =
// OpenUrlsWithPermission is not supported yet. ConstructOpenUrlsRequest(task, content_urls, mime_types);
// TODO(niwa): Remove this once we complete migration. arc_file_system->OpenUrlsWithPermission(std::move(request),
arc::mojom::IntentHelperInstance* arc_intent_helper = base::DoNothing());
ARC_GET_INSTANCE_FOR_METHOD( std::move(done).Run(
arc_service_manager->arc_bridge_service()->intent_helper(), extensions::api::file_manager_private::TASK_RESULT_MESSAGE_SENT, "");
HandleUrlListDeprecated);
if (arc_intent_helper) {
LOG(WARNING) << "Using HandleUrlListDeprecated because "
<< "OpenUrlsWithPermission is not supported yet.";
arc_intent_helper->HandleUrlListDeprecated(
ConstructUrlWithMimeTypeList(content_urls, mime_types),
AppIdToActivityName(task.app_id),
FileTaskActionIdToArcActionType(task.action_id));
std::move(done).Run(
extensions::api::file_manager_private::TASK_RESULT_MESSAGE_SENT, "");
UMA_HISTOGRAM_ENUMERATION(
"Arc.UserInteraction",
arc::UserInteractionType::APP_STARTED_FROM_FILE_MANAGER);
return;
}
std::move(done).Run(extensions::api::file_manager_private::TASK_RESULT_FAILED, UMA_HISTOGRAM_ENUMERATION(
"No android app to run task"); "Arc.UserInteraction",
arc::UserInteractionType::APP_STARTED_FROM_FILE_MANAGER);
} }
} // namespace } // namespace
......
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
mojom = "//components/arc/mojom/app.mojom" mojom = "//components/arc/mojom/app.mojom"
public_headers = [ "//components/arc/app/arc_playstore_search_request_state.h" ] public_headers = [ "//components/arc/app/arc_playstore_search_request_state.h" ]
traits_headers = [ "//components/arc/mojom/app_mojom_traits.h" ] traits_headers = [ "//components/arc/mojom/app_mojom_traits.h" ]
......
...@@ -327,6 +327,7 @@ interface IntentHelperHost { ...@@ -327,6 +327,7 @@ interface IntentHelperHost {
}; };
// Sends intents to ARC on behalf of Chrome. // Sends intents to ARC on behalf of Chrome.
// Deprecated method ID: 7
// Next method ID: 20 // Next method ID: 20
interface IntentHelperInstance { interface IntentHelperInstance {
// Sets the given package as a preferred package. The next time an ACTION_VIEW // Sets the given package as a preferred package. The next time an ACTION_VIEW
...@@ -361,11 +362,6 @@ interface IntentHelperInstance { ...@@ -361,11 +362,6 @@ interface IntentHelperInstance {
// most suitable activity for the URL within the package will be started. // most suitable activity for the URL within the package will be started.
[MinVersion=2] HandleUrl@2(string url, string package_name); [MinVersion=2] HandleUrl@2(string url, string package_name);
// DEPRECATED. Use FileSystemInstance.OpenUrlsWithPermission() instead.
[MinVersion=5] HandleUrlListDeprecated@7(array<UrlWithMimeType> urls,
ActivityName activity,
ActionType action_type);
// DEPRECATED: Please use Init@13 instead. // DEPRECATED: Please use Init@13 instead.
InitDeprecated@0(pending_remote<IntentHelperHost> host_remote); InitDeprecated@0(pending_remote<IntentHelperHost> host_remote);
......
...@@ -73,11 +73,6 @@ void FakeIntentHelperInstance::HandleIntent(mojom::IntentInfoPtr intent, ...@@ -73,11 +73,6 @@ void FakeIntentHelperInstance::HandleIntent(mojom::IntentInfoPtr intent,
void FakeIntentHelperInstance::HandleUrl(const std::string& url, void FakeIntentHelperInstance::HandleUrl(const std::string& url,
const std::string& package_name) {} const std::string& package_name) {}
void FakeIntentHelperInstance::HandleUrlListDeprecated(
std::vector<mojom::UrlWithMimeTypePtr> urls,
mojom::ActivityNamePtr activity,
mojom::ActionType action) {}
void FakeIntentHelperInstance::InitDeprecated( void FakeIntentHelperInstance::InitDeprecated(
mojo::PendingRemote<mojom::IntentHelperHost> host_remote) { mojo::PendingRemote<mojom::IntentHelperHost> host_remote) {
Init(std::move(host_remote), base::DoNothing()); Init(std::move(host_remote), base::DoNothing());
......
...@@ -85,10 +85,6 @@ class FakeIntentHelperInstance : public mojom::IntentHelperInstance { ...@@ -85,10 +85,6 @@ class FakeIntentHelperInstance : public mojom::IntentHelperInstance {
void HandleUrl(const std::string& url, void HandleUrl(const std::string& url,
const std::string& package_name) override; const std::string& package_name) override;
void HandleUrlListDeprecated(std::vector<mojom::UrlWithMimeTypePtr> urls,
mojom::ActivityNamePtr activity,
mojom::ActionType action) override;
void InitDeprecated( void InitDeprecated(
mojo::PendingRemote<mojom::IntentHelperHost> host_remote) override; mojo::PendingRemote<mojom::IntentHelperHost> host_remote) override;
......
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