Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/background_contents_service.h

Issue 6831016: Profile shouldn't own background page stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/background_contents_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CONTENTS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_BACKGROUND_CONTENTS_SERVICE_H_
6 #define CHROME_BROWSER_BACKGROUND_CONTENTS_SERVICE_H_ 6 #define CHROME_BROWSER_BACKGROUND_CONTENTS_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/task.h" 14 #include "base/task.h"
15 #include "chrome/browser/profiles/profile_keyed_service.h"
15 #include "chrome/browser/tab_contents/background_contents.h" 16 #include "chrome/browser/tab_contents/background_contents.h"
16 #include "content/common/notification_observer.h" 17 #include "content/common/notification_observer.h"
17 #include "content/common/notification_registrar.h" 18 #include "content/common/notification_registrar.h"
18 #include "content/common/window_container_type.h" 19 #include "content/common/window_container_type.h"
19 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
20 #include "webkit/glue/window_open_disposition.h" 21 #include "webkit/glue/window_open_disposition.h"
21 22
22 class CommandLine; 23 class CommandLine;
23 class DictionaryValue; 24 class DictionaryValue;
24 class NotificationDelegate; 25 class NotificationDelegate;
25 class PrefService; 26 class PrefService;
26 class Profile; 27 class Profile;
27 class TabContents; 28 class TabContents;
28 29
29 namespace gfx { 30 namespace gfx {
30 class Rect; 31 class Rect;
31 } 32 }
32 33
33 struct BackgroundContentsOpenedDetails; 34 struct BackgroundContentsOpenedDetails;
34 35
35 // BackgroundContentsService is owned by the profile, and is responsible for 36 // BackgroundContentsService is owned by the profile, and is responsible for
36 // managing the lifetime of BackgroundContents (tracking the set of background 37 // managing the lifetime of BackgroundContents (tracking the set of background
37 // 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
38 // as there are BackgroundContents loaded). 39 // as there are BackgroundContents loaded).
39 // 40 //
40 // It is also responsible for tracking the association between 41 // It is also responsible for tracking the association between
41 // BackgroundContents and their parent app, and shutting them down when the 42 // BackgroundContents and their parent app, and shutting them down when the
42 // parent app is unloaded. 43 // parent app is unloaded.
43 class BackgroundContentsService : private NotificationObserver, 44 class BackgroundContentsService : private NotificationObserver,
44 public BackgroundContents::Delegate { 45 public BackgroundContents::Delegate,
46 public ProfileKeyedService {
45 public: 47 public:
46 BackgroundContentsService(Profile* profile, const CommandLine* command_line); 48 BackgroundContentsService(Profile* profile, const CommandLine* command_line);
47 virtual ~BackgroundContentsService(); 49 virtual ~BackgroundContentsService();
48 50
49 // Returns the BackgroundContents associated with the passed application id, 51 // Returns the BackgroundContents associated with the passed application id,
50 // or NULL if none. 52 // or NULL if none.
51 BackgroundContents* GetAppBackgroundContents(const string16& appid); 53 BackgroundContents* GetAppBackgroundContents(const string16& appid);
52 54
53 // Returns all currently opened BackgroundContents (used by the task manager). 55 // Returns all currently opened BackgroundContents (used by the task manager).
54 std::vector<BackgroundContents*> GetBackgroundContents() const; 56 std::vector<BackgroundContents*> GetBackgroundContents() const;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // applications. 169 // applications.
168 // Key: application id 170 // Key: application id
169 // Value: BackgroundContentsInfo for the BC associated with that application 171 // Value: BackgroundContentsInfo for the BC associated with that application
170 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; 172 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap;
171 BackgroundContentsMap contents_map_; 173 BackgroundContentsMap contents_map_;
172 174
173 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); 175 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService);
174 }; 176 };
175 177
176 #endif // CHROME_BROWSER_BACKGROUND_CONTENTS_SERVICE_H_ 178 #endif // CHROME_BROWSER_BACKGROUND_CONTENTS_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/background_contents_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698