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