OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ |
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ | 6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 25 matching lines...) Expand all Loading... |
36 // BackgroundContentsService is owned by the profile, and is responsible for | 36 // BackgroundContentsService is owned by the profile, and is responsible for |
37 // managing the lifetime of BackgroundContents (tracking the set of background | 37 // managing the lifetime of BackgroundContents (tracking the set of background |
38 // urls, loading them at startup, and keeping the browser process alive as long | 38 // urls, loading them at startup, and keeping the browser process alive as long |
39 // as there are BackgroundContents loaded). | 39 // as there are BackgroundContents loaded). |
40 // | 40 // |
41 // It is also responsible for tracking the association between | 41 // It is also responsible for tracking the association between |
42 // BackgroundContents and their parent app, and shutting them down when the | 42 // BackgroundContents and their parent app, and shutting them down when the |
43 // parent app is unloaded. | 43 // parent app is unloaded. |
44 class BackgroundContentsService : private content::NotificationObserver, | 44 class BackgroundContentsService : private content::NotificationObserver, |
45 public BackgroundContents::Delegate, | 45 public BackgroundContents::Delegate, |
46 public ProfileKeyedService { | 46 public BrowserContextKeyedService { |
47 public: | 47 public: |
48 BackgroundContentsService(Profile* profile, const CommandLine* command_line); | 48 BackgroundContentsService(Profile* profile, const CommandLine* command_line); |
49 virtual ~BackgroundContentsService(); | 49 virtual ~BackgroundContentsService(); |
50 | 50 |
51 // Returns the BackgroundContents associated with the passed application id, | 51 // Returns the BackgroundContents associated with the passed application id, |
52 // or NULL if none. | 52 // or NULL if none. |
53 BackgroundContents* GetAppBackgroundContents(const string16& appid); | 53 BackgroundContents* GetAppBackgroundContents(const string16& appid); |
54 | 54 |
55 // Returns true if there's a registered BackgroundContents for this app. It | 55 // Returns true if there's a registered BackgroundContents for this app. It |
56 // is possible for this routine to return true when GetAppBackgroundContents() | 56 // is possible for this routine to return true when GetAppBackgroundContents() |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // applications. | 180 // applications. |
181 // Key: application id | 181 // Key: application id |
182 // Value: BackgroundContentsInfo for the BC associated with that application | 182 // Value: BackgroundContentsInfo for the BC associated with that application |
183 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; | 183 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; |
184 BackgroundContentsMap contents_map_; | 184 BackgroundContentsMap contents_map_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); | 186 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); |
187 }; | 187 }; |
188 | 188 |
189 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ | 189 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ |
OLD | NEW |