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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 24 matching lines...) Expand all
35 void AppListModelBuilder::InitializeWithProfile(Profile* profile, 35 void AppListModelBuilder::InitializeWithProfile(Profile* profile,
36 app_list::AppListModel* model) { 36 app_list::AppListModel* model) {
37 DCHECK(!service_ && !profile_); 37 DCHECK(!service_ && !profile_);
38 model_ = model; 38 model_ = model;
39 model_->top_level_item_list()->AddObserver(this); 39 model_->top_level_item_list()->AddObserver(this);
40 profile_ = profile; 40 profile_ = profile;
41 41
42 BuildModel(); 42 BuildModel();
43 } 43 }
44 44
45 void AppListModelBuilder::InsertApp(scoped_ptr<app_list::AppListItem> app) { 45 void AppListModelBuilder::InsertApp(
46 std::unique_ptr<app_list::AppListItem> app) {
46 if (service_) { 47 if (service_) {
47 service_->AddItem(std::move(app)); 48 service_->AddItem(std::move(app));
48 return; 49 return;
49 } 50 }
50 model_->AddItem(std::move(app)); 51 model_->AddItem(std::move(app));
51 } 52 }
52 53
53 void AppListModelBuilder::RemoveApp(const std::string& id) { 54 void AppListModelBuilder::RemoveApp(const std::string& id) {
54 if (service_) { 55 if (service_) {
55 service_->RemoveUninstalledItem(id); 56 service_->RemoveUninstalledItem(id);
56 return; 57 return;
57 } 58 }
58 model_->DeleteUninstalledItem(id); 59 model_->DeleteUninstalledItem(id);
59 } 60 }
60 61
61 const app_list::AppListSyncableService::SyncItem* 62 const app_list::AppListSyncableService::SyncItem*
62 AppListModelBuilder::GetSyncItem(const std::string& id) { 63 AppListModelBuilder::GetSyncItem(const std::string& id) {
63 return service_ ? service_->GetSyncItem(id) : nullptr; 64 return service_ ? service_->GetSyncItem(id) : nullptr;
64 } 65 }
65 66
66 app_list::AppListItem* AppListModelBuilder::GetAppItem(const std::string& id) { 67 app_list::AppListItem* AppListModelBuilder::GetAppItem(const std::string& id) {
67 app_list::AppListItem* item = model_->FindItem(id); 68 app_list::AppListItem* item = model_->FindItem(id);
68 if (item && item->GetItemType() != item_type_) { 69 if (item && item->GetItemType() != item_type_) {
69 VLOG(2) << "App Item matching id: " << id 70 VLOG(2) << "App Item matching id: " << id
70 << " has incorrect type: '" << item->GetItemType() << "'"; 71 << " has incorrect type: '" << item->GetItemType() << "'";
71 return nullptr; 72 return nullptr;
72 } 73 }
73 return item; 74 return item;
74 } 75 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_model_builder.h ('k') | chrome/browser/ui/app_list/app_list_positioner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698