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