Index: chrome/browser/search/contextual_search_service.h |
diff --git a/chrome/browser/search/contextual_search_service.h b/chrome/browser/search/contextual_search_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a1efefab1fca93cf0b8f6f645c13dc1c181712d2 |
--- /dev/null |
+++ b/chrome/browser/search/contextual_search_service.h |
@@ -0,0 +1,46 @@ |
+// 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_SERVICE_H_ |
+#define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_ |
+ |
+#include "base/memory/singleton.h" |
+#include "content/public/browser/notification_observer.h" |
+#include "content/public/browser/notification_registrar.h" |
+ |
+// Provides a singleton service for Contextual Search. |
+// Tracks render process host IDs that are associated with ContextualSearch. |
+class ContextualSearchService : public content::NotificationObserver { |
+ public: |
+ static ContextualSearchService* GetInstance(); |
+ |
+ // Add, remove, and query RenderProcessHost IDs that are associated with |
+ // Contextual Search processes. |
+ void SetContextualSearchProcess(int process_id); |
+ bool IsContextualSearchProcess(int process_id) const; |
+ |
+ private: |
+ // Use GetInstance instead of constructing. |
+ ContextualSearchService(); |
+ ~ContextualSearchService() override; |
+ |
+ // Singleton: |
+ friend struct base::DefaultSingletonTraits<ContextualSearchService>; |
+ |
+ // content::NotificationObserver: |
+ void Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) override; |
+ |
+ void OnRendererProcessTerminated(int process_id); |
+ |
+ // The process id associated with Contextual Search processes. |
+ int process_id_; |
kmadhusu
2015/10/08 22:05:02
I am not sure if I understood the purpose of this
Donn Denman
2015/10/09 20:46:43
Right, this is a singleton class that just tracks
pedro (no code reviews)
2015/10/20 01:24:41
I am not familiar with the renderer code, so I don
Donn Denman
2015/10/20 21:56:46
Renamed ContextualSearchApiController, which seeme
|
+ |
+ content::NotificationRegistrar registrar_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ContextualSearchService); |
+}; |
+ |
+#endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_ |