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

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

Issue 2295343002: arc: Dont sync app list change caused by Arc opt out. (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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_model_builder.h" 5 #include "chrome/browser/ui/app_list/app_list_model_builder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 9 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
10 #include "ui/app_list/app_list_item.h" 10 #include "ui/app_list/app_list_item.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 void AppListModelBuilder::InsertApp( 45 void AppListModelBuilder::InsertApp(
46 std::unique_ptr<app_list::AppListItem> app) { 46 std::unique_ptr<app_list::AppListItem> app) {
47 if (service_) { 47 if (service_) {
48 service_->AddItem(std::move(app)); 48 service_->AddItem(std::move(app));
49 return; 49 return;
50 } 50 }
51 model_->AddItem(std::move(app)); 51 model_->AddItem(std::move(app));
52 } 52 }
53 53
54 void AppListModelBuilder::RemoveApp(const std::string& id) { 54 void AppListModelBuilder::RemoveApp(const std::string& id, bool local_change) {
55 if (service_) { 55 if (!local_change && service_) {
56 service_->RemoveUninstalledItem(id); 56 service_->RemoveUninstalledItem(id);
57 return; 57 return;
58 } 58 }
59 model_->DeleteUninstalledItem(id); 59 model_->DeleteUninstalledItem(id);
60 } 60 }
61 61
62 const app_list::AppListSyncableService::SyncItem* 62 const app_list::AppListSyncableService::SyncItem*
63 AppListModelBuilder::GetSyncItem(const std::string& id) { 63 AppListModelBuilder::GetSyncItem(const std::string& id) {
64 return service_ ? service_->GetSyncItem(id) : nullptr; 64 return service_ ? service_->GetSyncItem(id) : nullptr;
65 } 65 }
66 66
67 app_list::AppListItem* AppListModelBuilder::GetAppItem(const std::string& id) { 67 app_list::AppListItem* AppListModelBuilder::GetAppItem(const std::string& id) {
68 app_list::AppListItem* item = model_->FindItem(id); 68 app_list::AppListItem* item = model_->FindItem(id);
69 if (item && item->GetItemType() != item_type_) { 69 if (item && item->GetItemType() != item_type_) {
70 VLOG(2) << "App Item matching id: " << id 70 VLOG(2) << "App Item matching id: " << id
71 << " has incorrect type: '" << item->GetItemType() << "'"; 71 << " has incorrect type: '" << item->GetItemType() << "'";
72 return nullptr; 72 return nullptr;
73 } 73 }
74 return item; 74 return item;
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698