| OLD | NEW |
| 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_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 #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/profiles/profile_keyed_service.h" |
| 16 #include "chrome/browser/tab_contents/background_contents.h" | 16 #include "chrome/browser/tab_contents/background_contents.h" |
| 17 #include "content/common/notification_observer.h" | 17 #include "content/common/notification_observer.h" |
| 18 #include "content/common/notification_registrar.h" | 18 #include "content/common/notification_registrar.h" |
| 19 #include "content/common/window_container_type.h" | 19 #include "content/common/window_container_type.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "webkit/glue/window_open_disposition.h" | 21 #include "webkit/glue/window_open_disposition.h" |
| 22 | 22 |
| 23 class CommandLine; | 23 class CommandLine; |
| 24 class DictionaryValue; | |
| 25 class NotificationDelegate; | 24 class NotificationDelegate; |
| 26 class PrefService; | 25 class PrefService; |
| 27 class Profile; | 26 class Profile; |
| 28 class TabContents; | 27 class TabContents; |
| 29 | 28 |
| 29 namespace base { |
| 30 class DictionaryValue; |
| 31 } |
| 32 |
| 30 namespace gfx { | 33 namespace gfx { |
| 31 class Rect; | 34 class Rect; |
| 32 } | 35 } |
| 33 | 36 |
| 34 struct BackgroundContentsOpenedDetails; | 37 struct BackgroundContentsOpenedDetails; |
| 35 | 38 |
| 36 // BackgroundContentsService is owned by the profile, and is responsible for | 39 // BackgroundContentsService is owned by the profile, and is responsible for |
| 37 // managing the lifetime of BackgroundContents (tracking the set of background | 40 // managing the lifetime of BackgroundContents (tracking the set of background |
| 38 // urls, loading them at startup, and keeping the browser process alive as long | 41 // urls, loading them at startup, and keeping the browser process alive as long |
| 39 // as there are BackgroundContents loaded). | 42 // as there are BackgroundContents loaded). |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // NotificationObserver implementation. | 110 // NotificationObserver implementation. |
| 108 virtual void Observe(int type, | 111 virtual void Observe(int type, |
| 109 const NotificationSource& source, | 112 const NotificationSource& source, |
| 110 const NotificationDetails& details); | 113 const NotificationDetails& details); |
| 111 | 114 |
| 112 // Loads all registered BackgroundContents at startup. | 115 // Loads all registered BackgroundContents at startup. |
| 113 void LoadBackgroundContentsFromPrefs(Profile* profile); | 116 void LoadBackgroundContentsFromPrefs(Profile* profile); |
| 114 | 117 |
| 115 // Load a BackgroundContent; the settings are read from the provided | 118 // Load a BackgroundContent; the settings are read from the provided |
| 116 // dictionary. | 119 // dictionary. |
| 117 void LoadBackgroundContentsFromDictionary(Profile* profile, | 120 void LoadBackgroundContentsFromDictionary( |
| 118 const std::string& extension_id, | 121 Profile* profile, |
| 119 const DictionaryValue* contents); | 122 const std::string& extension_id, |
| 123 const base::DictionaryValue* contents); |
| 120 | 124 |
| 121 // Load the manifest-specified BackgroundContents for all apps for the | 125 // Load the manifest-specified BackgroundContents for all apps for the |
| 122 // profile. | 126 // profile. |
| 123 void LoadBackgroundContentsFromManifests(Profile* profile); | 127 void LoadBackgroundContentsFromManifests(Profile* profile); |
| 124 | 128 |
| 125 // Creates a single BackgroundContents associated with the specified |appid|, | 129 // Creates a single BackgroundContents associated with the specified |appid|, |
| 126 // creates an associated RenderView with the name specified by |frame_name|, | 130 // creates an associated RenderView with the name specified by |frame_name|, |
| 127 // and navigates to the passed |url|. | 131 // and navigates to the passed |url|. |
| 128 void LoadBackgroundContents(Profile* profile, | 132 void LoadBackgroundContents(Profile* profile, |
| 129 const GURL& url, | 133 const GURL& url, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // applications. | 173 // applications. |
| 170 // Key: application id | 174 // Key: application id |
| 171 // Value: BackgroundContentsInfo for the BC associated with that application | 175 // Value: BackgroundContentsInfo for the BC associated with that application |
| 172 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; | 176 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; |
| 173 BackgroundContentsMap contents_map_; | 177 BackgroundContentsMap contents_map_; |
| 174 | 178 |
| 175 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); | 179 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); |
| 176 }; | 180 }; |
| 177 | 181 |
| 178 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ | 182 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ |
| OLD | NEW |