blob: f1f8e37c7987c94d346be86f9f084d875b161fe7 [file] [log] [blame]
[email protected]d1f48ef52012-05-13 19:34:211// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]6aeac8342010-10-01 20:21:182// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]d9ede582012-08-14 19:21:385#ifndef CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_
6#define CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_
[email protected]6aeac8342010-10-01 20:21:187
avia2f4804a2015-12-24 23:11:138#include "base/macros.h"
[email protected]78566202012-05-14 20:46:519#include "base/memory/ref_counted.h"
[email protected]ccd875e72010-12-13 23:49:0210#include "chrome/browser/extensions/pack_extension_job.h"
11
[email protected]2f3b1cc2014-03-17 23:07:1512namespace base {
13class CommandLine;
14}
15
[email protected]d9ede582012-08-14 19:21:3816namespace extensions {
17
[email protected]6aeac8342010-10-01 20:21:1818// Initialization helpers for various Extension startup actions.
[email protected]d9ede582012-08-14 19:21:3819class StartupHelper : public PackExtensionJob::Client {
[email protected]ccd875e72010-12-13 23:49:0220 public:
[email protected]d9ede582012-08-14 19:21:3821 StartupHelper();
dchengae36a4a2014-10-21 12:36:3622 ~StartupHelper() override;
[email protected]6aeac8342010-10-01 20:21:1823
dchengae36a4a2014-10-21 12:36:3624 void OnPackSuccess(const base::FilePath& crx_path,
25 const base::FilePath& output_private_key_path) override;
26 void OnPackFailure(const std::string& error_message,
27 ExtensionCreator::ErrorType type) override;
[email protected]ccd875e72010-12-13 23:49:0228
29 // Handle --pack-extension flag from the |cmd_line| by packing the specified
30 // extension. Returns false if the pack job failed.
[email protected]2f3b1cc2014-03-17 23:07:1531 bool PackExtension(const base::CommandLine& cmd_line);
[email protected]ccd875e72010-12-13 23:49:0232
[email protected]d37f4de2013-03-28 19:26:3633 // Validates a crx at the path given by the --validate-extension flag - can
34 // it be installed? Returns true if the crx is valid, or false otherwise.
35 // If the return value is false, a description of the problem may be written
36 // into |error|.
[email protected]2f3b1cc2014-03-17 23:07:1537 bool ValidateCrx(const base::CommandLine& cmd_line, std::string* error);
[email protected]d37f4de2013-03-28 19:26:3638
[email protected]ccd875e72010-12-13 23:49:0239 private:
[email protected]ccd875e72010-12-13 23:49:0240 bool pack_job_succeeded_;
41
[email protected]d9ede582012-08-14 19:21:3842 DISALLOW_COPY_AND_ASSIGN(StartupHelper);
[email protected]ccd875e72010-12-13 23:49:0243};
[email protected]6aeac8342010-10-01 20:21:1844
[email protected]d9ede582012-08-14 19:21:3845} // namespace extensions
46
47#endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_