Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_SERVICE_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_SERVICE_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/profiles/profile_keyed_service.h" | 12 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 13 #include "content/public/browser/notification_observer.h" | |
| 14 #include "content/public/browser/notification_registrar.h" | |
| 13 | 15 |
| 14 // Tracks render process host ids that are associated with Instant. | 16 // Tracks render process host ids that are associated with Instant. |
| 15 class InstantService : public ProfileKeyedService { | 17 class InstantService : public ProfileKeyedService, |
| 18 public content::NotificationObserver { | |
| 16 public: | 19 public: |
| 17 InstantService(); | 20 InstantService(); |
| 18 virtual ~InstantService(); | 21 virtual ~InstantService(); |
| 19 | 22 |
| 20 // Add, remove, and query RenderProcessHost IDs that are associated with | 23 // Add, remove, and query RenderProcessHost IDs that are associated with |
| 21 // Instant processes. | 24 // Instant processes. |
| 22 void AddInstantProcess(int process_id); | 25 void AddInstantProcess(int process_id); |
| 23 void RemoveInstantProcess(int process_id); | |
| 24 bool IsInstantProcess(int process_id) const; | 26 bool IsInstantProcess(int process_id) const; |
| 25 | 27 |
| 26 // For testing. | 28 // For testing. |
| 27 int GetInstantProcessCount() const; | 29 int GetInstantProcessCount() const; |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 // ProfileKeyedService: | 32 // ProfileKeyedService: |
| 31 virtual void Shutdown() OVERRIDE; | 33 virtual void Shutdown() OVERRIDE; |
| 32 | 34 |
| 35 virtual void Observe(int type, | |
| 36 const content::NotificationSource& source, | |
|
dhollowa
2013/02/01 16:56:11
nit: indent
jam
2013/02/01 17:09:14
Done.
| |
| 37 const content::NotificationDetails& details) OVERRIDE; | |
| 38 | |
| 33 // The process ids associated with Instant processes. | 39 // The process ids associated with Instant processes. |
| 34 std::set<int> process_ids_; | 40 std::set<int> process_ids_; |
| 35 | 41 |
| 42 content::NotificationRegistrar registrar_; | |
| 43 | |
| 36 DISALLOW_COPY_AND_ASSIGN(InstantService); | 44 DISALLOW_COPY_AND_ASSIGN(InstantService); |
| 37 }; | 45 }; |
| 38 | 46 |
| 39 #endif // CHROME_BROWSER_INSTANT_INSTANT_SERVICE_H_ | 47 #endif // CHROME_BROWSER_INSTANT_INSTANT_SERVICE_H_ |
| OLD | NEW |