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 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class CommandLine; | 14 class CommandLine; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 // Initialization helpers for various Extension startup actions. | 19 // Initialization helpers for various Extension startup actions. |
20 class StartupHelper : public PackExtensionJob::Client { | 20 class StartupHelper : public PackExtensionJob::Client { |
21 public: | 21 public: |
22 StartupHelper(); | 22 StartupHelper(); |
23 virtual ~StartupHelper(); | 23 virtual ~StartupHelper(); |
24 | 24 |
25 virtual void OnPackSuccess( | 25 virtual void OnPackSuccess( |
26 const base::FilePath& crx_path, | 26 const base::FilePath& crx_path, |
27 const base::FilePath& output_private_key_path) OVERRIDE; | 27 const base::FilePath& output_private_key_path) override; |
28 virtual void OnPackFailure(const std::string& error_message, | 28 virtual void OnPackFailure(const std::string& error_message, |
29 ExtensionCreator::ErrorType type) OVERRIDE; | 29 ExtensionCreator::ErrorType type) override; |
30 | 30 |
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 --install-ephemeral-app-from-webstore flag from |cmd_line| by | 41 // Handle --install-ephemeral-app-from-webstore flag from |cmd_line| by |
42 // downloading metadata from the webstore for the given id, prompting the | 42 // downloading metadata from the webstore for the given id, prompting the |
43 // user to confirm, and then downloading the crx and installing it. | 43 // user to confirm, and then downloading the crx and installing it. |
44 bool InstallEphemeralApp(const base::CommandLine& cmd_line, Profile* profile); | 44 bool InstallEphemeralApp(const base::CommandLine& cmd_line, Profile* profile); |
45 | 45 |
46 private: | 46 private: |
47 scoped_refptr<PackExtensionJob> pack_job_; | 47 scoped_refptr<PackExtensionJob> pack_job_; |
48 bool pack_job_succeeded_; | 48 bool pack_job_succeeded_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(StartupHelper); | 50 DISALLOW_COPY_AND_ASSIGN(StartupHelper); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace extensions | 53 } // namespace extensions |
54 | 54 |
55 #endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ | 55 #endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ |
OLD | NEW |