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

Side by Side Diff: chrome/browser/chromeos/launcher_search_provider/service.h

Issue 1071093002: Implement setSearchResults. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear results after query is ended. Created 5 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 #ifndef CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_
7 7
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/extensions/api/launcher_search_provider.h"
9 #include "components/keyed_service/core/keyed_service.h" 10 #include "components/keyed_service/core/keyed_service.h"
10 #include "content/public/browser/browser_context.h" 11 #include "content/public/browser/browser_context.h"
11 #include "extensions/browser/event_router.h" 12 #include "extensions/browser/event_router.h"
12 #include "extensions/common/extension.h" 13 #include "extensions/common/extension.h"
13 14
15 namespace app_list {
16 class LauncherSearchProvider;
17 } // namespace app_list
18
14 namespace chromeos { 19 namespace chromeos {
15 namespace launcher_search_provider { 20 namespace launcher_search_provider {
16 21
17 // Manages listener extensions and routes events. Listener extensions are 22 // Manages listener extensions and routes events. Listener extensions are
18 // extensions which are allowed to use this API. When this API becomes public, 23 // extensions which are allowed to use this API. When this API becomes public,
19 // this API is white listed for file manager, and opt-in for other extensions. 24 // this API is white listed for file manager, and opt-in for other extensions.
20 // This service provides access control for it. 25 // This service provides access control for it.
21 // 26 //
22 // TODO(yawano): Implement opt-in control (crbug.com/440649). 27 // TODO(yawano): Implement opt-in control (crbug.com/440649).
23 class Service : public KeyedService { 28 class Service : public KeyedService {
24 public: 29 public:
25 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry); 30 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry);
26 ~Service() override; 31 ~Service() override;
27 static Service* Get(content::BrowserContext* context); 32 static Service* Get(content::BrowserContext* context);
28 33
29 // Dispatches onQueryStarted events to listener extensions. 34 // Dispatches onQueryStarted events to listener extensions.
30 void OnQueryStarted(const std::string& query, const int max_result); 35 void OnQueryStarted(app_list::LauncherSearchProvider* provider,
36 const std::string& query,
37 const int max_result);
31 38
32 // Dispatches onQueryEnded events to listener extensions. 39 // Dispatches onQueryEnded events to listener extensions.
33 void OnQueryEnded(); 40 void OnQueryEnded();
34 41
42 // Sets search results of a listener extension.
43 void SetSearchResults(
44 const extensions::Extension* extension,
45 const std::string& query_id,
46 std::vector<linked_ptr<
47 extensions::api::launcher_search_provider::SearchResult>> results);
48
35 // Returns true if there is a running query. 49 // Returns true if there is a running query.
36 bool IsQueryRunning() const; 50 bool IsQueryRunning() const;
37 51
38 private: 52 private:
39 // Returns extension ids of listener extensions. 53 // Returns extension ids of listener extensions.
40 std::set<extensions::ExtensionId> GetListenerExtensionIds(); 54 std::set<extensions::ExtensionId> GetListenerExtensionIds();
41 55
42 Profile* const profile_; 56 Profile* const profile_;
43 extensions::ExtensionRegistry* extension_registry_; 57 extensions::ExtensionRegistry* extension_registry_;
58 app_list::LauncherSearchProvider* provider_;
44 uint32 query_id_; 59 uint32 query_id_;
45 bool is_query_running_; 60 bool is_query_running_;
46 61
47 DISALLOW_COPY_AND_ASSIGN(Service); 62 DISALLOW_COPY_AND_ASSIGN(Service);
48 }; 63 };
49 64
50 } // namespace launcher_search_provider 65 } // namespace launcher_search_provider
51 } // namespace chromeos 66 } // namespace chromeos
52 67
53 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ 68 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698