OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list_syncable_service.h" | 5 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "ui/app_list/app_list_model.h" | 34 #include "ui/app_list/app_list_model.h" |
35 #include "ui/app_list/app_list_model_observer.h" | 35 #include "ui/app_list/app_list_model_observer.h" |
36 #include "ui/app_list/app_list_switches.h" | 36 #include "ui/app_list/app_list_switches.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
38 | 38 |
39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
40 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 40 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
41 #include "chrome/browser/chromeos/file_manager/app_id.h" | 41 #include "chrome/browser/chromeos/file_manager/app_id.h" |
42 #include "chrome/browser/chromeos/genius_app/app_id.h" | 42 #include "chrome/browser/chromeos/genius_app/app_id.h" |
43 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" | 43 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" |
| 44 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
44 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h" | 45 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h" |
45 #endif | 46 #endif |
46 | 47 |
47 using syncer::SyncChange; | 48 using syncer::SyncChange; |
48 | 49 |
49 namespace app_list { | 50 namespace app_list { |
50 | 51 |
51 namespace { | 52 namespace { |
52 | 53 |
53 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263"; | 54 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263"; |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 oem_ordinal = prev->position().CreateBetween(next->position()); | 1053 oem_ordinal = prev->position().CreateBetween(next->position()); |
1053 } else { | 1054 } else { |
1054 oem_ordinal = prev->position().CreateAfter(); | 1055 oem_ordinal = prev->position().CreateAfter(); |
1055 } | 1056 } |
1056 VLOG(1) << "Placing OEM Folder at: " << oem_index | 1057 VLOG(1) << "Placing OEM Folder at: " << oem_index |
1057 << " position: " << oem_ordinal.ToDebugString(); | 1058 << " position: " << oem_ordinal.ToDebugString(); |
1058 return oem_ordinal; | 1059 return oem_ordinal; |
1059 } | 1060 } |
1060 | 1061 |
1061 bool AppListSyncableService::AppIsOem(const std::string& id) { | 1062 bool AppListSyncableService::AppIsOem(const std::string& id) { |
| 1063 #if defined(OS_CHROMEOS) |
| 1064 const ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile_); |
| 1065 if (arc_prefs && arc_prefs->IsOem(id)) |
| 1066 return true; |
| 1067 #endif |
| 1068 |
1062 if (!extension_system_->extension_service()) | 1069 if (!extension_system_->extension_service()) |
1063 return false; | 1070 return false; |
1064 const extensions::Extension* extension = | 1071 const extensions::Extension* extension = |
1065 extension_system_->extension_service()->GetExtensionById(id, true); | 1072 extension_system_->extension_service()->GetExtensionById(id, true); |
1066 return extension && extension->was_installed_by_oem(); | 1073 return extension && extension->was_installed_by_oem(); |
1067 } | 1074 } |
1068 | 1075 |
1069 std::string AppListSyncableService::SyncItem::ToString() const { | 1076 std::string AppListSyncableService::SyncItem::ToString() const { |
1070 std::string res = item_id.substr(0, 8); | 1077 std::string res = item_id.substr(0, 8); |
1071 if (item_type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { | 1078 if (item_type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { |
1072 res += " { RemoveDefault }"; | 1079 res += " { RemoveDefault }"; |
1073 } else { | 1080 } else { |
1074 res += " { " + item_name + " }"; | 1081 res += " { " + item_name + " }"; |
1075 res += " [" + item_ordinal.ToDebugString() + "]"; | 1082 res += " [" + item_ordinal.ToDebugString() + "]"; |
1076 if (!parent_id.empty()) | 1083 if (!parent_id.empty()) |
1077 res += " <" + parent_id.substr(0, 8) + ">"; | 1084 res += " <" + parent_id.substr(0, 8) + ">"; |
1078 res += " [" + item_pin_ordinal.ToDebugString() + "]"; | 1085 res += " [" + item_pin_ordinal.ToDebugString() + "]"; |
1079 } | 1086 } |
1080 return res; | 1087 return res; |
1081 } | 1088 } |
1082 | 1089 |
1083 } // namespace app_list | 1090 } // namespace app_list |
OLD | NEW |