Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_ | |
| 7 | |
| 8 #include "base/memory/singleton.h" | |
| 9 #include "content/public/browser/notification_observer.h" | |
| 10 #include "content/public/browser/notification_registrar.h" | |
| 11 | |
| 12 // Provides a singleton service for Contextual Search. | |
| 13 // Tracks render process host IDs that are associated with ContextualSearch. | |
| 14 class ContextualSearchService : public content::NotificationObserver { | |
| 15 public: | |
| 16 static ContextualSearchService* GetInstance(); | |
| 17 | |
| 18 // Add, remove, and query RenderProcessHost IDs that are associated with | |
| 19 // Contextual Search processes. | |
| 20 void SetContextualSearchProcess(int process_id); | |
| 21 bool IsContextualSearchProcess(int process_id) const; | |
| 22 | |
| 23 private: | |
| 24 // Use GetInstance instead of constructing. | |
| 25 ContextualSearchService(); | |
| 26 ~ContextualSearchService() override; | |
| 27 | |
| 28 // Singleton: | |
| 29 friend struct base::DefaultSingletonTraits<ContextualSearchService>; | |
| 30 | |
| 31 // content::NotificationObserver: | |
| 32 void Observe(int type, | |
| 33 const content::NotificationSource& source, | |
| 34 const content::NotificationDetails& details) override; | |
| 35 | |
| 36 void OnRendererProcessTerminated(int process_id); | |
| 37 | |
| 38 // The process id associated with Contextual Search processes. | |
| 39 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
| |
| 40 | |
| 41 content::NotificationRegistrar registrar_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(ContextualSearchService); | |
| 44 }; | |
| 45 | |
| 46 #endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_ | |
| OLD | NEW |