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_INSTALLER_UTIL_APP_COMMAND_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_APP_COMMAND_H_ |
6 #define CHROME_INSTALLER_UTIL_APP_COMMAND_H_ | 6 #define CHROME_INSTALLER_UTIL_APP_COMMAND_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <string> | 10 #include "base/string16.h" |
11 | 11 |
12 class WorkItemList; | 12 class WorkItemList; |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 namespace win { | 15 namespace win { |
16 class RegKey; | 16 class RegKey; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 namespace installer { | 20 namespace installer { |
21 | 21 |
22 // A description of a command registered by setup.exe that can be invoked by | 22 // A description of a command registered by setup.exe that can be invoked by |
23 // Google Update. This class is CopyConstructible and Assignable for use in | 23 // Google Update. This class is CopyConstructible and Assignable for use in |
24 // STL containers. | 24 // STL containers. |
25 class AppCommand { | 25 class AppCommand { |
26 public: | 26 public: |
27 AppCommand(); | 27 AppCommand(); |
28 AppCommand(const std::wstring& command_line, bool send_pings, | 28 // Constructs a new command that will execute the given |command_line|. |
29 bool is_web_accessible); | 29 // All other properties default to false. |
| 30 explicit AppCommand(const string16& command_line); |
30 // The implicit dtor, copy ctor and assignment operator are desired. | 31 // The implicit dtor, copy ctor and assignment operator are desired. |
31 | 32 |
32 // Initializes an instance from the command in |key|. | 33 // Initializes an instance from the command in |key|. |
33 bool Initialize(const base::win::RegKey& key); | 34 bool Initialize(const base::win::RegKey& key); |
34 | 35 |
35 // Adds to |item_list| work items to write this object to the key named | 36 // Adds to |item_list| work items to write this object to the key named |
36 // |command_path| under |predefined_root|. | 37 // |command_path| under |predefined_root|. |
37 void AddWorkItems(HKEY predefined_root, | 38 void AddWorkItems(HKEY predefined_root, |
38 const std::wstring& command_path, | 39 const string16& command_path, |
39 WorkItemList* item_list) const; | 40 WorkItemList* item_list) const; |
40 | 41 |
41 // Returns the command-line for the app command as it is represented in the | 42 // Returns the command-line for the app command as it is represented in the |
42 // registry. Use CommandLine::FromString() on this value to check arguments | 43 // registry. Use CommandLine::FromString() on this value to check arguments |
43 // or to launch the command. | 44 // or to launch the command. |
44 const std::wstring& command_line() const { return command_line_; } | 45 const string16& command_line() const { return command_line_; } |
45 void set_command_line(const std::wstring& command_line) { | 46 void set_command_line(const string16& command_line) { |
46 command_line_ = command_line; | 47 command_line_ = command_line; |
47 } | 48 } |
48 | 49 |
49 bool sends_pings() const { return sends_pings_; } | 50 bool sends_pings() const { return sends_pings_; } |
50 void set_sends_pings(bool sends_pings) { sends_pings_ = sends_pings; } | 51 void set_sends_pings(bool sends_pings) { sends_pings_ = sends_pings; } |
51 | 52 |
52 bool is_web_accessible() const { return is_web_accessible_; } | 53 bool is_web_accessible() const { return is_web_accessible_; } |
53 void set_is_web_accessible(bool is_web_accessible) { | 54 void set_is_web_accessible(bool is_web_accessible) { |
54 is_web_accessible_ = is_web_accessible; | 55 is_web_accessible_ = is_web_accessible; |
55 } | 56 } |
56 | 57 |
| 58 bool is_auto_run_on_os_upgrade() const { return is_auto_run_on_os_upgrade_; } |
| 59 void set_is_auto_run_on_os_upgrade(bool is_auto_run_on_os_upgrade) { |
| 60 is_auto_run_on_os_upgrade_ = is_auto_run_on_os_upgrade; |
| 61 } |
| 62 |
57 protected: | 63 protected: |
58 std::wstring command_line_; | 64 string16 command_line_; |
59 bool sends_pings_; | 65 bool sends_pings_; |
60 bool is_web_accessible_; | 66 bool is_web_accessible_; |
| 67 bool is_auto_run_on_os_upgrade_; |
61 }; | 68 }; |
62 | 69 |
63 } // namespace installer | 70 } // namespace installer |
64 | 71 |
65 #endif // CHROME_INSTALLER_UTIL_APP_COMMAND_H_ | 72 #endif // CHROME_INSTALLER_UTIL_APP_COMMAND_H_ |
OLD | NEW |