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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 bool HasRegisteredBackgroundContents(const base::string16& appid); | 86 bool HasRegisteredBackgroundContents(const base::string16& appid); |
87 | 87 |
88 // Returns all currently opened BackgroundContents (used by the task manager). | 88 // Returns all currently opened BackgroundContents (used by the task manager). |
89 std::vector<BackgroundContents*> GetBackgroundContents() const; | 89 std::vector<BackgroundContents*> GetBackgroundContents() const; |
90 | 90 |
91 // BackgroundContents::Delegate implementation. | 91 // BackgroundContents::Delegate implementation. |
92 virtual void AddWebContents(content::WebContents* new_contents, | 92 virtual void AddWebContents(content::WebContents* new_contents, |
93 WindowOpenDisposition disposition, | 93 WindowOpenDisposition disposition, |
94 const gfx::Rect& initial_pos, | 94 const gfx::Rect& initial_pos, |
95 bool user_gesture, | 95 bool user_gesture, |
96 bool* was_blocked) OVERRIDE; | 96 bool* was_blocked) override; |
97 | 97 |
98 // Gets the parent application id for the passed BackgroundContents. Returns | 98 // Gets the parent application id for the passed BackgroundContents. Returns |
99 // an empty string if no parent application found (e.g. passed | 99 // an empty string if no parent application found (e.g. passed |
100 // BackgroundContents has already shut down). | 100 // BackgroundContents has already shut down). |
101 const base::string16& GetParentApplicationId(BackgroundContents* contents) con
st; | 101 const base::string16& GetParentApplicationId(BackgroundContents* contents) con
st; |
102 | 102 |
103 // Creates a new BackgroundContents using the passed |site| and | 103 // Creates a new BackgroundContents using the passed |site| and |
104 // the |route_id| and begins tracking the object internally so it can be | 104 // the |route_id| and begins tracking the object internally so it can be |
105 // shutdown if the parent application is uninstalled. | 105 // shutdown if the parent application is uninstalled. |
106 // A BACKGROUND_CONTENTS_OPENED notification will be generated with the passed | 106 // A BACKGROUND_CONTENTS_OPENED notification will be generated with the passed |
(...skipping 28 matching lines...) Expand all Loading... |
135 NoticeBGContentsChanges); | 135 NoticeBGContentsChanges); |
136 FRIEND_TEST_ALL_PREFIXES(TaskManagerNoShowBrowserTest, | 136 FRIEND_TEST_ALL_PREFIXES(TaskManagerNoShowBrowserTest, |
137 KillBGContents); | 137 KillBGContents); |
138 | 138 |
139 // Registers for various notifications. | 139 // Registers for various notifications. |
140 void StartObserving(Profile* profile); | 140 void StartObserving(Profile* profile); |
141 | 141 |
142 // content::NotificationObserver implementation. | 142 // content::NotificationObserver implementation. |
143 virtual void Observe(int type, | 143 virtual void Observe(int type, |
144 const content::NotificationSource& source, | 144 const content::NotificationSource& source, |
145 const content::NotificationDetails& details) OVERRIDE; | 145 const content::NotificationDetails& details) override; |
146 | 146 |
147 // extensions::ExtensionRegistryObserver implementation. | 147 // extensions::ExtensionRegistryObserver implementation. |
148 virtual void OnExtensionLoaded( | 148 virtual void OnExtensionLoaded( |
149 content::BrowserContext* browser_context, | 149 content::BrowserContext* browser_context, |
150 const extensions::Extension* extension) OVERRIDE; | 150 const extensions::Extension* extension) override; |
151 virtual void OnExtensionUnloaded( | 151 virtual void OnExtensionUnloaded( |
152 content::BrowserContext* browser_context, | 152 content::BrowserContext* browser_context, |
153 const extensions::Extension* extension, | 153 const extensions::Extension* extension, |
154 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; | 154 extensions::UnloadedExtensionInfo::Reason reason) override; |
155 virtual void OnExtensionUninstalled( | 155 virtual void OnExtensionUninstalled( |
156 content::BrowserContext* browser_context, | 156 content::BrowserContext* browser_context, |
157 const extensions::Extension* extension, | 157 const extensions::Extension* extension, |
158 extensions::UninstallReason reason) OVERRIDE; | 158 extensions::UninstallReason reason) override; |
159 | 159 |
160 // Restarts a force-installed app/extension after a crash. | 160 // Restarts a force-installed app/extension after a crash. |
161 void RestartForceInstalledExtensionOnCrash( | 161 void RestartForceInstalledExtensionOnCrash( |
162 const extensions::Extension* extension, | 162 const extensions::Extension* extension, |
163 Profile* profile); | 163 Profile* profile); |
164 | 164 |
165 // Loads all registered BackgroundContents at startup. | 165 // Loads all registered BackgroundContents at startup. |
166 void LoadBackgroundContentsFromPrefs(Profile* profile); | 166 void LoadBackgroundContentsFromPrefs(Profile* profile); |
167 | 167 |
168 // Load a BackgroundContent; the settings are read from the provided | 168 // Load a BackgroundContent; the settings are read from the provided |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 BackgroundContentsMap contents_map_; | 237 BackgroundContentsMap contents_map_; |
238 | 238 |
239 ScopedObserver<extensions::ExtensionRegistry, | 239 ScopedObserver<extensions::ExtensionRegistry, |
240 extensions::ExtensionRegistryObserver> | 240 extensions::ExtensionRegistryObserver> |
241 extension_registry_observer_; | 241 extension_registry_observer_; |
242 | 242 |
243 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); | 243 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); |
244 }; | 244 }; |
245 | 245 |
246 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ | 246 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ |
OLD | NEW |