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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chrome/browser/apps/drive/drive_app_provider.h" | 9 #include "chrome/browser/apps/drive/drive_app_provider.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/app_list/app_list_prefs.h" | 12 #include "chrome/browser/ui/app_list/app_list_prefs.h" |
13 #include "chrome/browser/ui/app_list/app_list_service.h" | 13 #include "chrome/browser/ui/app_list/app_list_service.h" |
14 #include "chrome/browser/ui/app_list/extension_app_item.h" | 14 #include "chrome/browser/ui/app_list/extension_app_item.h" |
15 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" | 15 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" |
16 #include "chrome/browser/ui/app_list/model_pref_updater.h" | 16 #include "chrome/browser/ui/app_list/model_pref_updater.h" |
17 #include "chrome/browser/ui/host_desktop.h" | 17 #include "chrome/browser/ui/host_desktop.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
20 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
21 #include "extensions/browser/extension_prefs.h" | 21 #include "extensions/browser/extension_prefs.h" |
22 #include "extensions/browser/extension_registry.h" | |
22 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
23 #include "extensions/browser/uninstall_reason.h" | 24 #include "extensions/browser/uninstall_reason.h" |
24 #include "extensions/common/constants.h" | 25 #include "extensions/common/constants.h" |
25 #include "sync/api/sync_change_processor.h" | 26 #include "sync/api/sync_change_processor.h" |
26 #include "sync/api/sync_data.h" | 27 #include "sync/api/sync_data.h" |
27 #include "sync/api/sync_merge_result.h" | 28 #include "sync/api/sync_merge_result.h" |
28 #include "sync/protocol/sync.pb.h" | 29 #include "sync/protocol/sync.pb.h" |
29 #include "ui/app_list/app_list_folder_item.h" | 30 #include "ui/app_list/app_list_folder_item.h" |
30 #include "ui/app_list/app_list_item.h" | 31 #include "ui/app_list/app_list_item.h" |
31 #include "ui/app_list/app_list_model.h" | 32 #include "ui/app_list/app_list_model.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 id == extensions::kWebStoreAppId) | 115 id == extensions::kWebStoreAppId) |
115 return true; | 116 return true; |
116 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
117 if (id == file_manager::kFileManagerAppId || id == genius_app::kGeniusAppId) | 118 if (id == file_manager::kFileManagerAppId || id == genius_app::kGeniusAppId) |
118 return true; | 119 return true; |
119 #endif | 120 #endif |
120 return false; | 121 return false; |
121 } | 122 } |
122 | 123 |
123 void UninstallExtension(ExtensionService* service, const std::string& id) { | 124 void UninstallExtension(ExtensionService* service, const std::string& id) { |
124 if (service && service->GetInstalledExtension(id)) { | 125 if (service) { |
126 const extensions::Extension* extension = | |
127 extensions::ExtensionRegistry::Get(service->profile()) | |
128 ->GetExtensionById(id, extensions::ExtensionRegistry::EVERYTHING); | |
129 if (!extension) | |
130 return; | |
stevenjb
2015/05/26 21:26:25
We should either move this check to service->Unins
babu
2015/06/04 14:48:11
Thanks for reviewing!
UninstallExtension() has t
| |
125 service->UninstallExtension(id, | 131 service->UninstallExtension(id, |
126 extensions::UNINSTALL_REASON_SYNC, | 132 extensions::UNINSTALL_REASON_SYNC, |
127 base::Bind(&base::DoNothing), | 133 base::Bind(&base::DoNothing), |
128 NULL); | 134 NULL); |
129 } | 135 } |
130 } | 136 } |
131 | 137 |
132 bool GetAppListItemType(AppListItem* item, | 138 bool GetAppListItemType(AppListItem* item, |
133 sync_pb::AppListSpecifics::AppListItemType* type) { | 139 sync_pb::AppListSpecifics::AppListItemType* type) { |
134 const char* item_type = item->GetItemType(); | 140 const char* item_type = item->GetItemType(); |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 } else { | 1002 } else { |
997 res += " { " + item_name + " }"; | 1003 res += " { " + item_name + " }"; |
998 res += " [" + item_ordinal.ToDebugString() + "]"; | 1004 res += " [" + item_ordinal.ToDebugString() + "]"; |
999 if (!parent_id.empty()) | 1005 if (!parent_id.empty()) |
1000 res += " <" + parent_id.substr(0, 8) + ">"; | 1006 res += " <" + parent_id.substr(0, 8) + ">"; |
1001 } | 1007 } |
1002 return res; | 1008 return res; |
1003 } | 1009 } |
1004 | 1010 |
1005 } // namespace app_list | 1011 } // namespace app_list |
OLD | NEW |