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

Side by Side Diff: chrome/browser/ui/app_list/search/app_search_provider.cc

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 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/search/app_search_provider.h" 5 #include "chrome/browser/ui/app_list/search/app_search_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
9 #include <string> 8 #include <string>
9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
17 #include "base/time/clock.h" 17 #include "base/time/clock.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_ui_util.h" 19 #include "chrome/browser/extensions/extension_ui_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 }; 64 };
65 65
66 AppSearchProvider::AppSearchProvider(Profile* profile, 66 AppSearchProvider::AppSearchProvider(Profile* profile,
67 AppListControllerDelegate* list_controller, 67 AppListControllerDelegate* list_controller,
68 scoped_ptr<base::Clock> clock, 68 scoped_ptr<base::Clock> clock,
69 AppListItemList* top_level_item_list) 69 AppListItemList* top_level_item_list)
70 : profile_(profile), 70 : profile_(profile),
71 list_controller_(list_controller), 71 list_controller_(list_controller),
72 extension_registry_observer_(this), 72 extension_registry_observer_(this),
73 top_level_item_list_(top_level_item_list), 73 top_level_item_list_(top_level_item_list),
74 clock_(clock.Pass()), 74 clock_(std::move(clock)),
75 update_results_factory_(this) { 75 update_results_factory_(this) {
76 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); 76 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
77 RefreshApps(); 77 RefreshApps();
78 } 78 }
79 79
80 AppSearchProvider::~AppSearchProvider() {} 80 AppSearchProvider::~AppSearchProvider() {}
81 81
82 void AppSearchProvider::Start(bool /*is_voice_query*/, 82 void AppSearchProvider::Start(bool /*is_voice_query*/,
83 const base::string16& query) { 83 const base::string16& query) {
84 query_ = query; 84 query_ = query;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 size_t app_list_index = 123 size_t app_list_index =
124 it == id_to_app_list_index.end() ? apps_.size() : (*it).second; 124 it == id_to_app_list_index.end() ? apps_.size() : (*it).second;
125 if (app_list_index > apps_.size()) 125 if (app_list_index > apps_.size())
126 app_list_index = apps_.size(); 126 app_list_index = apps_.size();
127 127
128 result->set_relevance(kUnlaunchedAppRelevanceStepSize * 128 result->set_relevance(kUnlaunchedAppRelevanceStepSize *
129 (apps_.size() - app_list_index)); 129 (apps_.size() - app_list_index));
130 } else { 130 } else {
131 result->UpdateFromLastLaunched(clock_->Now(), app->last_launch_time()); 131 result->UpdateFromLastLaunched(clock_->Now(), app->last_launch_time());
132 } 132 }
133 Add(result.Pass()); 133 Add(std::move(result));
134 } 134 }
135 } else { 135 } else {
136 for (const App* app : apps_) { 136 for (const App* app : apps_) {
137 scoped_ptr<AppResult> result( 137 scoped_ptr<AppResult> result(
138 new AppResult(profile_, app->app_id(), list_controller_, false)); 138 new AppResult(profile_, app->app_id(), list_controller_, false));
139 TokenizedStringMatch match; 139 TokenizedStringMatch match;
140 if (!match.Calculate(query_terms, app->indexed_name())) 140 if (!match.Calculate(query_terms, app->indexed_name()))
141 continue; 141 continue;
142 142
143 result->UpdateFromMatch(app->indexed_name(), match); 143 result->UpdateFromMatch(app->indexed_name(), match);
144 Add(result.Pass()); 144 Add(std::move(result));
145 } 145 }
146 } 146 }
147 147
148 update_results_factory_.InvalidateWeakPtrs(); 148 update_results_factory_.InvalidateWeakPtrs();
149 } 149 }
150 150
151 void AppSearchProvider::AddApps(const extensions::ExtensionSet& extensions) { 151 void AppSearchProvider::AddApps(const extensions::ExtensionSet& extensions) {
152 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); 152 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_);
153 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); 153 for (extensions::ExtensionSet::const_iterator iter = extensions.begin();
154 iter != extensions.end(); ++iter) { 154 iter != extensions.end(); ++iter) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const extensions::Extension* extension, 189 const extensions::Extension* extension,
190 extensions::UninstallReason reason) { 190 extensions::UninstallReason reason) {
191 RefreshApps(); 191 RefreshApps();
192 192
193 // This should not be batched as the UI needs to immediately be informed of 193 // This should not be batched as the UI needs to immediately be informed of
194 // deleted extensions to prevent use-after-frees. 194 // deleted extensions to prevent use-after-frees.
195 UpdateResults(); 195 UpdateResults();
196 } 196 }
197 197
198 } // namespace app_list 198 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/search/app_result.cc ('k') | chrome/browser/ui/app_list/search/app_search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698