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..e1df234a406bf4de8fbb12f101958aaee016ca8b |
--- /dev/null |
+++ b/chrome/browser/search/contextual_search_api_controller.h |
@@ -0,0 +1,41 @@ |
+// 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/macros.h" |
+#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 AddProcessId(int process_id); |
+ void RemoveProcessId(int process_id); |
+ bool IsContextualSearchProcessId(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_ |