OLD | NEW |
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Determine if the downloaded extension came from the theme mini-gallery, | 150 // Determine if the downloaded extension came from the theme mini-gallery, |
151 // Used to test if we need to show the "Loading" dialog for themes. | 151 // Used to test if we need to show the "Loading" dialog for themes. |
152 static bool IsDownloadFromMiniGallery(const GURL& download_url); | 152 static bool IsDownloadFromMiniGallery(const GURL& download_url); |
153 | 153 |
154 // Returns the Extension of hosted or packaged apps, NULL otherwise. | 154 // Returns the Extension of hosted or packaged apps, NULL otherwise. |
155 const Extension* GetInstalledApp(const GURL& url); | 155 const Extension* GetInstalledApp(const GURL& url); |
156 | 156 |
157 // Returns whether the URL is from either a hosted or packaged app. | 157 // Returns whether the URL is from either a hosted or packaged app. |
158 bool IsInstalledApp(const GURL& url); | 158 bool IsInstalledApp(const GURL& url); |
159 | 159 |
| 160 // Associates a renderer process with the given installed app. |
| 161 void SetInstalledAppForRenderer(int renderer_child_id, const Extension* app); |
| 162 |
| 163 // If the renderer is hosting an installed app, returns it, otherwise returns |
| 164 // NULL. |
| 165 const Extension* GetInstalledAppForRenderer(int renderer_child_id); |
| 166 |
160 // Attempts to uninstall an extension from a given ExtensionService. Returns | 167 // Attempts to uninstall an extension from a given ExtensionService. Returns |
161 // true iff the target extension exists. | 168 // true iff the target extension exists. |
162 static bool UninstallExtensionHelper(ExtensionService* extensions_service, | 169 static bool UninstallExtensionHelper(ExtensionService* extensions_service, |
163 const std::string& extension_id); | 170 const std::string& extension_id); |
164 | 171 |
165 // Constructor stores pointers to |profile| and |extension_prefs| but | 172 // Constructor stores pointers to |profile| and |extension_prefs| but |
166 // ownership remains at caller. | 173 // ownership remains at caller. |
167 ExtensionService(Profile* profile, | 174 ExtensionService(Profile* profile, |
168 const CommandLine* command_line, | 175 const CommandLine* command_line, |
169 const FilePath& install_directory, | 176 const FilePath& install_directory, |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 562 |
556 // Used to quickly check if an extension was terminated. | 563 // Used to quickly check if an extension was terminated. |
557 std::set<std::string> terminated_extension_ids_; | 564 std::set<std::string> terminated_extension_ids_; |
558 | 565 |
559 // Hold the set of pending extensions. | 566 // Hold the set of pending extensions. |
560 PendingExtensionManager pending_extension_manager_; | 567 PendingExtensionManager pending_extension_manager_; |
561 | 568 |
562 // The map of extension IDs to their runtime data. | 569 // The map of extension IDs to their runtime data. |
563 ExtensionRuntimeDataMap extension_runtime_data_; | 570 ExtensionRuntimeDataMap extension_runtime_data_; |
564 | 571 |
| 572 // Holds a map between renderer process IDs that are associated with an |
| 573 // installed app and their app. |
| 574 typedef std::map<int, scoped_refptr<const Extension> > InstalledAppMap; |
| 575 InstalledAppMap installed_app_hosts_; |
| 576 |
565 // The full path to the directory where extensions are installed. | 577 // The full path to the directory where extensions are installed. |
566 FilePath install_directory_; | 578 FilePath install_directory_; |
567 | 579 |
568 // Whether or not extensions are enabled. | 580 // Whether or not extensions are enabled. |
569 bool extensions_enabled_; | 581 bool extensions_enabled_; |
570 | 582 |
571 // Whether to notify users when they attempt to install an extension. | 583 // Whether to notify users when they attempt to install an extension. |
572 bool show_extensions_prompts_; | 584 bool show_extensions_prompts_; |
573 | 585 |
574 // The backend that will do IO on behalf of this instance. | 586 // The backend that will do IO on behalf of this instance. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 NaClModuleInfoList nacl_module_list_; | 653 NaClModuleInfoList nacl_module_list_; |
642 | 654 |
643 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 655 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
644 InstallAppsWithUnlimtedStorage); | 656 InstallAppsWithUnlimtedStorage); |
645 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 657 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
646 InstallAppsAndCheckStorageProtection); | 658 InstallAppsAndCheckStorageProtection); |
647 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 659 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
648 }; | 660 }; |
649 | 661 |
650 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 662 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |