| Index: chrome/browser/search/contextual_search_api_controller.h
|
| diff --git a/chrome/browser/search/contextual_search_api_controller.h b/chrome/browser/search/contextual_search_api_controller.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1e77ec8d87622f022bdc534bd018b8648d94f7f8
|
| --- /dev/null
|
| +++ b/chrome/browser/search/contextual_search_api_controller.h
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_API_CONTROLLER_H_
|
| +#define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_API_CONTROLLER_H_
|
| +
|
| +#include <set>
|
| +
|
| +#include "base/memory/singleton.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +
|
| +// Provides a singleton controller for the Contextual Search API.
|
| +// Tracks render process host IDs that are associated with ContextualSearch.
|
| +class ContextualSearchApiController {
|
| + public:
|
| + static ContextualSearchApiController* GetInstance();
|
| +
|
| + // Add, remove, and query RenderProcessHost IDs that are associated with
|
| + // Contextual Search processes.
|
| + void AddContextualSearchProcess(int process_id);
|
| + void RemoveContextualSearchProcess(int process_id);
|
| + bool IsContextualSearchProcess(int process_id) const;
|
| +
|
| + private:
|
| + // Use GetInstance instead of constructing.
|
| + ContextualSearchApiController();
|
| + ~ContextualSearchApiController();
|
| +
|
| + // Singleton:
|
| + friend struct base::DefaultSingletonTraits<ContextualSearchApiController>;
|
| +
|
| + // The process ids associated with Contextual Search processes.
|
| + std::set<int> process_ids_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ContextualSearchApiController);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_API_CONTROLLER_H_
|
|
|