OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 // Constructor stores pointers to |profile| and |extension_prefs| but | 152 // Constructor stores pointers to |profile| and |extension_prefs| but |
153 // ownership remains at caller. | 153 // ownership remains at caller. |
154 ExtensionsService(Profile* profile, | 154 ExtensionsService(Profile* profile, |
155 const CommandLine* command_line, | 155 const CommandLine* command_line, |
156 const FilePath& install_directory, | 156 const FilePath& install_directory, |
157 ExtensionPrefs* extension_prefs, | 157 ExtensionPrefs* extension_prefs, |
158 bool autoupdate_enabled); | 158 bool autoupdate_enabled); |
159 | 159 |
160 // Gets the list of currently installed extensions. | 160 // Gets the list of currently installed extensions. |
161 virtual const ExtensionList* extensions() const { return &extensions_; } | 161 virtual const ExtensionList* extensions() const; |
162 virtual const ExtensionList* disabled_extensions() const { | 162 virtual const ExtensionList* disabled_extensions() const; |
163 return &disabled_extensions_; | |
164 } | |
165 | 163 |
166 // Gets the set of pending extensions. | 164 // Gets the set of pending extensions. |
167 virtual const PendingExtensionMap& pending_extensions() const { | 165 virtual const PendingExtensionMap& pending_extensions() const; |
168 return pending_extensions_; | |
169 } | |
170 | 166 |
171 // Registers an extension to be loaded as a component extension. | 167 // Registers an extension to be loaded as a component extension. |
172 void register_component_extension(const ComponentExtensionInfo& info) { | 168 void register_component_extension(const ComponentExtensionInfo& info) { |
173 component_extension_manifests_.push_back(info); | 169 component_extension_manifests_.push_back(info); |
174 } | 170 } |
175 | 171 |
176 // Returns true if any extensions are installed. | 172 // Returns true if any extensions are installed. |
177 virtual bool HasInstalledExtensions() { | 173 virtual bool HasInstalledExtensions(); |
178 return !(extensions_.empty() && disabled_extensions_.empty()); | |
179 } | |
180 | 174 |
181 const FilePath& install_directory() const { return install_directory_; } | 175 const FilePath& install_directory() const { return install_directory_; } |
182 | 176 |
183 DefaultApps* default_apps() { return &default_apps_; } | 177 DefaultApps* default_apps() { return &default_apps_; } |
184 | 178 |
185 // Whether this extension can run in an incognito window. | 179 // Whether this extension can run in an incognito window. |
186 bool IsIncognitoEnabled(const Extension* extension); | 180 bool IsIncognitoEnabled(const Extension* extension); |
187 void SetIsIncognitoEnabled(const Extension* extension, bool enabled); | 181 void SetIsIncognitoEnabled(const Extension* extension, bool enabled); |
188 | 182 |
189 // Returns true if the given extension can see events and data from another | 183 // Returns true if the given extension can see events and data from another |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 bool show_extensions_prompts() { | 391 bool show_extensions_prompts() { |
398 return show_extensions_prompts_; | 392 return show_extensions_prompts_; |
399 } | 393 } |
400 | 394 |
401 Profile* profile() { return profile_; } | 395 Profile* profile() { return profile_; } |
402 | 396 |
403 // Profile calls this when it is being destroyed so that we know not to call | 397 // Profile calls this when it is being destroyed so that we know not to call |
404 // it. | 398 // it. |
405 void DestroyingProfile(); | 399 void DestroyingProfile(); |
406 | 400 |
407 virtual ExtensionPrefs* extension_prefs() { return extension_prefs_; } | 401 virtual ExtensionPrefs* extension_prefs(); |
408 | 402 |
409 // Whether the extension service is ready. | 403 // Whether the extension service is ready. |
410 // TODO(skerner): Get rid of this method. crbug.com/63756 | 404 // TODO(skerner): Get rid of this method. crbug.com/63756 |
411 bool is_ready() { return ready_; } | 405 bool is_ready() { return ready_; } |
412 | 406 |
413 // Note that this may return NULL if autoupdate is not turned on. | 407 // Note that this may return NULL if autoupdate is not turned on. |
414 ExtensionUpdater* updater() { return updater_.get(); } | 408 ExtensionUpdater* updater() { return updater_.get(); } |
415 | 409 |
416 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } | 410 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } |
417 | 411 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 594 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
601 UpdatePendingExtensionAlreadyInstalled); | 595 UpdatePendingExtensionAlreadyInstalled); |
602 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 596 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
603 InstallAppsWithUnlimtedStorage); | 597 InstallAppsWithUnlimtedStorage); |
604 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 598 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
605 InstallAppsAndCheckStorageProtection); | 599 InstallAppsAndCheckStorageProtection); |
606 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); | 600 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); |
607 }; | 601 }; |
608 | 602 |
609 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 603 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
OLD | NEW |