Autofill - add correct assets for verify checkmark
[chromium-blink-merge.git] / win8 / delegate_execute / delegate_execute_operation.h
blob26bc19e587cf9e062c49ef2e7bfc62b9d9946394
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
3 // found in the LICENSE file.
5 #ifndef WIN8_DELEGATE_EXECUTE_DELEGATE_EXECUTE_OPERATION_H_
6 #define WIN8_DELEGATE_EXECUTE_DELEGATE_EXECUTE_OPERATION_H_
8 #include <windows.h>
9 #include <atldef.h>
11 #include "base/basictypes.h"
12 #include "base/files/file_path.h"
13 #include "base/strings/string16.h"
15 namespace base {
16 class CommandLine;
19 namespace delegate_execute {
21 // Parses a portion of the DelegateExecute handler's command line to determine
22 // the desired operation. The operation type is decided by looking at the
23 // command line. The operations are:
24 // DELEGATE_EXECUTE:
25 // When the delegate_execute.exe is invoked by windows when a chrome
26 // activation via the shell, possibly using ShellExecute. Control must
27 // be given to ATLs WinMain.
28 // RELAUNCH_CHROME:
29 // When the delegate_execute.exe is launched by chrome, when chrome needs
30 // to re-launch itself. The required command line parameters are:
31 // --relaunch-shortcut=<PathToShortcut>
32 // --wait-for-mutex=<MutexNamePid>
33 // The PathToShortcut must be the fully qualified file name to the chrome
34 // shortcut that has the appId and other 'metro ready' parameters.
35 // The MutexNamePid is a mutex name that also encodes the process id and
36 // must follow the format <A>.<B>.<pid> where A and B are arbitray strings
37 // (usually chrome.relaunch) and pid is the process id of chrome.
38 class DelegateExecuteOperation {
39 public:
40 enum OperationType {
41 DELEGATE_EXECUTE,
42 RELAUNCH_CHROME,
45 DelegateExecuteOperation();
46 ~DelegateExecuteOperation();
48 bool Init(const base::CommandLine* cmd_line);
50 OperationType operation_type() const {
51 return operation_type_;
54 const base::string16& relaunch_flags() const {
55 return relaunch_flags_;
58 const base::string16& mutex() const {
59 return mutex_;
62 // Returns the process id of the parent or 0 on failure.
63 DWORD GetParentPid() const;
65 const base::FilePath& shortcut() const {
66 return relaunch_shortcut_;
69 private:
70 OperationType operation_type_;
71 base::string16 relaunch_flags_;
72 base::FilePath relaunch_shortcut_;
73 base::string16 mutex_;
75 DISALLOW_COPY_AND_ASSIGN(DelegateExecuteOperation);
78 } // namespace delegate_execute
80 #endif // WIN8_DELEGATE_EXECUTE_DELEGATE_EXECUTE_OPERATION_H_