Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / chromeos / launcher_search_provider / service.h
blob27bac34e5234a8d6f4d039d63f051959083a5c80
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/core/keyed_service.h"
10 #include "content/public/browser/browser_context.h"
11 #include "extensions/browser/event_router.h"
12 #include "extensions/common/extension.h"
14 namespace chromeos {
15 namespace launcher_search_provider {
17 // Manages listener extensions and routes events. Listener extensions are
18 // 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.
20 // This service provides access control for it.
22 // TODO(yawano): Implement opt-in control (crbug.com/440649).
23 class Service : public KeyedService {
24 public:
25 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry);
26 ~Service() override;
27 static Service* Get(content::BrowserContext* context);
29 // Dispatches onQueryStarted events to listener extensions.
30 void OnQueryStarted(const std::string& query, const int max_result);
32 // Dispatches onQueryEnded events to listener extensions.
33 void OnQueryEnded();
35 // Returns true if there is a running query.
36 bool IsQueryRunning() const;
38 private:
39 // Returns extension ids of listener extensions.
40 std::set<extensions::ExtensionId> GetListenerExtensionIds();
42 Profile* const profile_;
43 extensions::ExtensionRegistry* extension_registry_;
44 uint32 query_id_;
45 bool is_query_running_;
47 DISALLOW_COPY_AND_ASSIGN(Service);
50 } // namespace launcher_search_provider
51 } // namespace chromeos
53 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_