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

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 7189029: Implement an initial extension settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Change where extension settings are saved, update TODO, api test Created 9 years, 6 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
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_EXTENSIONS_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 26 matching lines...) Expand all
37 #include "content/common/notification_observer.h" 37 #include "content/common/notification_observer.h"
38 #include "content/common/notification_registrar.h" 38 #include "content/common/notification_registrar.h"
39 #include "content/common/property_bag.h" 39 #include "content/common/property_bag.h"
40 40
41 class CrxInstaller; 41 class CrxInstaller;
42 class ExtensionBrowserEventRouter; 42 class ExtensionBrowserEventRouter;
43 class ExtensionContentSettingsStore; 43 class ExtensionContentSettingsStore;
44 class ExtensionInstallUI; 44 class ExtensionInstallUI;
45 class ExtensionPreferenceEventRouter; 45 class ExtensionPreferenceEventRouter;
46 class ExtensionServiceBackend; 46 class ExtensionServiceBackend;
47 class ExtensionSettings;
47 struct ExtensionSyncData; 48 struct ExtensionSyncData;
48 class ExtensionToolbarModel; 49 class ExtensionToolbarModel;
49 class ExtensionUpdater; 50 class ExtensionUpdater;
50 class GURL; 51 class GURL;
51 class PendingExtensionManager; 52 class PendingExtensionManager;
52 class Profile; 53 class Profile;
53 class Version; 54 class Version;
54 55
55 // This is an interface class to encapsulate the dependencies that 56 // This is an interface class to encapsulate the dependencies that
56 // various classes have on ExtensionService. This allows easy mocking. 57 // various classes have on ExtensionService. This allows easy mocking.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // The name of the directory inside the profile where extensions are 146 // The name of the directory inside the profile where extensions are
146 // installed to. 147 // installed to.
147 static const char* kInstallDirectoryName; 148 static const char* kInstallDirectoryName;
148 149
149 // If auto-updates are turned on, default to running every 5 hours. 150 // If auto-updates are turned on, default to running every 5 hours.
150 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; 151 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5;
151 152
152 // The name of the file that the current active version number is stored in. 153 // The name of the file that the current active version number is stored in.
153 static const char* kCurrentVersionFileName; 154 static const char* kCurrentVersionFileName;
154 155
156 // The name of the directory inside the profile where per-extension settings
157 // are stored.
158 static const char* kSettingsDirectoryName;
159
155 // Determine if a given extension download should be treated as if it came 160 // Determine if a given extension download should be treated as if it came
156 // from the gallery. Note that this is requires *both* that the download_url 161 // from the gallery. Note that this is requires *both* that the download_url
157 // match and that the download was referred from a gallery page. 162 // match and that the download was referred from a gallery page.
158 bool IsDownloadFromGallery(const GURL& download_url, 163 bool IsDownloadFromGallery(const GURL& download_url,
159 const GURL& referrer_url); 164 const GURL& referrer_url);
160 165
161 // Determine if the downloaded extension came from the theme mini-gallery, 166 // Determine if the downloaded extension came from the theme mini-gallery,
162 // Used to test if we need to show the "Loading" dialog for themes. 167 // Used to test if we need to show the "Loading" dialog for themes.
163 static bool IsDownloadFromMiniGallery(const GURL& download_url); 168 static bool IsDownloadFromMiniGallery(const GURL& download_url);
164 169
(...skipping 14 matching lines...) Expand all
179 // true iff the target extension exists. 184 // true iff the target extension exists.
180 static bool UninstallExtensionHelper(ExtensionService* extensions_service, 185 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
181 const std::string& extension_id); 186 const std::string& extension_id);
182 187
183 // Constructor stores pointers to |profile| and |extension_prefs| but 188 // Constructor stores pointers to |profile| and |extension_prefs| but
184 // ownership remains at caller. 189 // ownership remains at caller.
185 ExtensionService(Profile* profile, 190 ExtensionService(Profile* profile,
186 const CommandLine* command_line, 191 const CommandLine* command_line,
187 const FilePath& install_directory, 192 const FilePath& install_directory,
188 ExtensionPrefs* extension_prefs, 193 ExtensionPrefs* extension_prefs,
194 ExtensionSettings* extension_settings,
189 bool autoupdate_enabled, 195 bool autoupdate_enabled,
190 bool extensions_enabled); 196 bool extensions_enabled);
191 197
192 virtual ~ExtensionService(); 198 virtual ~ExtensionService();
193 199
194 // Gets the list of currently installed extensions. 200 // Gets the list of currently installed extensions.
195 virtual const ExtensionList* extensions() const OVERRIDE; 201 virtual const ExtensionList* extensions() const OVERRIDE;
196 const ExtensionList* disabled_extensions() const; 202 const ExtensionList* disabled_extensions() const;
197 const ExtensionList* terminated_extensions() const; 203 const ExtensionList* terminated_extensions() const;
198 204
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 bool show_extensions_prompts() { 428 bool show_extensions_prompts() {
423 return show_extensions_prompts_; 429 return show_extensions_prompts_;
424 } 430 }
425 431
426 Profile* profile(); 432 Profile* profile();
427 433
428 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, 434 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const,
429 // ExtensionPrefs* mutable_extension_prefs(). 435 // ExtensionPrefs* mutable_extension_prefs().
430 ExtensionPrefs* extension_prefs(); 436 ExtensionPrefs* extension_prefs();
431 437
438 ExtensionSettings* extension_settings();
439
432 ExtensionContentSettingsStore* GetExtensionContentSettingsStore(); 440 ExtensionContentSettingsStore* GetExtensionContentSettingsStore();
433 441
434 // Whether the extension service is ready. 442 // Whether the extension service is ready.
435 // TODO(skerner): Get rid of this method. crbug.com/63756 443 // TODO(skerner): Get rid of this method. crbug.com/63756
436 bool is_ready() { return ready_; } 444 bool is_ready() { return ready_; }
437 445
438 // Note that this may return NULL if autoupdate is not turned on. 446 // Note that this may return NULL if autoupdate is not turned on.
439 ExtensionUpdater* updater(); 447 ExtensionUpdater* updater();
440 448
441 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } 449 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 base::WeakPtrFactory<ExtensionService> weak_ptr_factory_; 604 base::WeakPtrFactory<ExtensionService> weak_ptr_factory_;
597 605
598 ScopedRunnableMethodFactory<ExtensionService> method_factory_; 606 ScopedRunnableMethodFactory<ExtensionService> method_factory_;
599 607
600 // The profile this ExtensionService is part of. 608 // The profile this ExtensionService is part of.
601 Profile* profile_; 609 Profile* profile_;
602 610
603 // Preferences for the owning profile (weak reference). 611 // Preferences for the owning profile (weak reference).
604 ExtensionPrefs* extension_prefs_; 612 ExtensionPrefs* extension_prefs_;
605 613
614 // Settings for the owning profile (weak reference).
615 ExtensionSettings* extension_settings_;
616
606 // The current list of installed extensions. 617 // The current list of installed extensions.
607 // TODO(aa): This should use chrome/common/extensions/extension_set.h. 618 // TODO(aa): This should use chrome/common/extensions/extension_set.h.
608 ExtensionList extensions_; 619 ExtensionList extensions_;
609 620
610 // The list of installed extensions that have been disabled. 621 // The list of installed extensions that have been disabled.
611 ExtensionList disabled_extensions_; 622 ExtensionList disabled_extensions_;
612 623
613 // The list of installed extensions that have been terminated. 624 // The list of installed extensions that have been terminated.
614 ExtensionList terminated_extensions_; 625 ExtensionList terminated_extensions_;
615 626
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 NaClModuleInfoList nacl_module_list_; 717 NaClModuleInfoList nacl_module_list_;
707 718
708 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 719 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
709 InstallAppsWithUnlimtedStorage); 720 InstallAppsWithUnlimtedStorage);
710 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 721 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
711 InstallAppsAndCheckStorageProtection); 722 InstallAppsAndCheckStorageProtection);
712 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 723 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
713 }; 724 };
714 725
715 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 726 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698