OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_STARTUP_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/extensions/pack_extension_job.h" |
| 11 |
9 class CommandLine; | 12 class CommandLine; |
10 class Profile; | 13 class Profile; |
11 | 14 |
12 // Initialization helpers for various Extension startup actions. | 15 // Initialization helpers for various Extension startup actions. |
13 namespace extensions_startup { | 16 class ExtensionsStartupUtil : public PackExtensionJob::Client { |
14 // Handle --pack-extension flag from the |cmd_line| by packing the specified | 17 public: |
15 // extension. Returns false if the pack job could not be started. | 18 ExtensionsStartupUtil(); |
16 bool HandlePackExtension(const CommandLine& cmd_line); | 19 virtual ~ExtensionsStartupUtil(); |
17 | 20 |
18 // Handle --uninstall-extension flag from the |cmd_line| by uninstalling the | 21 virtual void OnPackSuccess(const FilePath& crx_path, |
19 // specified extension from |profile|. Returns false if the uninstall job | 22 const FilePath& output_private_key_path); |
20 // could not be started. | 23 virtual void OnPackFailure(const std::string& error_message); |
21 bool HandleUninstallExtension(const CommandLine& cmd_line, Profile* profile); | 24 |
22 } // namespace extensions_startup | 25 // Handle --pack-extension flag from the |cmd_line| by packing the specified |
| 26 // extension. Returns false if the pack job failed. |
| 27 bool PackExtension(const CommandLine& cmd_line); |
| 28 |
| 29 // Handle --uninstall-extension flag from the |cmd_line| by uninstalling the |
| 30 // specified extension from |profile|. Returns false if the uninstall job |
| 31 // could not be started. |
| 32 bool UninstallExtension(const CommandLine& cmd_line, Profile* profile); |
| 33 |
| 34 private: |
| 35 void ShowPackExtensionMessage(const std::wstring& caption, |
| 36 const std::wstring& message); |
| 37 scoped_refptr<PackExtensionJob> pack_job_; |
| 38 bool pack_job_succeeded_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(ExtensionsStartupUtil); |
| 41 }; |
23 | 42 |
24 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ | 43 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ |
OLD | NEW |