OLD | NEW |
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_UNPACKED_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // Must be called from the UI thread. | 64 // Must be called from the UI thread. |
65 void CheckRequirements(); | 65 void CheckRequirements(); |
66 | 66 |
67 // Callback from RequirementsChecker. | 67 // Callback from RequirementsChecker. |
68 void OnRequirementsChecked(std::vector<std::string> requirement_errors); | 68 void OnRequirementsChecked(std::vector<std::string> requirement_errors); |
69 | 69 |
70 // Verifies if loading unpacked extensions is allowed. | 70 // Verifies if loading unpacked extensions is allowed. |
71 bool IsLoadingUnpackedAllowed() const; | 71 bool IsLoadingUnpackedAllowed() const; |
72 | 72 |
73 // We change the input extension path to an absolute path, on the file thread. | 73 // We change the input extension path to an absolute path, on the FILE thread. |
74 // Then we need to check the file access preference, which needs | 74 // Then we need to check the file access preference, which needs |
75 // to happen back on the UI thread, so it posts CheckExtensionFileAccess on | 75 // to happen back on the UI thread, so it posts CheckExtensionFileAccess on |
76 // the UI thread. In turn, once that gets the pref, it goes back to the | 76 // the UI thread. In turn, once that gets the pref, it goes back to the |
77 // file thread with LoadWithFileAccess. | 77 // FILE thread with LoadWithFileAccess. |
78 // TODO(yoz): It would be nice to remove this ping-pong, but we need to know | 78 // TODO(yoz): It would be nice to remove this ping-pong, but we need to know |
79 // what file access flags to pass to extension_file_util::LoadExtension. | 79 // what file access flags to pass to extension_file_util::LoadExtension. |
80 void GetAbsolutePath(); | 80 void GetAbsolutePath(); |
81 void CheckExtensionFileAccess(); | 81 void CheckExtensionFileAccess(); |
82 void LoadWithFileAccess(int flags); | 82 void LoadWithFileAccess(int flags); |
83 | 83 |
84 // Notify the frontend that there was an error loading an extension. | 84 // Notify the frontend that there was an error loading an extension. |
85 void ReportExtensionLoadError(const std::string& error); | 85 void ReportExtensionLoadError(const std::string& error); |
86 | 86 |
87 // Called when an unpacked extension has been loaded and installed. | 87 // Called when an unpacked extension has been loaded and installed. |
88 void OnLoaded(); | 88 void OnLoaded(); |
89 | 89 |
| 90 // Runs on UI thread. If App Host is not installed, calls installer and |
| 91 // posts OnAppHostInstallationComplete() as call back. Else proceeds to |
| 92 // CompleteInstall(). |
| 93 void BeginInstall(); |
| 94 |
| 95 // Runs on UI thread. Callback function for AppHostInstaller. |
| 96 // If not |success|, shows error message. Else proceeds to CompleteInstall(). |
| 97 void OnAppHostInstallation(bool success); |
| 98 |
| 99 // Runs on UI thread. Installs the unpacked extension into the profile and |
| 100 // notifies the frontend. |
| 101 void CompleteInstall(); |
| 102 |
90 // Helper to get the Extension::CreateFlags for the installing extension. | 103 // Helper to get the Extension::CreateFlags for the installing extension. |
91 int GetFlags(); | 104 int GetFlags(); |
92 | 105 |
93 base::WeakPtr<ExtensionService> service_weak_; | 106 base::WeakPtr<ExtensionService> service_weak_; |
94 | 107 |
95 // The pathname of the directory to load from, which is an absolute path | 108 // The pathname of the directory to load from, which is an absolute path |
96 // after GetAbsolutePath has been called. | 109 // after GetAbsolutePath has been called. |
97 FilePath extension_path_; | 110 FilePath extension_path_; |
98 | 111 |
99 // If true and the extension contains plugins, we prompt the user before | 112 // If true and the extension contains plugins, we prompt the user before |
100 // loading. | 113 // loading. |
101 bool prompt_for_plugins_; | 114 bool prompt_for_plugins_; |
102 | 115 |
103 scoped_ptr<RequirementsChecker> requirements_checker_; | 116 scoped_ptr<RequirementsChecker> requirements_checker_; |
104 | 117 |
105 scoped_refptr<const Extension> extension_; | 118 scoped_refptr<const Extension> extension_; |
106 | 119 |
107 // Whether to require the extension installed to have a modern manifest | 120 // Whether to require the extension installed to have a modern manifest |
108 // version. | 121 // version. |
109 bool require_modern_manifest_version_; | 122 bool require_modern_manifest_version_; |
110 | 123 |
111 DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller); | 124 DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller); |
112 }; | 125 }; |
113 | 126 |
114 } // namespace extensions | 127 } // namespace extensions |
115 | 128 |
116 #endif // CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ | 129 #endif // CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ |
OLD | NEW |