Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: chrome/browser/extensions/startup_helper.h

Issue 196413016: Move CommandLine to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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;
12
13 namespace base {
11 class CommandLine; 14 class CommandLine;
12 class Profile; 15 }
13 16
14 namespace extensions { 17 namespace extensions {
15 18
16 // Initialization helpers for various Extension startup actions. 19 // Initialization helpers for various Extension startup actions.
17 class StartupHelper : public PackExtensionJob::Client { 20 class StartupHelper : public PackExtensionJob::Client {
18 public: 21 public:
19 StartupHelper(); 22 StartupHelper();
20 virtual ~StartupHelper(); 23 virtual ~StartupHelper();
21 24
22 virtual void OnPackSuccess( 25 virtual void OnPackSuccess(
23 const base::FilePath& crx_path, 26 const base::FilePath& crx_path,
24 const base::FilePath& output_private_key_path) OVERRIDE; 27 const base::FilePath& output_private_key_path) OVERRIDE;
25 virtual void OnPackFailure(const std::string& error_message, 28 virtual void OnPackFailure(const std::string& error_message,
26 ExtensionCreator::ErrorType type) OVERRIDE; 29 ExtensionCreator::ErrorType type) OVERRIDE;
27 30
28 // 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
29 // extension. Returns false if the pack job failed. 32 // extension. Returns false if the pack job failed.
30 bool PackExtension(const CommandLine& cmd_line); 33 bool PackExtension(const base::CommandLine& cmd_line);
31 34
32 // 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
33 // 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.
34 // 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
35 // into |error|. 38 // into |error|.
36 bool ValidateCrx(const CommandLine& cmd_line, std::string* error); 39 bool ValidateCrx(const base::CommandLine& cmd_line, std::string* error);
37 40
38 // Handle --uninstall-extension flag from the |cmd_line| by uninstalling the 41 // Handle --uninstall-extension flag from the |cmd_line| by uninstalling the
39 // specified extension from |profile|. Returns false if the uninstall job 42 // specified extension from |profile|. Returns false if the uninstall job
40 // could not be started. 43 // could not be started.
41 bool UninstallExtension(const CommandLine& cmd_line, Profile* profile); 44 bool UninstallExtension(const base::CommandLine& cmd_line, Profile* profile);
42 45
43 // Handle --install-from-webstore flag from |cmd_line| by downloading 46 // Handle --install-from-webstore flag from |cmd_line| by downloading
44 // metadata from the webstore for the given id, prompting the user to 47 // metadata from the webstore for the given id, prompting the user to
45 // confirm, and then downloading the crx and installing it. 48 // confirm, and then downloading the crx and installing it.
46 bool InstallFromWebstore(const CommandLine& cmd_line, Profile* profile); 49 bool InstallFromWebstore(const base::CommandLine& cmd_line, Profile* profile);
47 50
48 // Handle --limited-install-from-webstore flag from |cmd_line| by downloading 51 // Handle --limited-install-from-webstore flag from |cmd_line| by downloading
49 // metadata from the webstore for the given id, prompting the user to 52 // metadata from the webstore for the given id, prompting the user to
50 // confirm, and then downloading the crx and installing it. 53 // confirm, and then downloading the crx and installing it.
51 // This whole process is only kicked off by this function and completed 54 // This whole process is only kicked off by this function and completed
52 // asynchronously unlike InstallFromWebstore which finishes everything before 55 // asynchronously unlike InstallFromWebstore which finishes everything before
53 // returning. 56 // returning.
54 void LimitedInstallFromWebstore(const CommandLine& cmd_line, Profile* profile, 57 void LimitedInstallFromWebstore(const base::CommandLine& cmd_line,
58 Profile* profile,
55 base::Callback<void()> done_callback); 59 base::Callback<void()> done_callback);
56 60
57 // Maps the command line argument to the extension id. Returns an empty string 61 // Maps the command line argument to the extension id. Returns an empty string
58 // in the case when there is no mapping. 62 // in the case when there is no mapping.
59 std::string WebStoreIdFromLimitedInstallCmdLine(const CommandLine& cmd_line); 63 std::string WebStoreIdFromLimitedInstallCmdLine(
64 const base::CommandLine& cmd_line);
60 private: 65 private:
61 scoped_refptr<PackExtensionJob> pack_job_; 66 scoped_refptr<PackExtensionJob> pack_job_;
62 bool pack_job_succeeded_; 67 bool pack_job_succeeded_;
63 68
64 DISALLOW_COPY_AND_ASSIGN(StartupHelper); 69 DISALLOW_COPY_AND_ASSIGN(StartupHelper);
65 }; 70 };
66 71
67 } // namespace extensions 72 } // namespace extensions
68 73
69 #endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_ 74 #endif // CHROME_BROWSER_EXTENSIONS_STARTUP_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/test_extension_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698