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

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

Issue 131743021: app_shell: Extract extension runtime data from ExtensionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: TriggerOnUnloaded (runtime_data) Created 6 years, 11 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 const base::FilePath& install_directory() const { return install_directory_; } 180 const base::FilePath& install_directory() const { return install_directory_; }
181 181
182 // Updates the app launcher value for the moved extension so that it is now 182 // Updates the app launcher value for the moved extension so that it is now
183 // located after the given predecessor and before the successor. This will 183 // located after the given predecessor and before the successor. This will
184 // trigger a sync if needed. Empty strings are used to indicate no successor 184 // trigger a sync if needed. Empty strings are used to indicate no successor
185 // or predecessor. 185 // or predecessor.
186 void OnExtensionMoved(const std::string& moved_extension_id, 186 void OnExtensionMoved(const std::string& moved_extension_id,
187 const std::string& predecessor_extension_id, 187 const std::string& predecessor_extension_id,
188 const std::string& successor_extension_id); 188 const std::string& successor_extension_id);
189 189
190 // Whether the persistent background page, if any, is ready. We don't load
191 // other components until then. If there is no background page, or if it is
192 // non-persistent (lazy), we consider it to be ready.
193 bool IsBackgroundPageReady(const extensions::Extension* extension) const;
194 void SetBackgroundPageReady(const extensions::Extension* extension);
195
196 // Getter and setter for the flag that specifies whether the extension is
197 // being upgraded.
198 bool IsBeingUpgraded(const extensions::Extension* extension) const;
199 void SetBeingUpgraded(const extensions::Extension* extension, bool value);
200
201 // Getter and setter for the flag that specifies whether the extension is 190 // Getter and setter for the flag that specifies whether the extension is
202 // being reloaded. 191 // being reloaded.
203 bool IsBeingReloaded(const std::string& extension_id) const; 192 bool IsBeingReloaded(const std::string& extension_id) const;
204 void SetBeingReloaded(const std::string& extension_id, bool value); 193 void SetBeingReloaded(const std::string& extension_id, bool value);
205 194
206 // Getter and setter for the flag that specifies if the extension has used
207 // the webrequest API.
208 // TODO(mpcomplete): remove. http://crbug.com/100411
209 bool HasUsedWebRequest(const extensions::Extension* extension) const;
210 void SetHasUsedWebRequest(const extensions::Extension* extension, bool value);
211
212 // Initialize and start all installed extensions. 195 // Initialize and start all installed extensions.
213 void Init(); 196 void Init();
214 197
215 // Attempts to verify all extensions using the InstallVerifier. 198 // Attempts to verify all extensions using the InstallVerifier.
216 void VerifyAllExtensions(); 199 void VerifyAllExtensions();
217 200
218 // Once the verifier work is finished, we may want to re-check management 201 // Once the verifier work is finished, we may want to re-check management
219 // policy if |success| indicates the verifier got a new signature back. 202 // policy if |success| indicates the verifier got a new signature back.
220 void FinishVerifyAllExtensions(bool success); 203 void FinishVerifyAllExtensions(bool success);
221 204
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 #if defined(OS_CHROMEOS) 592 #if defined(OS_CHROMEOS)
610 void disable_garbage_collection() { 593 void disable_garbage_collection() {
611 disable_garbage_collection_ = true; 594 disable_garbage_collection_ = true;
612 } 595 }
613 void enable_garbage_collection() { 596 void enable_garbage_collection() {
614 disable_garbage_collection_ = false; 597 disable_garbage_collection_ = false;
615 } 598 }
616 #endif 599 #endif
617 600
618 private: 601 private:
619 // Contains Extension data that can change during the life of the process,
620 // but does not persist across restarts.
621 struct ExtensionRuntimeData {
622 // True if the background page is ready.
623 bool background_page_ready;
624
625 // True while the extension is being upgraded.
626 bool being_upgraded;
627
628 // True if the extension has used the webRequest API.
629 bool has_used_webrequest;
630
631 ExtensionRuntimeData();
632 ~ExtensionRuntimeData();
633 };
634 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap;
635
636 // Signals *ready_ and sends a notification to the listeners. 602 // Signals *ready_ and sends a notification to the listeners.
637 void SetReadyAndNotifyListeners(); 603 void SetReadyAndNotifyListeners();
638 604
639 // Return true if the sync type of |extension| matches |type|. 605 // Return true if the sync type of |extension| matches |type|.
640 void OnExtensionInstallPrefChanged(); 606 void OnExtensionInstallPrefChanged();
641 607
642 // Adds the given extension to the list of terminated extensions if 608 // Adds the given extension to the list of terminated extensions if
643 // it is not already there and unloads it. 609 // it is not already there and unloads it.
644 void TrackTerminatedExtension(const extensions::Extension* extension); 610 void TrackTerminatedExtension(const extensions::Extension* extension);
645 611
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 extensions::ExtensionRegistry* registry_; 700 extensions::ExtensionRegistry* registry_;
735 701
736 // The list of extension installs delayed for various reasons. The reason 702 // The list of extension installs delayed for various reasons. The reason
737 // for delayed install is stored in ExtensionPrefs. These are not part of 703 // for delayed install is stored in ExtensionPrefs. These are not part of
738 // ExtensionRegistry because they are not yet installed. 704 // ExtensionRegistry because they are not yet installed.
739 extensions::ExtensionSet delayed_installs_; 705 extensions::ExtensionSet delayed_installs_;
740 706
741 // Hold the set of pending extensions. 707 // Hold the set of pending extensions.
742 extensions::PendingExtensionManager pending_extension_manager_; 708 extensions::PendingExtensionManager pending_extension_manager_;
743 709
744 // The map of extension IDs to their runtime data.
745 ExtensionRuntimeDataMap extension_runtime_data_;
746
747 // The full path to the directory where extensions are installed. 710 // The full path to the directory where extensions are installed.
748 base::FilePath install_directory_; 711 base::FilePath install_directory_;
749 712
750 // Whether or not extensions are enabled. 713 // Whether or not extensions are enabled.
751 bool extensions_enabled_; 714 bool extensions_enabled_;
752 715
753 // Whether to notify users when they attempt to install an extension. 716 // Whether to notify users when they attempt to install an extension.
754 bool show_extensions_prompts_; 717 bool show_extensions_prompts_;
755 718
756 // Whether to delay installing of extension updates until the extension is 719 // Whether to delay installing of extension updates until the extension is
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 818 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
856 UnloadBlacklistedExtensionPolicy); 819 UnloadBlacklistedExtensionPolicy);
857 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 820 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
858 WillNotLoadBlacklistedExtensionsFromDirectory); 821 WillNotLoadBlacklistedExtensionsFromDirectory);
859 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 822 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
860 BlacklistedInPrefsFromStartup); 823 BlacklistedInPrefsFromStartup);
861 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 824 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
862 }; 825 };
863 826
864 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 827 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698