Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1327)

Side by Side Diff: chrome/browser/ui/app_list/app_list_syncable_service.cc

Issue 2281743002: arc: Add support of default and OEM apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased + nits Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_list_prefs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 #include "ui/app_list/app_list_item.h" 33 #include "ui/app_list/app_list_item.h"
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/file_manager/app_id.h" 40 #include "chrome/browser/chromeos/file_manager/app_id.h"
41 #include "chrome/browser/chromeos/genius_app/app_id.h" 41 #include "chrome/browser/chromeos/genius_app/app_id.h"
42 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" 42 #include "chrome/browser/ui/app_list/arc/arc_app_item.h"
43 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
43 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h" 44 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h"
44 #endif 45 #endif
45 46
46 using syncer::SyncChange; 47 using syncer::SyncChange;
47 48
48 namespace app_list { 49 namespace app_list {
49 50
50 namespace { 51 namespace {
51 52
52 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263"; 53 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263";
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 oem_ordinal = prev->position().CreateBetween(next->position()); 1041 oem_ordinal = prev->position().CreateBetween(next->position());
1041 } else { 1042 } else {
1042 oem_ordinal = prev->position().CreateAfter(); 1043 oem_ordinal = prev->position().CreateAfter();
1043 } 1044 }
1044 VLOG(1) << "Placing OEM Folder at: " << oem_index 1045 VLOG(1) << "Placing OEM Folder at: " << oem_index
1045 << " position: " << oem_ordinal.ToDebugString(); 1046 << " position: " << oem_ordinal.ToDebugString();
1046 return oem_ordinal; 1047 return oem_ordinal;
1047 } 1048 }
1048 1049
1049 bool AppListSyncableService::AppIsOem(const std::string& id) { 1050 bool AppListSyncableService::AppIsOem(const std::string& id) {
1051 #if defined(OS_CHROMEOS)
1052 const ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile_);
1053 if (arc_prefs && arc_prefs->IsOem(id))
1054 return true;
1055 #endif
1056
1050 if (!extension_system_->extension_service()) 1057 if (!extension_system_->extension_service())
1051 return false; 1058 return false;
1052 const extensions::Extension* extension = 1059 const extensions::Extension* extension =
1053 extension_system_->extension_service()->GetExtensionById(id, true); 1060 extension_system_->extension_service()->GetExtensionById(id, true);
1054 return extension && extension->was_installed_by_oem(); 1061 return extension && extension->was_installed_by_oem();
1055 } 1062 }
1056 1063
1057 std::string AppListSyncableService::SyncItem::ToString() const { 1064 std::string AppListSyncableService::SyncItem::ToString() const {
1058 std::string res = item_id.substr(0, 8); 1065 std::string res = item_id.substr(0, 8);
1059 if (item_type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { 1066 if (item_type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) {
1060 res += " { RemoveDefault }"; 1067 res += " { RemoveDefault }";
1061 } else { 1068 } else {
1062 res += " { " + item_name + " }"; 1069 res += " { " + item_name + " }";
1063 res += " [" + item_ordinal.ToDebugString() + "]"; 1070 res += " [" + item_ordinal.ToDebugString() + "]";
1064 if (!parent_id.empty()) 1071 if (!parent_id.empty())
1065 res += " <" + parent_id.substr(0, 8) + ">"; 1072 res += " <" + parent_id.substr(0, 8) + ">";
1066 res += " [" + item_pin_ordinal.ToDebugString() + "]"; 1073 res += " [" + item_pin_ordinal.ToDebugString() + "]";
1067 } 1074 }
1068 return res; 1075 return res;
1069 } 1076 }
1070 1077
1071 } // namespace app_list 1078 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_list_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698