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

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

Issue 2396633002: arc: Add action to IntentHandlerInfo and rename enum fields. (Closed)
Patch Set: Created 4 years, 2 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 <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. 68 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper.
69 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { 69 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() {
70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
71 71
72 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); 72 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get();
73 if (!arc_service_manager) 73 if (!arc_service_manager)
74 return nullptr; 74 return nullptr;
75 return arc_service_manager->icon_loader(); 75 return arc_service_manager->icon_loader();
76 } 76 }
77 77
78 std::string ArcActionToString(arc::mojom::ActionType action) { 78 std::string ArcActionTypeToString(arc::mojom::ActionType action_type) {
79 switch (action) { 79 switch (action_type) {
80 case arc::mojom::ActionType::VIEW: 80 case arc::mojom::ActionType::VIEW:
81 return "view"; 81 return "view";
82 case arc::mojom::ActionType::SEND: 82 case arc::mojom::ActionType::SEND:
83 return "send"; 83 return "send";
84 case arc::mojom::ActionType::SEND_MULTIPLE: 84 case arc::mojom::ActionType::SEND_MULTIPLE:
85 return "send_multiple"; 85 return "send_multiple";
86 } 86 }
87 NOTREACHED(); 87 NOTREACHED();
88 return ""; 88 return "";
89 } 89 }
90 90
91 arc::mojom::ActionType StringToArcAction(const std::string& str) { 91 arc::mojom::ActionType StringToArcActionType(const std::string& str) {
92 if (str == "view") 92 if (str == "view")
93 return arc::mojom::ActionType::VIEW; 93 return arc::mojom::ActionType::VIEW;
94 if (str == "send") 94 if (str == "send")
95 return arc::mojom::ActionType::SEND; 95 return arc::mojom::ActionType::SEND;
96 if (str == "send_multiple") 96 if (str == "send_multiple")
97 return arc::mojom::ActionType::SEND_MULTIPLE; 97 return arc::mojom::ActionType::SEND_MULTIPLE;
98 NOTREACHED(); 98 NOTREACHED();
99 return arc::mojom::ActionType::VIEW; 99 return arc::mojom::ActionType::VIEW;
100 } 100 }
101 101
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 std::unique_ptr<std::vector<FullTaskDescriptor>> result_list, 246 std::unique_ptr<std::vector<FullTaskDescriptor>> result_list,
247 const FindTasksCallback& callback, 247 const FindTasksCallback& callback,
248 mojo::Array<arc::mojom::IntentHandlerInfoPtr> handlers, 248 mojo::Array<arc::mojom::IntentHandlerInfoPtr> handlers,
249 std::unique_ptr<IconUrlMap> icons) { 249 std::unique_ptr<IconUrlMap> icons) {
250 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 250 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
251 251
252 using extensions::api::file_manager_private::Verb; 252 using extensions::api::file_manager_private::Verb;
253 for (const arc::mojom::IntentHandlerInfoPtr& handler : handlers) { 253 for (const arc::mojom::IntentHandlerInfoPtr& handler : handlers) {
254 std::string name(handler->name); 254 std::string name(handler->name);
255 Verb handler_verb = Verb::VERB_NONE; 255 Verb handler_verb = Verb::VERB_NONE;
256 if (handler->action == arc::mojom::ActionType::SEND || 256 if (handler->action_type == arc::mojom::ActionType::SEND ||
257 handler->action == arc::mojom::ActionType::SEND_MULTIPLE) { 257 handler->action_type == arc::mojom::ActionType::SEND_MULTIPLE) {
258 handler_verb = Verb::VERB_SHARE_WITH; 258 handler_verb = Verb::VERB_SHARE_WITH;
259 } 259 }
260 const GURL& icon_url = (*icons)[arc::ActivityIconLoader::ActivityName( 260 const GURL& icon_url = (*icons)[arc::ActivityIconLoader::ActivityName(
261 handler->package_name, handler->activity_name)]; 261 handler->package_name, handler->activity_name)];
262 result_list->push_back(FullTaskDescriptor( 262 result_list->push_back(FullTaskDescriptor(
263 TaskDescriptor( 263 TaskDescriptor(
264 ActivityNameToAppId(handler->package_name, handler->activity_name), 264 ActivityNameToAppId(handler->package_name, handler->activity_name),
265 TASK_TYPE_ARC_APP, ArcActionToString(handler->action)), 265 TASK_TYPE_ARC_APP, ArcActionTypeToString(handler->action_type)),
266 name, handler_verb, icon_url, false /* is_default */, 266 name, handler_verb, icon_url, false /* is_default */,
267 handler->action != arc::mojom::ActionType::VIEW /* is_generic */)); 267 handler->action_type != arc::mojom::ActionType::VIEW /* is_generic */));
268 } 268 }
269 callback.Run(std::move(result_list)); 269 callback.Run(std::move(result_list));
270 } 270 }
271 271
272 } // namespace 272 } // namespace
273 273
274 void FindArcTasks(Profile* profile, 274 void FindArcTasks(Profile* profile,
275 const std::vector<extensions::EntryInfo>& entries, 275 const std::vector<extensions::EntryInfo>& entries,
276 std::unique_ptr<std::vector<FullTaskDescriptor>> result_list, 276 std::unique_ptr<std::vector<FullTaskDescriptor>> result_list,
277 const FindTasksCallback& callback) { 277 const FindTasksCallback& callback) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 arc::mojom::UrlWithMimeType::New(); 334 arc::mojom::UrlWithMimeType::New();
335 url_with_type->url = url.spec(); 335 url_with_type->url = url.spec();
336 url_with_type->mime_type = mime_types[i]; 336 url_with_type->mime_type = mime_types[i];
337 urls.push_back(std::move(url_with_type)); 337 urls.push_back(std::move(url_with_type));
338 } 338 }
339 339
340 if (GetArcIntentHelper(profile, "HandleUrlList", 340 if (GetArcIntentHelper(profile, "HandleUrlList",
341 kArcIntentHelperVersionWithFullActivityName)) { 341 kArcIntentHelperVersionWithFullActivityName)) {
342 arc_intent_helper->HandleUrlList(std::move(urls), 342 arc_intent_helper->HandleUrlList(std::move(urls),
343 AppIdToActivityName(task.app_id), 343 AppIdToActivityName(task.app_id),
344 StringToArcAction(task.action_id)); 344 StringToArcActionType(task.action_id));
345 } else { 345 } else {
346 arc_intent_helper->HandleUrlListDeprecated( 346 arc_intent_helper->HandleUrlListDeprecated(
347 std::move(urls), AppIdToActivityName(task.app_id)->package_name, 347 std::move(urls), AppIdToActivityName(task.app_id)->package_name,
348 StringToArcAction(task.action_id)); 348 StringToArcActionType(task.action_id));
349 } 349 }
350 return true; 350 return true;
351 } 351 }
352 352
353 } // namespace file_tasks 353 } // namespace file_tasks
354 } // namespace file_manager 354 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | components/arc/common/intent_helper.mojom » ('j') | components/arc/common/intent_helper.mojom » ('J')

Powered by Google App Engine
This is Rietveld 408576698