| 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 "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 20 #include "extensions/browser/extension_prefs.h" | 20 #include "extensions/browser/extension_prefs.h" |
| 21 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 22 #include "extensions/browser/uninstall_reason.h" | 22 #include "extensions/browser/uninstall_reason.h" |
| 23 #include "extensions/common/constants.h" |
| 23 #include "sync/api/sync_change_processor.h" | 24 #include "sync/api/sync_change_processor.h" |
| 24 #include "sync/api/sync_data.h" | 25 #include "sync/api/sync_data.h" |
| 25 #include "sync/api/sync_merge_result.h" | 26 #include "sync/api/sync_merge_result.h" |
| 26 #include "sync/protocol/sync.pb.h" | 27 #include "sync/protocol/sync.pb.h" |
| 27 #include "ui/app_list/app_list_folder_item.h" | 28 #include "ui/app_list/app_list_folder_item.h" |
| 28 #include "ui/app_list/app_list_item.h" | 29 #include "ui/app_list/app_list_item.h" |
| 29 #include "ui/app_list/app_list_model.h" | 30 #include "ui/app_list/app_list_model.h" |
| 30 #include "ui/app_list/app_list_model_observer.h" | 31 #include "ui/app_list/app_list_model_observer.h" |
| 31 #include "ui/app_list/app_list_switches.h" | 32 #include "ui/app_list/app_list_switches.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 specifics); | 101 specifics); |
| 101 } | 102 } |
| 102 | 103 |
| 103 bool AppIsDefault(ExtensionService* service, const std::string& id) { | 104 bool AppIsDefault(ExtensionService* service, const std::string& id) { |
| 104 return service && extensions::ExtensionPrefs::Get(service->profile()) | 105 return service && extensions::ExtensionPrefs::Get(service->profile()) |
| 105 ->WasInstalledByDefault(id); | 106 ->WasInstalledByDefault(id); |
| 106 } | 107 } |
| 107 | 108 |
| 108 bool IsUnRemovableDefaultApp(const std::string& id) { | 109 bool IsUnRemovableDefaultApp(const std::string& id) { |
| 109 if (id == extension_misc::kChromeAppId || | 110 if (id == extension_misc::kChromeAppId || |
| 110 id == extension_misc::kWebStoreAppId) | 111 id == extensions::kWebStoreAppId) |
| 111 return true; | 112 return true; |
| 112 #if defined(OS_CHROMEOS) | 113 #if defined(OS_CHROMEOS) |
| 113 if (id == file_manager::kFileManagerAppId || id == genius_app::kGeniusAppId) | 114 if (id == file_manager::kFileManagerAppId || id == genius_app::kGeniusAppId) |
| 114 return true; | 115 return true; |
| 115 #endif | 116 #endif |
| 116 return false; | 117 return false; |
| 117 } | 118 } |
| 118 | 119 |
| 119 void UninstallExtension(ExtensionService* service, const std::string& id) { | 120 void UninstallExtension(ExtensionService* service, const std::string& id) { |
| 120 if (service && service->GetInstalledExtension(id)) { | 121 if (service && service->GetInstalledExtension(id)) { |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 // followed by a pre-installed app (e.g. Search), so the poosition should be | 875 // followed by a pre-installed app (e.g. Search), so the poosition should be |
| 875 // stable. TODO(stevenjb): consider explicitly setting the OEM folder location | 876 // stable. TODO(stevenjb): consider explicitly setting the OEM folder location |
| 876 // along with the name in ServicesCustomizationDocument::SetOemFolderName(). | 877 // along with the name in ServicesCustomizationDocument::SetOemFolderName(). |
| 877 AppListItemList* item_list = model_->top_level_item_list(); | 878 AppListItemList* item_list = model_->top_level_item_list(); |
| 878 if (item_list->item_count() == 0) | 879 if (item_list->item_count() == 0) |
| 879 return syncer::StringOrdinal(); | 880 return syncer::StringOrdinal(); |
| 880 | 881 |
| 881 size_t oem_index = 0; | 882 size_t oem_index = 0; |
| 882 for (; oem_index < item_list->item_count() - 1; ++oem_index) { | 883 for (; oem_index < item_list->item_count() - 1; ++oem_index) { |
| 883 AppListItem* cur_item = item_list->item_at(oem_index); | 884 AppListItem* cur_item = item_list->item_at(oem_index); |
| 884 if (cur_item->id() == extension_misc::kWebStoreAppId) | 885 if (cur_item->id() == extensions::kWebStoreAppId) |
| 885 break; | 886 break; |
| 886 } | 887 } |
| 887 syncer::StringOrdinal oem_ordinal; | 888 syncer::StringOrdinal oem_ordinal; |
| 888 AppListItem* prev = item_list->item_at(oem_index); | 889 AppListItem* prev = item_list->item_at(oem_index); |
| 889 if (oem_index + 1 < item_list->item_count()) { | 890 if (oem_index + 1 < item_list->item_count()) { |
| 890 AppListItem* next = item_list->item_at(oem_index + 1); | 891 AppListItem* next = item_list->item_at(oem_index + 1); |
| 891 oem_ordinal = prev->position().CreateBetween(next->position()); | 892 oem_ordinal = prev->position().CreateBetween(next->position()); |
| 892 } else { | 893 } else { |
| 893 oem_ordinal = prev->position().CreateAfter(); | 894 oem_ordinal = prev->position().CreateAfter(); |
| 894 } | 895 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 912 } else { | 913 } else { |
| 913 res += " { " + item_name + " }"; | 914 res += " { " + item_name + " }"; |
| 914 res += " [" + item_ordinal.ToDebugString() + "]"; | 915 res += " [" + item_ordinal.ToDebugString() + "]"; |
| 915 if (!parent_id.empty()) | 916 if (!parent_id.empty()) |
| 916 res += " <" + parent_id.substr(0, 8) + ">"; | 917 res += " <" + parent_id.substr(0, 8) + ">"; |
| 917 } | 918 } |
| 918 return res; | 919 return res; |
| 919 } | 920 } |
| 920 | 921 |
| 921 } // namespace app_list | 922 } // namespace app_list |
| OLD | NEW |