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

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

Issue 2929273002: Add the Play Store app search to the launcher. (Closed)
Patch Set: Merge API and implementation. Created 3 years, 6 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/app_list/search/playstore/playstore_search_provider. h"
6
7 #if defined(OS_CHROMEOS)
Luis Héctor Chávez 2017/06/16 22:24:32 Can you only include this in the compilation if it
Jiaquan He 2017/06/22 04:30:02 Done.
8
9 namespace app_list {
10
11 PlaystoreSearchProvider::PlaystoreSearchProvider(int max_results)
12 : max_results_(max_results) {}
13
14 PlaystoreSearchProvider::~PlaystoreSearchProvider() {
15 Stop();
Luis Héctor Chávez 2017/06/16 22:24:32 This is a no-op. Why are you adding it?
Jiaquan He 2017/06/22 04:30:02 Done. Not needed any more.
16 }
17
18 void PlaystoreSearchProvider::Start(bool is_voice_query,
19 const base::string16& query) {
20 // TODO: should search for voice?
21 arc::mojom::AppInstance* app_instance =
22 GET_APP_INSTANCE(GetRecentAndSuggestedAppsFromPlayStore);
23
24 if (app_instance == nullptr)
25 return;
26
27 ClearResults();
28 app_instance->GetRecentAndSuggestedAppsFromPlayStore(
29 UTF16ToUTF8(query), max_results_,
Luis Héctor Chávez 2017/06/16 22:24:32 does it make sense to make the .mojom use a string
Jiaquan He 2017/06/22 04:30:02 If we use mojo string16, do we have to convert it
30 base::Bind(&PlaystoreSearchProvider::OnResults, base::Unretained(this)));
Luis Héctor Chávez 2017/06/16 22:24:31 base::Unretained seems to be unsafe here: there's
Jiaquan He 2017/06/22 04:30:02 Done.
31 }
32
33 void PlaystoreSearchProvider::Stop() {}
34
35 void PlaystoreSearchProvider::OnResults(
36 std::vector<arc::mojom::AppDiscoveryResultPtr> results) {
37 for (unsigned long i = 0; i < results.size(); i++) {
Luis Héctor Chávez 2017/06/16 22:24:32 for (const auto result : results) { but it's prob
Jiaquan He 2017/06/22 04:30:02 Done.
38 std::unique_ptr<SearchResult> result =
39 base::MakeUnique<PlaystoreSearchResult>(
40 results[i]->launch_intent_uri, results[i]->install_intent_uri,
41 results[i]->label, results[i]->is_instant_app,
42 results[i]->is_recent, results[i]->publisher_name,
43 results[i]->icon_png_data);
44
45 Add(std::move(result));
46 }
47 }
48
49 } // namespace app_list
50
51 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698