| 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_API_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_API_CONTROLLER_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/memory/singleton.h" |
| 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" |
| 13 |
| 14 // Provides a singleton controller for the Contextual Search API. |
| 15 // Tracks render process host IDs that are associated with ContextualSearch. |
| 16 class ContextualSearchApiController { |
| 17 public: |
| 18 static ContextualSearchApiController* GetInstance(); |
| 19 |
| 20 // Add, remove, and query RenderProcessHost IDs that are associated with |
| 21 // Contextual Search processes. |
| 22 void AddContextualSearchProcess(int process_id); |
| 23 void RemoveContextualSearchProcess(int process_id); |
| 24 bool IsContextualSearchProcess(int process_id) const; |
| 25 |
| 26 private: |
| 27 // Use GetInstance instead of constructing. |
| 28 ContextualSearchApiController(); |
| 29 ~ContextualSearchApiController(); |
| 30 |
| 31 // Singleton: |
| 32 friend struct base::DefaultSingletonTraits<ContextualSearchApiController>; |
| 33 |
| 34 // The process ids associated with Contextual Search processes. |
| 35 std::set<int> process_ids_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(ContextualSearchApiController); |
| 38 }; |
| 39 |
| 40 #endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_API_CONTROLLER_H_ |
| OLD | NEW |