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 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" |
6 | 6 |
7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
11 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 11 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 13 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
14 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 14 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const char kActivity[] = "activity"; | 21 const char kActivity[] = "activity"; |
22 const char kAppPath[] = "app_path"; | 22 const char kAppPath[] = "app_path"; |
23 const char kName[] = "name"; | 23 const char kName[] = "name"; |
24 const char kOem[] = "oem"; | 24 const char kOem[] = "oem"; |
25 const char kPackageName[] = "package_name"; | 25 const char kPackageName[] = "package_name"; |
26 | 26 |
27 // Sub-directory wher Arc apps forward declarations are stored. | 27 // Sub-directory wher ARC apps forward declarations are stored. |
28 const base::FilePath::CharType kArcDirectory[] = FILE_PATH_LITERAL("arc"); | 28 const base::FilePath::CharType kArcDirectory[] = FILE_PATH_LITERAL("arc"); |
29 const base::FilePath::CharType kArcTestDirectory[] = | 29 const base::FilePath::CharType kArcTestDirectory[] = |
30 FILE_PATH_LITERAL("arc_default_apps"); | 30 FILE_PATH_LITERAL("arc_default_apps"); |
31 | 31 |
32 bool use_test_apps_directory = false; | 32 bool use_test_apps_directory = false; |
33 | 33 |
34 std::unique_ptr<ArcDefaultAppList::AppInfoMap> | 34 std::unique_ptr<ArcDefaultAppList::AppInfoMap> |
35 ReadAppsFromFileThread() { | 35 ReadAppsFromFileThread() { |
36 std::unique_ptr<ArcDefaultAppList::AppInfoMap> apps( | 36 std::unique_ptr<ArcDefaultAppList::AppInfoMap> apps( |
37 new ArcDefaultAppList::AppInfoMap); | 37 new ArcDefaultAppList::AppInfoMap); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 app_info_dictionary->GetString(kName, &name); | 81 app_info_dictionary->GetString(kName, &name); |
82 app_info_dictionary->GetString(kPackageName, &package_name); | 82 app_info_dictionary->GetString(kPackageName, &package_name); |
83 app_info_dictionary->GetString(kActivity, &activity); | 83 app_info_dictionary->GetString(kActivity, &activity); |
84 app_info_dictionary->GetString(kAppPath, &app_path); | 84 app_info_dictionary->GetString(kAppPath, &app_path); |
85 app_info_dictionary->GetBoolean(kOem, &oem); | 85 app_info_dictionary->GetBoolean(kOem, &oem); |
86 | 86 |
87 if (name.empty() || | 87 if (name.empty() || |
88 package_name.empty() || | 88 package_name.empty() || |
89 activity.empty() || | 89 activity.empty() || |
90 app_path.empty()) { | 90 app_path.empty()) { |
91 VLOG(2) << "Arc app declaration is incomplete in file " | 91 VLOG(2) << "ARC app declaration is incomplete in file " << file.value() |
92 << file.value() << "."; | 92 << "."; |
93 continue; | 93 continue; |
94 } | 94 } |
95 | 95 |
96 const std::string app_id = ArcAppListPrefs::GetAppId( | 96 const std::string app_id = ArcAppListPrefs::GetAppId( |
97 package_name, activity); | 97 package_name, activity); |
98 std::unique_ptr<ArcDefaultAppList::AppInfo> app( | 98 std::unique_ptr<ArcDefaultAppList::AppInfo> app( |
99 new ArcDefaultAppList::AppInfo(name, | 99 new ArcDefaultAppList::AppInfo(name, |
100 package_name, | 100 package_name, |
101 activity, | 101 activity, |
102 oem, | 102 oem, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 const std::string& activity, | 214 const std::string& activity, |
215 bool oem, | 215 bool oem, |
216 const base::FilePath app_path) | 216 const base::FilePath app_path) |
217 : name(name), | 217 : name(name), |
218 package_name(package_name), | 218 package_name(package_name), |
219 activity(activity), | 219 activity(activity), |
220 oem(oem), | 220 oem(oem), |
221 app_path(app_path) {} | 221 app_path(app_path) {} |
222 | 222 |
223 ArcDefaultAppList::AppInfo::~AppInfo() {} | 223 ArcDefaultAppList::AppInfo::~AppInfo() {} |
OLD | NEW |