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

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

Issue 12211029: Sanity tweaks to the extension blacklist: check all extensions at once on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class SequencedTaskRunner; 54 class SequencedTaskRunner;
55 } 55 }
56 56
57 namespace extensions { 57 namespace extensions {
58 class AppNotificationManager; 58 class AppNotificationManager;
59 class AppSyncData; 59 class AppSyncData;
60 class BrowserEventRouter; 60 class BrowserEventRouter;
61 class ComponentLoader; 61 class ComponentLoader;
62 class ContentSettingsStore; 62 class ContentSettingsStore;
63 class CrxInstaller; 63 class CrxInstaller;
64 class Extension;
65 class ExtensionActionStorageManager; 64 class ExtensionActionStorageManager;
66 class ExtensionSyncData; 65 class ExtensionSyncData;
67 class ExtensionSystem; 66 class ExtensionSystem;
68 class ExtensionUpdater; 67 class ExtensionUpdater;
69 class PendingExtensionManager; 68 class PendingExtensionManager;
70 class SettingsFrontend; 69 class SettingsFrontend;
71 } 70 }
72 71
73 namespace syncer { 72 namespace syncer {
74 class SyncErrorFactory; 73 class SyncErrorFactory;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 const std::string& extension_id) const = 0; 109 const std::string& extension_id) const = 0;
111 110
112 virtual void CheckManagementPolicy() = 0; 111 virtual void CheckManagementPolicy() = 0;
113 112
114 // Safe to call multiple times in a row. 113 // Safe to call multiple times in a row.
115 // 114 //
116 // TODO(akalin): Remove this method (and others) once we refactor 115 // TODO(akalin): Remove this method (and others) once we refactor
117 // themes sync to not use it directly. 116 // themes sync to not use it directly.
118 virtual void CheckForUpdatesSoon() = 0; 117 virtual void CheckForUpdatesSoon() = 0;
119 118
119 virtual void AddExtensions(const extensions::ExtensionList& extensions) = 0;
120 virtual void AddExtension(const extensions::Extension* extension) = 0; 120 virtual void AddExtension(const extensions::Extension* extension) = 0;
121 virtual void AddComponentExtension( 121 virtual void AddComponentExtension(
122 const extensions::Extension* extension) = 0; 122 const extensions::Extension* extension) = 0;
123 123
124 virtual void UnloadExtension( 124 virtual void UnloadExtension(
125 const std::string& extension_id, 125 const std::string& extension_id,
126 extension_misc::UnloadedExtensionReason reason) = 0; 126 extension_misc::UnloadedExtensionReason reason) = 0;
127 127
128 virtual void SyncExtensionChangeIfNeeded( 128 virtual void SyncExtensionChangeIfNeeded(
129 const extensions::Extension& extension) = 0; 129 const extensions::Extension& extension) = 0;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // permissions the given extension has been granted. 421 // permissions the given extension has been granted.
422 bool ExtensionBindingsAllowed(const GURL& url); 422 bool ExtensionBindingsAllowed(const GURL& url);
423 423
424 // Returns true if a normal browser window should avoid showing |url| in a 424 // Returns true if a normal browser window should avoid showing |url| in a
425 // tab. In this case, |url| is also rewritten to an error URL. 425 // tab. In this case, |url| is also rewritten to an error URL.
426 bool ShouldBlockUrlInBrowserTab(GURL* url); 426 bool ShouldBlockUrlInBrowserTab(GURL* url);
427 427
428 // Called when the initial extensions load has completed. 428 // Called when the initial extensions load has completed.
429 virtual void OnLoadedInstalledExtensions(); 429 virtual void OnLoadedInstalledExtensions();
430 430
431 // Adds |extension| to this ExtensionService and notifies observers than an 431 // Adds every extension in |extensions| to this ExtensionService and notifies
432 // extension has been loaded. Called by the backend after an extension has 432 // observers that the extensions have been loaded, then asynchronously checks
433 // been loaded from a file and installed. 433 // those against the blacklist.
434 //
435 // If possible, please check the blacklist ahead of time, since this method
436 // may end up loading blacklisted extensions for a short period of time.
437 virtual void AddExtensions(
438 const extensions::ExtensionList& extensions) OVERRIDE;
439
440 // Calls AddExtensions with a single extension, please see comment.
434 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; 441 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE;
435 442
436 // Check if we have preferences for the component extension and, if not or if 443 // Check if we have preferences for the component extension and, if not or if
437 // the stored version differs, install the extension (without requirements 444 // the stored version differs, install the extension (without requirements
438 // checking) before calling AddExtension. 445 // checking) before calling AddNonBlacklistedExtension.
439 virtual void AddComponentExtension(const extensions::Extension* extension) 446 virtual void AddComponentExtension(const extensions::Extension* extension)
440 OVERRIDE; 447 OVERRIDE;
441 448
442 // Called by the backend when an extension has been installed. 449 // Instructs the extension service to install an extension some point in the
443 void OnExtensionInstalled( 450 // future, then runs |on_done|.
Matt Perry 2013/02/07 01:05:35 After thinking about it, I can see the reasoning b
Matt Perry 2013/02/07 01:10:23 Actually, lets just make it explicit. Keep OnExten
not at google - send to devlin 2013/02/07 02:11:37 Done.
451 //
452 // If installation succeeds the callback will be passed true. If it fails
453 // (e.g. due to blacklisting) then it will be passed false.
454 void InstallExtensionAsync(
444 const extensions::Extension* extension, 455 const extensions::Extension* extension,
445 const syncer::StringOrdinal& page_ordinal, 456 const syncer::StringOrdinal& page_ordinal,
446 bool has_requirement_errors, 457 bool has_requirement_errors,
458 bool wait_for_idle,
459 const base::Callback<void(bool /*success*/)>& on_done);
460
461 // Instructs the extension service to install an extension now. No blacklist
462 // checking is done.
463 void InstallExtensionNow(
464 const extensions::Extension* extension,
465 const syncer::StringOrdinal& page_ordinal,
466 bool has_requirement_errors,
447 bool wait_for_idle); 467 bool wait_for_idle);
448 468
449 // Similar to FinishInstallation, but first checks if there still is an update 469 // Similar to FinishInstallation, but first checks if there still is an update
450 // pending for the extension, and makes sure the extension is still idle. 470 // pending for the extension, and makes sure the extension is still idle.
451 void MaybeFinishDelayedInstallation(const std::string& extension_id); 471 void MaybeFinishDelayedInstallation(const std::string& extension_id);
452 472
453 // Finishes installation of an update for an extension with the specified id, 473 // Finishes installation of an update for an extension with the specified id,
454 // when installation of that extension was previously delayed because the 474 // when installation of that extension was previously delayed because the
455 // extension was in use. 475 // extension was in use.
456 virtual void FinishDelayedInstallation( 476 virtual void FinishDelayedInstallation(
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 }; 769 };
750 770
751 // Adds the given extension to the list of terminated extensions if 771 // Adds the given extension to the list of terminated extensions if
752 // it is not already there and unloads it. 772 // it is not already there and unloads it.
753 void TrackTerminatedExtension(const extensions::Extension* extension); 773 void TrackTerminatedExtension(const extensions::Extension* extension);
754 774
755 // Removes the extension with the given id from the list of 775 // Removes the extension with the given id from the list of
756 // terminated extensions if it is there. 776 // terminated extensions if it is there.
757 void UntrackTerminatedExtension(const std::string& id); 777 void UntrackTerminatedExtension(const std::string& id);
758 778
779 // Adds an extension to the service without checking any blacklist.
780 bool AddNonBlacklistedExtension(const extensions::Extension* extension);
781
759 // Update preferences for a new or updated extension; notify observers that 782 // Update preferences for a new or updated extension; notify observers that
760 // the extension is installed, e.g., to update event handlers on background 783 // the extension is installed, e.g., to update event handlers on background
761 // pages; and perform other extension install tasks before calling 784 // pages; and perform other extension install tasks before calling
762 // AddExtension. 785 // AddNonBlacklistedExtension.
763 void AddNewOrUpdatedExtension(const extensions::Extension* extension, 786 void AddNewOrUpdatedExtension(const extensions::Extension* extension,
764 extensions::Extension::State initial_state, 787 extensions::Extension::State initial_state,
765 const syncer::StringOrdinal& page_ordinal); 788 const syncer::StringOrdinal& page_ordinal);
766 789
767 // Handles sending notification that |extension| was loaded. 790 // Handles sending notification that |extension| was loaded.
768 void NotifyExtensionLoaded(const extensions::Extension* extension); 791 void NotifyExtensionLoaded(const extensions::Extension* extension);
769 792
770 // Handles sending notification that |extension| was unloaded. 793 // Handles sending notification that |extension| was unloaded.
771 void NotifyExtensionUnloaded(const extensions::Extension* extension, 794 void NotifyExtensionUnloaded(const extensions::Extension* extension,
772 extension_misc::UnloadedExtensionReason reason); 795 extension_misc::UnloadedExtensionReason reason);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 #endif 1026 #endif
1004 1027
1005 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1028 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
1006 InstallAppsWithUnlimtedStorage); 1029 InstallAppsWithUnlimtedStorage);
1007 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1030 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
1008 InstallAppsAndCheckStorageProtection); 1031 InstallAppsAndCheckStorageProtection);
1009 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 1032 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
1010 }; 1033 };
1011 1034
1012 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 1035 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698