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

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

Issue 2322353002: [Merge-M53] arc: Add support of default and OEM apps. (Closed)
Patch Set: 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 23 matching lines...) Expand all
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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 oem_ordinal = prev->position().CreateBetween(next->position()); 1052 oem_ordinal = prev->position().CreateBetween(next->position());
1052 } else { 1053 } else {
1053 oem_ordinal = prev->position().CreateAfter(); 1054 oem_ordinal = prev->position().CreateAfter();
1054 } 1055 }
1055 VLOG(1) << "Placing OEM Folder at: " << oem_index 1056 VLOG(1) << "Placing OEM Folder at: " << oem_index
1056 << " position: " << oem_ordinal.ToDebugString(); 1057 << " position: " << oem_ordinal.ToDebugString();
1057 return oem_ordinal; 1058 return oem_ordinal;
1058 } 1059 }
1059 1060
1060 bool AppListSyncableService::AppIsOem(const std::string& id) { 1061 bool AppListSyncableService::AppIsOem(const std::string& id) {
1062 #if defined(OS_CHROMEOS)
1063 const ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile_);
1064 if (arc_prefs && arc_prefs->IsOem(id))
1065 return true;
1066 #endif
1067
1061 if (!extension_system_->extension_service()) 1068 if (!extension_system_->extension_service())
1062 return false; 1069 return false;
1063 const extensions::Extension* extension = 1070 const extensions::Extension* extension =
1064 extension_system_->extension_service()->GetExtensionById(id, true); 1071 extension_system_->extension_service()->GetExtensionById(id, true);
1065 return extension && extension->was_installed_by_oem(); 1072 return extension && extension->was_installed_by_oem();
1066 } 1073 }
1067 1074
1068 std::string AppListSyncableService::SyncItem::ToString() const { 1075 std::string AppListSyncableService::SyncItem::ToString() const {
1069 std::string res = item_id.substr(0, 8); 1076 std::string res = item_id.substr(0, 8);
1070 if (item_type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { 1077 if (item_type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) {
1071 res += " { RemoveDefault }"; 1078 res += " { RemoveDefault }";
1072 } else { 1079 } else {
1073 res += " { " + item_name + " }"; 1080 res += " { " + item_name + " }";
1074 res += " [" + item_ordinal.ToDebugString() + "]"; 1081 res += " [" + item_ordinal.ToDebugString() + "]";
1075 if (!parent_id.empty()) 1082 if (!parent_id.empty())
1076 res += " <" + parent_id.substr(0, 8) + ">"; 1083 res += " <" + parent_id.substr(0, 8) + ">";
1077 res += " [" + item_pin_ordinal.ToDebugString() + "]"; 1084 res += " [" + item_pin_ordinal.ToDebugString() + "]";
1078 } 1085 }
1079 return res; 1086 return res;
1080 } 1087 }
1081 1088
1082 } // namespace app_list 1089 } // 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