Revert of [Presentation API] Implement ondefaultsessionstart in PSImpl. (patchset...
[chromium-blink-merge.git] / win8 / delegate_execute / delegate_execute_operation.h
blob3dbc70203a56de3d456b2e1861247f6476aca43c
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/process/process.h"
14 #include "base/strings/string16.h"
16 namespace base {
17 class CommandLine;
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:
25 // DELEGATE_EXECUTE:
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.
29 // RELAUNCH_CHROME:
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 {
40 public:
41 enum OperationType {
42 DELEGATE_EXECUTE,
43 RELAUNCH_CHROME,
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 {
60 return mutex_;
63 // Returns the parent process.
64 base::Process GetParent() const;
66 const base::FilePath& shortcut() const {
67 return relaunch_shortcut_;
70 private:
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_