| 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 <string> | 10 #include <string> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // or NULL if none. | 55 // or NULL if none. |
| 56 BackgroundContents* GetAppBackgroundContents(const string16& appid); | 56 BackgroundContents* GetAppBackgroundContents(const string16& appid); |
| 57 | 57 |
| 58 // Returns all currently opened BackgroundContents (used by the task manager). | 58 // Returns all currently opened BackgroundContents (used by the task manager). |
| 59 std::vector<BackgroundContents*> GetBackgroundContents() const; | 59 std::vector<BackgroundContents*> GetBackgroundContents() const; |
| 60 | 60 |
| 61 // BackgroundContents::Delegate implementation. | 61 // BackgroundContents::Delegate implementation. |
| 62 virtual void AddTabContents(TabContents* new_contents, | 62 virtual void AddTabContents(TabContents* new_contents, |
| 63 WindowOpenDisposition disposition, | 63 WindowOpenDisposition disposition, |
| 64 const gfx::Rect& initial_pos, | 64 const gfx::Rect& initial_pos, |
| 65 bool user_gesture); | 65 bool user_gesture) OVERRIDE; |
| 66 | 66 |
| 67 // Gets the parent application id for the passed BackgroundContents. Returns | 67 // Gets the parent application id for the passed BackgroundContents. Returns |
| 68 // an empty string if no parent application found (e.g. passed | 68 // an empty string if no parent application found (e.g. passed |
| 69 // BackgroundContents has already shut down). | 69 // BackgroundContents has already shut down). |
| 70 const string16& GetParentApplicationId(BackgroundContents* contents) const; | 70 const string16& GetParentApplicationId(BackgroundContents* contents) const; |
| 71 | 71 |
| 72 // Creates a new BackgroundContents using the passed |site| and | 72 // Creates a new BackgroundContents using the passed |site| and |
| 73 // the |route_id| and begins tracking the object internally so it can be | 73 // the |route_id| and begins tracking the object internally so it can be |
| 74 // shutdown if the parent application is uninstalled. | 74 // shutdown if the parent application is uninstalled. |
| 75 // A BACKGROUND_CONTENTS_OPENED notification will be generated with the passed | 75 // A BACKGROUND_CONTENTS_OPENED notification will be generated with the passed |
| (...skipping 25 matching lines...) Expand all Loading... |
| 101 NoticeBGContentsChanges); | 101 NoticeBGContentsChanges); |
| 102 FRIEND_TEST_ALL_PREFIXES(TaskManagerBrowserTest, | 102 FRIEND_TEST_ALL_PREFIXES(TaskManagerBrowserTest, |
| 103 KillBGContents); | 103 KillBGContents); |
| 104 | 104 |
| 105 // Registers for various notifications. | 105 // Registers for various notifications. |
| 106 void StartObserving(Profile* profile); | 106 void StartObserving(Profile* profile); |
| 107 | 107 |
| 108 // content::NotificationObserver implementation. | 108 // content::NotificationObserver implementation. |
| 109 virtual void Observe(int type, | 109 virtual void Observe(int type, |
| 110 const content::NotificationSource& source, | 110 const content::NotificationSource& source, |
| 111 const content::NotificationDetails& details); | 111 const content::NotificationDetails& details) OVERRIDE; |
| 112 | 112 |
| 113 // Loads all registered BackgroundContents at startup. | 113 // Loads all registered BackgroundContents at startup. |
| 114 void LoadBackgroundContentsFromPrefs(Profile* profile); | 114 void LoadBackgroundContentsFromPrefs(Profile* profile); |
| 115 | 115 |
| 116 // Load a BackgroundContent; the settings are read from the provided | 116 // Load a BackgroundContent; the settings are read from the provided |
| 117 // dictionary. | 117 // dictionary. |
| 118 void LoadBackgroundContentsFromDictionary( | 118 void LoadBackgroundContentsFromDictionary( |
| 119 Profile* profile, | 119 Profile* profile, |
| 120 const std::string& extension_id, | 120 const std::string& extension_id, |
| 121 const base::DictionaryValue* contents); | 121 const base::DictionaryValue* contents); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // applications. | 171 // applications. |
| 172 // Key: application id | 172 // Key: application id |
| 173 // Value: BackgroundContentsInfo for the BC associated with that application | 173 // Value: BackgroundContentsInfo for the BC associated with that application |
| 174 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; | 174 typedef std::map<string16, BackgroundContentsInfo> BackgroundContentsMap; |
| 175 BackgroundContentsMap contents_map_; | 175 BackgroundContentsMap contents_map_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); | 177 DISALLOW_COPY_AND_ASSIGN(BackgroundContentsService); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ | 180 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_H_ |
| OLD | NEW |