[Android] Added UMA for search by image context menu.
[chromium-blink-merge.git] / win8 / delegate_execute / delegate_execute_operation.h
blob7d1456cef52a383d32a076257a0c5ae4cbd50000
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 class CommandLine;
17 namespace delegate_execute {
19 // Parses a portion of the DelegateExecute handler's command line to determine
20 // the desired operation. The operation type is decided by looking at the
21 // command line. The operations are:
22 // DELEGATE_EXECUTE:
23 // When the delegate_execute.exe is invoked by windows when a chrome
24 // activation via the shell, possibly using ShellExecute. Control must
25 // be given to ATLs WinMain.
26 // RELAUNCH_CHROME:
27 // When the delegate_execute.exe is launched by chrome, when chrome needs
28 // to re-launch itself. The required command line parameters are:
29 // --relaunch-shortcut=<PathToShortcut>
30 // --wait-for-mutex=<MutexNamePid>
31 // The PathToShortcut must be the fully qualified file name to the chrome
32 // shortcut that has the appId and other 'metro ready' parameters.
33 // The MutexNamePid is a mutex name that also encodes the process id and
34 // must follow the format <A>.<B>.<pid> where A and B are arbitray strings
35 // (usually chrome.relaunch) and pid is the process id of chrome.
36 class DelegateExecuteOperation {
37 public:
38 enum OperationType {
39 DELEGATE_EXECUTE,
40 RELAUNCH_CHROME,
43 DelegateExecuteOperation();
44 ~DelegateExecuteOperation();
46 bool Init(const CommandLine* cmd_line);
48 OperationType operation_type() const {
49 return operation_type_;
52 const string16& relaunch_flags() const {
53 return relaunch_flags_;
56 const string16& mutex() const {
57 return mutex_;
60 // Returns the process id of the parent or 0 on failure.
61 DWORD GetParentPid() const;
63 const base::FilePath& shortcut() const {
64 return relaunch_shortcut_;
67 private:
68 OperationType operation_type_;
69 string16 relaunch_flags_;
70 base::FilePath relaunch_shortcut_;
71 string16 mutex_;
73 DISALLOW_COPY_AND_ASSIGN(DelegateExecuteOperation);
76 } // namespace delegate_execute
78 #endif // WIN8_DELEGATE_EXECUTE_DELEGATE_EXECUTE_OPERATION_H_