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 "chrome/browser/apps/drive/drive_app_provider.h" | 8 #include "chrome/browser/apps/drive/drive_app_provider.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.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_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_service.h" |
13 #include "chrome/browser/ui/app_list/extension_app_item.h" | 13 #include "chrome/browser/ui/app_list/extension_app_item.h" |
14 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" | 14 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" |
15 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
19 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
20 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
| 21 #include "extensions/browser/uninstall_reason.h" |
21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
22 #include "sync/api/sync_change_processor.h" | 23 #include "sync/api/sync_change_processor.h" |
23 #include "sync/api/sync_data.h" | 24 #include "sync/api/sync_data.h" |
24 #include "sync/api/sync_merge_result.h" | 25 #include "sync/api/sync_merge_result.h" |
25 #include "sync/protocol/sync.pb.h" | 26 #include "sync/protocol/sync.pb.h" |
26 #include "ui/app_list/app_list_folder_item.h" | 27 #include "ui/app_list/app_list_folder_item.h" |
27 #include "ui/app_list/app_list_item.h" | 28 #include "ui/app_list/app_list_item.h" |
28 #include "ui/app_list/app_list_model.h" | 29 #include "ui/app_list/app_list_model.h" |
29 #include "ui/app_list/app_list_model_observer.h" | 30 #include "ui/app_list/app_list_model_observer.h" |
30 #include "ui/app_list/app_list_switches.h" | 31 #include "ui/app_list/app_list_switches.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return true; | 111 return true; |
111 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
112 if (id == file_manager::kFileManagerAppId || id == genius_app::kGeniusAppId) | 113 if (id == file_manager::kFileManagerAppId || id == genius_app::kGeniusAppId) |
113 return true; | 114 return true; |
114 #endif | 115 #endif |
115 return false; | 116 return false; |
116 } | 117 } |
117 | 118 |
118 void UninstallExtension(ExtensionService* service, const std::string& id) { | 119 void UninstallExtension(ExtensionService* service, const std::string& id) { |
119 if (service && service->GetInstalledExtension(id)) | 120 if (service && service->GetInstalledExtension(id)) |
120 service->UninstallExtension( | 121 service->UninstallExtension(id, extensions::UNINSTALL_REASON_SYNC, NULL); |
121 id, ExtensionService::UNINSTALL_REASON_SYNC, NULL); | |
122 } | 122 } |
123 | 123 |
124 bool GetAppListItemType(AppListItem* item, | 124 bool GetAppListItemType(AppListItem* item, |
125 sync_pb::AppListSpecifics::AppListItemType* type) { | 125 sync_pb::AppListSpecifics::AppListItemType* type) { |
126 const char* item_type = item->GetItemType(); | 126 const char* item_type = item->GetItemType(); |
127 if (item_type == ExtensionAppItem::kItemType) { | 127 if (item_type == ExtensionAppItem::kItemType) { |
128 *type = sync_pb::AppListSpecifics::TYPE_APP; | 128 *type = sync_pb::AppListSpecifics::TYPE_APP; |
129 } else if (item_type == AppListFolderItem::kItemType) { | 129 } else if (item_type == AppListFolderItem::kItemType) { |
130 *type = sync_pb::AppListSpecifics::TYPE_FOLDER; | 130 *type = sync_pb::AppListSpecifics::TYPE_FOLDER; |
131 } else { | 131 } else { |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 } else { | 917 } else { |
918 res += " { " + item_name + " }"; | 918 res += " { " + item_name + " }"; |
919 res += " [" + item_ordinal.ToDebugString() + "]"; | 919 res += " [" + item_ordinal.ToDebugString() + "]"; |
920 if (!parent_id.empty()) | 920 if (!parent_id.empty()) |
921 res += " <" + parent_id.substr(0, 8) + ">"; | 921 res += " <" + parent_id.substr(0, 8) + ">"; |
922 } | 922 } |
923 return res; | 923 return res; |
924 } | 924 } |
925 | 925 |
926 } // namespace app_list | 926 } // namespace app_list |
OLD | NEW |