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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ 7 #pragma once 8 9 #include "base/memory/scoped_ptr.h" 10 #include "chrome/browser/extensions/pack_extension_job.h" 11 12 class CommandLine; 13 class Profile; 14 15 // Initialization helpers for various Extension startup actions. 16 class ExtensionsStartupUtil : public PackExtensionJob::Client { 17 public: 18 ExtensionsStartupUtil(); 19 virtual ~ExtensionsStartupUtil(); 20 21 virtual void OnPackSuccess(const FilePath& crx_path, 22 const FilePath& output_private_key_path); 23 virtual void OnPackFailure(const std::string& error_message); 24 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 }; 42 43 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_STARTUP_H_ 44