Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/chromeos/file_manager/arc_file_tasks.cc

Issue 1872223002: Add verbs API to file handlers. Modify the Chrome OS UI so that it displayes the internationalized … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move back to "open-with" for the id of the more actions dialog, as it breaks some browsers tests, a… Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/chromeos/file_manager/arc_file_tasks.h" 5 #include "chrome/browser/chromeos/file_manager/arc_file_tasks.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/chromeos/file_manager/path_util.h" 15 #include "chrome/browser/chromeos/file_manager/path_util.h"
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" 16 #include "chrome/browser/chromeos/profiles/profile_helper.h"
17 #include "chrome/common/extensions/api/file_manager_private.h" 17 #include "chrome/common/extensions/api/file_manager_private.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "components/arc/arc_bridge_service.h" 19 #include "components/arc/arc_bridge_service.h"
20 #include "components/arc/common/intent_helper.mojom.h" 20 #include "components/arc/common/intent_helper.mojom.h"
21 #include "components/user_manager/user_manager.h" 21 #include "components/user_manager/user_manager.h"
22 #include "extensions/browser/entry_info.h" 22 #include "extensions/browser/entry_info.h"
23 #include "mojo/public/cpp/bindings/binding.h" 23 #include "mojo/public/cpp/bindings/binding.h"
24 #include "net/base/filename_util.h" 24 #include "net/base/filename_util.h"
25 #include "storage/browser/fileapi/file_system_url.h" 25 #include "storage/browser/fileapi/file_system_url.h"
26 #include "ui/base/l10n/l10n_util.h"
27 #include "url/gurl.h" 26 #include "url/gurl.h"
28 27
29 namespace file_manager { 28 namespace file_manager {
30 namespace file_tasks { 29 namespace file_tasks {
31 30
32 namespace { 31 namespace {
33 32
34 constexpr int kArcIntentHelperVersionWithUrlListSupport = 4; 33 constexpr int kArcIntentHelperVersionWithUrlListSupport = 4;
35 constexpr int kArcIntentHelperVersionWithFullActivityName = 5; 34 constexpr int kArcIntentHelperVersionWithFullActivityName = 5;
36 35
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 129 }
131 130
132 // TODO(kinaba): Add conversion logic once other file systems are supported. 131 // TODO(kinaba): Add conversion logic once other file systems are supported.
133 return false; 132 return false;
134 } 133 }
135 134
136 void OnArcHandlerList( 135 void OnArcHandlerList(
137 std::unique_ptr<std::vector<FullTaskDescriptor>> result_list, 136 std::unique_ptr<std::vector<FullTaskDescriptor>> result_list,
138 const FindTasksCallback& callback, 137 const FindTasksCallback& callback,
139 mojo::Array<arc::mojom::UrlHandlerInfoPtr> handlers) { 138 mojo::Array<arc::mojom::UrlHandlerInfoPtr> handlers) {
139 using extensions::api::file_manager_private::Verb;
140 for (const arc::mojom::UrlHandlerInfoPtr& handler : handlers) { 140 for (const arc::mojom::UrlHandlerInfoPtr& handler : handlers) {
141 // TODO(crbug.com/578725): Wire action to "verb" once it's implemented.
142 std::string name(handler->name); 141 std::string name(handler->name);
142 Verb handler_verb = Verb::VERB_NONE;
143 if (handler->action == arc::mojom::ActionType::SEND || 143 if (handler->action == arc::mojom::ActionType::SEND ||
144 handler->action == arc::mojom::ActionType::SEND_MULTIPLE) { 144 handler->action == arc::mojom::ActionType::SEND_MULTIPLE) {
145 name = l10n_util::GetStringFUTF8(IDS_FILE_BROWSER_SHARE_WITH_ACTION_LABEL, 145 handler_verb = Verb::VERB_SHARE_WITH;
146 base::UTF8ToUTF16(name));
147 } 146 }
148 result_list->push_back(FullTaskDescriptor( 147 result_list->push_back(FullTaskDescriptor(
149 TaskDescriptor( 148 TaskDescriptor(
150 ActivityNameToAppId(handler->package_name, handler->activity_name), 149 ActivityNameToAppId(handler->package_name, handler->activity_name),
151 TASK_TYPE_ARC_APP, ArcActionToString(handler->action)), 150 TASK_TYPE_ARC_APP, ArcActionToString(handler->action)),
152 name, 151 handler->name, handler_verb,
153 GURL(""), // TODO: get the icon 152 GURL(""), // TODO: get the icon
154 false, // is_default, 153 false, // is_default,
155 handler->action != arc::mojom::ActionType::VIEW // is_generic 154 handler->action != arc::mojom::ActionType::VIEW // is_generic
156 )); 155 ));
157 } 156 }
158 callback.Run(std::move(result_list)); 157 callback.Run(std::move(result_list));
159 } 158 }
160 159
161 } // namespace 160 } // namespace
162 161
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } else { 222 } else {
224 arc_intent_helper->HandleUrlListDeprecated( 223 arc_intent_helper->HandleUrlListDeprecated(
225 std::move(urls), AppIdToActivityName(task.app_id)->package_name, 224 std::move(urls), AppIdToActivityName(task.app_id)->package_name,
226 StringToArcAction(task.action_id)); 225 StringToArcAction(task.action_id));
227 } 226 }
228 return true; 227 return true;
229 } 228 }
230 229
231 } // namespace file_tasks 230 } // namespace file_tasks
232 } // namespace file_manager 231 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698