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_
11 #include "base/basictypes.h"
12 #include "base/files/file_path.h"
13 #include "base/process/process.h"
14 #include "base/strings/string16.h"
20 namespace delegate_execute
{
22 // Parses a portion of the DelegateExecute handler's command line to determine
23 // the desired operation. The operation type is decided by looking at the
24 // command line. The operations are:
26 // When the delegate_execute.exe is invoked by windows when a chrome
27 // activation via the shell, possibly using ShellExecute. Control must
28 // be given to ATLs WinMain.
30 // When the delegate_execute.exe is launched by chrome, when chrome needs
31 // to re-launch itself. The required command line parameters are:
32 // --relaunch-shortcut=<PathToShortcut>
33 // --wait-for-mutex=<MutexNamePid>
34 // The PathToShortcut must be the fully qualified file name to the chrome
35 // shortcut that has the appId and other 'metro ready' parameters.
36 // The MutexNamePid is a mutex name that also encodes the process id and
37 // must follow the format <A>.<B>.<pid> where A and B are arbitray strings
38 // (usually chrome.relaunch) and pid is the process id of chrome.
39 class DelegateExecuteOperation
{
46 DelegateExecuteOperation();
47 ~DelegateExecuteOperation();
49 bool Init(const base::CommandLine
* cmd_line
);
51 OperationType
operation_type() const {
52 return operation_type_
;
55 const base::string16
& relaunch_flags() const {
56 return relaunch_flags_
;
59 const base::string16
& mutex() const {
63 // Returns the parent process.
64 base::Process
GetParent() const;
66 const base::FilePath
& shortcut() const {
67 return relaunch_shortcut_
;
71 OperationType operation_type_
;
72 base::string16 relaunch_flags_
;
73 base::FilePath relaunch_shortcut_
;
74 base::string16 mutex_
;
76 DISALLOW_COPY_AND_ASSIGN(DelegateExecuteOperation
);
79 } // namespace delegate_execute
81 #endif // WIN8_DELEGATE_EXECUTE_DELEGATE_EXECUTE_OPERATION_H_