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

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: dgrogan comments #2, mihai comments #1 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // The name of the directory inside the profile where extensions are 148 // The name of the directory inside the profile where extensions are
148 // installed to. 149 // installed to.
149 static const char* kInstallDirectoryName; 150 static const char* kInstallDirectoryName;
150 151
151 // If auto-updates are turned on, default to running every 5 hours. 152 // If auto-updates are turned on, default to running every 5 hours.
152 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; 153 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5;
153 154
154 // The name of the file that the current active version number is stored in. 155 // The name of the file that the current active version number is stored in.
155 static const char* kCurrentVersionFileName; 156 static const char* kCurrentVersionFileName;
156 157
158 // The name of the directory inside the profile where per-extension settings
159 // are stored.
160 static const char* kSettingsDirectoryName;
161
157 // Determine if a given extension download should be treated as if it came 162 // Determine if a given extension download should be treated as if it came
158 // from the gallery. Note that this is requires *both* that the download_url 163 // from the gallery. Note that this is requires *both* that the download_url
159 // match and that the download was referred from a gallery page. 164 // match and that the download was referred from a gallery page.
160 bool IsDownloadFromGallery(const GURL& download_url, 165 bool IsDownloadFromGallery(const GURL& download_url,
161 const GURL& referrer_url); 166 const GURL& referrer_url);
162 167
163 // Determine if the downloaded extension came from the theme mini-gallery, 168 // Determine if the downloaded extension came from the theme mini-gallery,
164 // Used to test if we need to show the "Loading" dialog for themes. 169 // Used to test if we need to show the "Loading" dialog for themes.
165 static bool IsDownloadFromMiniGallery(const GURL& download_url); 170 static bool IsDownloadFromMiniGallery(const GURL& download_url);
166 171
(...skipping 14 matching lines...) Expand all
181 // true iff the target extension exists. 186 // true iff the target extension exists.
182 static bool UninstallExtensionHelper(ExtensionService* extensions_service, 187 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
183 const std::string& extension_id); 188 const std::string& extension_id);
184 189
185 // Constructor stores pointers to |profile| and |extension_prefs| but 190 // Constructor stores pointers to |profile| and |extension_prefs| but
186 // ownership remains at caller. 191 // ownership remains at caller.
187 ExtensionService(Profile* profile, 192 ExtensionService(Profile* profile,
188 const CommandLine* command_line, 193 const CommandLine* command_line,
189 const FilePath& install_directory, 194 const FilePath& install_directory,
190 ExtensionPrefs* extension_prefs, 195 ExtensionPrefs* extension_prefs,
196 ExtensionSettings* extension_settings,
191 bool autoupdate_enabled, 197 bool autoupdate_enabled,
192 bool extensions_enabled); 198 bool extensions_enabled);
193 199
194 virtual ~ExtensionService(); 200 virtual ~ExtensionService();
195 201
196 // Gets the list of currently installed extensions. 202 // Gets the list of currently installed extensions.
197 virtual const ExtensionList* extensions() const OVERRIDE; 203 virtual const ExtensionList* extensions() const OVERRIDE;
198 const ExtensionList* disabled_extensions() const; 204 const ExtensionList* disabled_extensions() const;
199 const ExtensionList* terminated_extensions() const; 205 const ExtensionList* terminated_extensions() const;
200 206
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 bool show_extensions_prompts() { 436 bool show_extensions_prompts() {
431 return show_extensions_prompts_; 437 return show_extensions_prompts_;
432 } 438 }
433 439
434 Profile* profile(); 440 Profile* profile();
435 441
436 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, 442 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const,
437 // ExtensionPrefs* mutable_extension_prefs(). 443 // ExtensionPrefs* mutable_extension_prefs().
438 ExtensionPrefs* extension_prefs(); 444 ExtensionPrefs* extension_prefs();
439 445
446 ExtensionSettings* extension_settings();
447
440 ExtensionContentSettingsStore* GetExtensionContentSettingsStore(); 448 ExtensionContentSettingsStore* GetExtensionContentSettingsStore();
441 449
442 // Whether the extension service is ready. 450 // Whether the extension service is ready.
443 // TODO(skerner): Get rid of this method. crbug.com/63756 451 // TODO(skerner): Get rid of this method. crbug.com/63756
444 bool is_ready() { return ready_; } 452 bool is_ready() { return ready_; }
445 453
446 // Note that this may return NULL if autoupdate is not turned on. 454 // Note that this may return NULL if autoupdate is not turned on.
447 ExtensionUpdater* updater(); 455 ExtensionUpdater* updater();
448 456
449 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } 457 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 base::WeakPtrFactory<ExtensionService> weak_ptr_factory_; 612 base::WeakPtrFactory<ExtensionService> weak_ptr_factory_;
605 613
606 ScopedRunnableMethodFactory<ExtensionService> method_factory_; 614 ScopedRunnableMethodFactory<ExtensionService> method_factory_;
607 615
608 // The profile this ExtensionService is part of. 616 // The profile this ExtensionService is part of.
609 Profile* profile_; 617 Profile* profile_;
610 618
611 // Preferences for the owning profile (weak reference). 619 // Preferences for the owning profile (weak reference).
612 ExtensionPrefs* extension_prefs_; 620 ExtensionPrefs* extension_prefs_;
613 621
622 // Settings for the owning profile (weak reference).
623 ExtensionSettings* extension_settings_;
624
614 // The current list of installed extensions. 625 // The current list of installed extensions.
615 // TODO(aa): This should use chrome/common/extensions/extension_set.h. 626 // TODO(aa): This should use chrome/common/extensions/extension_set.h.
616 ExtensionList extensions_; 627 ExtensionList extensions_;
617 628
618 // The list of installed extensions that have been disabled. 629 // The list of installed extensions that have been disabled.
619 ExtensionList disabled_extensions_; 630 ExtensionList disabled_extensions_;
620 631
621 // The list of installed extensions that have been terminated. 632 // The list of installed extensions that have been terminated.
622 ExtensionList terminated_extensions_; 633 ExtensionList terminated_extensions_;
623 634
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 NaClModuleInfoList nacl_module_list_; 725 NaClModuleInfoList nacl_module_list_;
715 726
716 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 727 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
717 InstallAppsWithUnlimtedStorage); 728 InstallAppsWithUnlimtedStorage);
718 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 729 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
719 InstallAppsAndCheckStorageProtection); 730 InstallAppsAndCheckStorageProtection);
720 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 731 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
721 }; 732 };
722 733
723 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 734 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698