OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_RENDER_PROCESS_HELPER_H_ | 5 #ifndef EXTENSIONS_BROWSER_RENDER_PROCESS_HELPER_H_ |
6 #define EXTENSIONS_BROWSER_RENDER_PROCESS_HELPER_H_ | 6 #define EXTENSIONS_BROWSER_RENDER_PROCESS_HELPER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
11 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class BrowserContext; | 16 class BrowserContext; |
17 class RenderProcessHost; | 17 class RenderProcessHost; |
18 } | 18 } |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
22 // Informs renderers about extensions-related data (channel, available | 22 // Informs renderers about extensions-related data (channel, available |
23 // functions, etc.) when they start. Sends this information to both extension | 23 // functions, etc.) when they start. Sends this information to both extension |
24 // and non-extension renderers, as the non-extension renderers may have content | 24 // and non-extension renderers, as the non-extension renderers may have content |
25 // scripts. Lives on the UI thread. Shared between incognito and non-incognito | 25 // scripts. Lives on the UI thread. Shared between incognito and non-incognito |
26 // browser contexts. | 26 // browser contexts. |
27 class RendererStartupHelper : public BrowserContextKeyedService, | 27 class RendererStartupHelper : public KeyedService, |
28 public content::NotificationObserver { | 28 public content::NotificationObserver { |
29 public: | 29 public: |
30 // This class sends messages to all renderers started for |browser_context|. | 30 // This class sends messages to all renderers started for |browser_context|. |
31 explicit RendererStartupHelper(content::BrowserContext* browser_context); | 31 explicit RendererStartupHelper(content::BrowserContext* browser_context); |
32 virtual ~RendererStartupHelper(); | 32 virtual ~RendererStartupHelper(); |
33 | 33 |
34 // content::NotificationObserver overrides: | 34 // content::NotificationObserver overrides: |
35 virtual void Observe(int type, | 35 virtual void Observe(int type, |
36 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
37 const content::NotificationDetails& details) OVERRIDE; | 37 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
53 content::BrowserContext* context); | 53 content::BrowserContext* context); |
54 static RendererStartupHelperFactory* GetInstance(); | 54 static RendererStartupHelperFactory* GetInstance(); |
55 | 55 |
56 private: | 56 private: |
57 friend struct DefaultSingletonTraits<RendererStartupHelperFactory>; | 57 friend struct DefaultSingletonTraits<RendererStartupHelperFactory>; |
58 | 58 |
59 RendererStartupHelperFactory(); | 59 RendererStartupHelperFactory(); |
60 virtual ~RendererStartupHelperFactory(); | 60 virtual ~RendererStartupHelperFactory(); |
61 | 61 |
62 // BrowserContextKeyedServiceFactory implementation: | 62 // BrowserContextKeyedServiceFactory implementation: |
63 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 63 virtual KeyedService* BuildServiceInstanceFor( |
64 content::BrowserContext* profile) const OVERRIDE; | 64 content::BrowserContext* profile) const OVERRIDE; |
65 virtual content::BrowserContext* GetBrowserContextToUse( | 65 virtual content::BrowserContext* GetBrowserContextToUse( |
66 content::BrowserContext* context) const OVERRIDE; | 66 content::BrowserContext* context) const OVERRIDE; |
67 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; | 67 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(RendererStartupHelperFactory); | 69 DISALLOW_COPY_AND_ASSIGN(RendererStartupHelperFactory); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace extensions | 72 } // namespace extensions |
73 | 73 |
74 #endif // EXTENSIONS_BROWSER_RENDER_PROCESS_HELPER_H_ | 74 #endif // EXTENSIONS_BROWSER_RENDER_PROCESS_HELPER_H_ |
OLD | NEW |