OLD | NEW |
| (Empty) |
1 // Copyright 2011 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #ifndef OMAHA_GOOPDATE_ONECLICK_PROCESS_LAUNCHER_H__ | |
17 #define OMAHA_GOOPDATE_ONECLICK_PROCESS_LAUNCHER_H__ | |
18 | |
19 #include <atlbase.h> | |
20 #include <atlcom.h> | |
21 #include "base/basictypes.h" | |
22 #include "goopdate/omaha3_idl.h" | |
23 #include "omaha/base/atlregmapex.h" | |
24 #include "omaha/common/const_goopdate.h" | |
25 #include "omaha/common/goopdate_utils.h" | |
26 #include "omaha/goopdate/non_localized_resource.h" | |
27 | |
28 namespace omaha { | |
29 | |
30 const TCHAR* const kOneClickProcessLauncherTlbVersion = _T("1.0"); | |
31 const TCHAR* const kOneClickProcessLauncherDescription = | |
32 _T(SHORT_COMPANY_NAME_ANSI) _T(".OneClickProcessLauncher"); | |
33 | |
34 class ATL_NO_VTABLE OneClickProcessLauncher | |
35 : public CComObjectRootEx<CComMultiThreadModel>, | |
36 public CComCoClass<OneClickProcessLauncher>, | |
37 public IOneClickProcessLauncher { | |
38 public: | |
39 OneClickProcessLauncher(); | |
40 virtual ~OneClickProcessLauncher(); | |
41 | |
42 DECLARE_NOT_AGGREGATABLE(OneClickProcessLauncher) | |
43 DECLARE_PROTECT_FINAL_CONSTRUCT() | |
44 | |
45 DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_IE_LOW_RGS) | |
46 | |
47 #pragma warning(push) | |
48 // C4640: construction of local static object is not thread-safe | |
49 #pragma warning(disable : 4640) | |
50 BEGIN_REGISTRY_MAP() | |
51 REGMAP_ENTRY(_T("HKROOT"), goopdate_utils::GetHKRoot()) | |
52 REGMAP_MODULE2(_T("MODULE"), | |
53 is_machine() ? kOmahaBrokerFileName : kOmahaOnDemandFileName) | |
54 REGMAP_ENTRY(_T("VERSION"), kOneClickProcessLauncherTlbVersion) | |
55 REGMAP_ENTRY(_T("PROGID"), | |
56 is_machine() ? | |
57 kProgIDOneClickProcessLauncherMachine : | |
58 kProgIDOneClickProcessLauncherUser) | |
59 REGMAP_ENTRY(_T("DESCRIPTION"), kOneClickProcessLauncherDescription) | |
60 REGMAP_UUID(_T("CLSID"), | |
61 is_machine() ? | |
62 __uuidof(OneClickMachineProcessLauncherClass) : | |
63 __uuidof(OneClickUserProcessLauncherClass)) | |
64 END_REGISTRY_MAP() | |
65 #pragma warning(pop) | |
66 | |
67 // C4505: unreferenced IUnknown local functions have been removed | |
68 #pragma warning(disable : 4505) | |
69 BEGIN_COM_MAP(OneClickProcessLauncher) | |
70 COM_INTERFACE_ENTRY(IOneClickProcessLauncher) | |
71 END_COM_MAP() | |
72 | |
73 STDMETHOD(LaunchAppCommand)(const WCHAR* app_guid, | |
74 const WCHAR* cmd_id); | |
75 | |
76 private: | |
77 static bool is_machine() { | |
78 return goopdate_utils::IsRunningFromOfficialGoopdateDir(true); | |
79 } | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(OneClickProcessLauncher); | |
82 }; // class OneClickProcessLauncher | |
83 | |
84 } // namespace omaha | |
85 | |
86 #endif // OMAHA_GOOPDATE_ONECLICK_PROCESS_LAUNCHER_H__ | |
OLD | NEW |