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_STARTUP_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "chrome/browser/extensions/pack_extension_job.h" | 9 #include "chrome/browser/extensions/pack_extension_job.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Handle --pack-extension flag from the |cmd_line| by packing the specified | 31 // Handle --pack-extension flag from the |cmd_line| by packing the specified |
32 // extension. Returns false if the pack job failed. | 32 // extension. Returns false if the pack job failed. |
33 bool PackExtension(const base::CommandLine& cmd_line); | 33 bool PackExtension(const base::CommandLine& cmd_line); |
34 | 34 |
35 // Validates a crx at the path given by the --validate-extension flag - can | 35 // Validates a crx at the path given by the --validate-extension flag - can |
36 // it be installed? Returns true if the crx is valid, or false otherwise. | 36 // it be installed? Returns true if the crx is valid, or false otherwise. |
37 // If the return value is false, a description of the problem may be written | 37 // If the return value is false, a description of the problem may be written |
38 // into |error|. | 38 // into |error|. |
39 bool ValidateCrx(const base::CommandLine& cmd_line, std::string* error); | 39 bool ValidateCrx(const base::CommandLine& cmd_line, std::string* error); |
40 | 40 |
41 // Handle --uninstall-extension flag from the |cmd_line| by uninstalling the | |
42 // specified extension from |profile|. Returns false if the uninstall job | |
43 // could not be started. | |
44 bool UninstallExtension(const base::CommandLine& cmd_line, Profile* profile); | |
45 | |
46 // Handle --install-from-webstore flag from |cmd_line| by downloading | 41 // Handle --install-from-webstore flag from |cmd_line| by downloading |
47 // metadata from the webstore for the given id, prompting the user to | 42 // metadata from the webstore for the given id, prompting the user to |
48 // confirm, and then downloading the crx and installing it. | 43 // confirm, and then downloading the crx and installing it. |
49 bool InstallFromWebstore(const base::CommandLine& cmd_line, Profile* profile); | 44 bool InstallFromWebstore(const base::CommandLine& cmd_line, Profile* profile); |
50 | 45 |
51 // Handle --limited-install-from-webstore flag from |cmd_line| by downloading | 46 // Handle --limited-install-from-webstore flag from |cmd_line| by downloading |
52 // metadata from the webstore for the given id, prompting the user to | 47 // metadata from the webstore for the given id, prompting the user to |
53 // confirm, and then downloading the crx and installing it. | 48 // confirm, and then downloading the crx and installing it. |
54 // This whole process is only kicked off by this function and completed | 49 // This whole process is only kicked off by this function and completed |
55 // asynchronously unlike InstallFromWebstore which finishes everything before | 50 // asynchronously unlike InstallFromWebstore which finishes everything before |
56 // returning. | 51 // returning. |
57 void LimitedInstallFromWebstore(const base::CommandLine& cmd_line, | 52 void LimitedInstallFromWebstore(const base::CommandLine& cmd_line, |
58 Profile* profile, | 53 Profile* profile, |
59 base::Callback<void()> done_callback); | 54 base::Callback<void()> done_callback); |
60 | 55 |
61 // Maps the command line argument to the extension id. Returns an empty string | 56 // Maps the command line argument to the extension id. Returns an empty string |
62 // in the case when there is no mapping. | 57 // in the case when there is no mapping. |
63 std::string WebStoreIdFromLimitedInstallCmdLine( | 58 std::string WebStoreIdFromLimitedInstallCmdLine( |
64 const base::CommandLine& cmd_line); | 59 const base::CommandLine& cmd_line); |
65 private: | 60 private: |
66 scoped_refptr<PackExtensionJob> pack_job_; | 61 scoped_refptr<PackExtensionJob> pack_job_; |
67 bool pack_job_succeeded_; | 62 bool pack_job_succeeded_; |
68 | 63 |
69 DISALLOW_COPY_AND_ASSIGN(StartupHelper); | 64 DISALLOW_COPY_AND_ASSIGN(StartupHelper); |
70 }; | 65 }; |
71 | 66 |
72 } // namespace extensions | 67 } // namespace extensions |
73 | 68 |
74 #endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ | 69 #endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ |
OLD | NEW |