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

Unified Diff: chrome/browser/search/contextual_search_api_controller.h

Issue 1385663002: [Contextual Search] Add Mojo-enabled API component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Pedro's comments on naming methods in ContextualSearchApiController. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698