OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_FRAME_UTILS_H_ | 5 #ifndef CHROME_FRAME_UTILS_H_ |
6 #define CHROME_FRAME_UTILS_H_ | 6 #define CHROME_FRAME_UTILS_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <string> | 9 #include <string> |
10 #include <shdeprecated.h> | 10 #include <shdeprecated.h> |
11 #include <urlmon.h> | 11 #include <urlmon.h> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/thread.h" |
15 | 16 |
16 // utils.h : Various utility functions and classes | 17 // utils.h : Various utility functions and classes |
17 | 18 |
18 extern const wchar_t kChromeContentPrefix[]; | 19 extern const wchar_t kChromeContentPrefix[]; |
19 extern const wchar_t kChromeProtocolPrefix[]; | 20 extern const wchar_t kChromeProtocolPrefix[]; |
20 | 21 |
21 // This function is very similar to the AtlRegisterTypeLib function except | 22 // This function is very similar to the AtlRegisterTypeLib function except |
22 // that it takes a parameter that specifies whether to register the typelib | 23 // that it takes a parameter that specifies whether to register the typelib |
23 // for the current user only or on a machine-wide basis | 24 // for the current user only or on a machine-wide basis |
24 // Refer to the MSDN documentation for AtlRegisterTypeLib for a description of | 25 // Refer to the MSDN documentation for AtlRegisterTypeLib for a description of |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 COM_INTERFACE_ENTRY_FUNC(_ATL_IIDOF(x), \ | 309 COM_INTERFACE_ENTRY_FUNC(_ATL_IIDOF(x), \ |
309 offsetofclass(x, _ComMapClass), \ | 310 offsetofclass(x, _ComMapClass), \ |
310 QueryInterfaceIfDelegateSupports<_ComMapClass>) | 311 QueryInterfaceIfDelegateSupports<_ComMapClass>) |
311 | 312 |
312 // Queries the delegated COM object for an interface, bypassing the wrapper. | 313 // Queries the delegated COM object for an interface, bypassing the wrapper. |
313 #define COM_INTERFACE_BLIND_DELEGATE() \ | 314 #define COM_INTERFACE_BLIND_DELEGATE() \ |
314 COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>) | 315 COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>) |
315 | 316 |
316 extern const wchar_t kChromeFrameHeadlessMode[]; | 317 extern const wchar_t kChromeFrameHeadlessMode[]; |
317 | 318 |
| 319 // Thread that enters STA and has a UI message loop. |
| 320 class STAThread : public base::Thread { |
| 321 public: |
| 322 explicit STAThread(const char *name) : Thread(name) {} |
| 323 bool Start() { |
| 324 return StartWithOptions(Options(MessageLoop::TYPE_UI, 0)); |
| 325 } |
| 326 protected: |
| 327 // Called just prior to starting the message loop |
| 328 virtual void Init() { |
| 329 ::CoInitialize(0); |
| 330 } |
| 331 |
| 332 // Called just after the message loop ends |
| 333 virtual void CleanUp() { |
| 334 ::CoUninitialize(); |
| 335 } |
| 336 }; |
| 337 |
318 // The urls retrieved from the IMoniker interface don't contain the anchor | 338 // The urls retrieved from the IMoniker interface don't contain the anchor |
319 // portion of the actual url navigated to. This function checks whether the | 339 // portion of the actual url navigated to. This function checks whether the |
320 // url passed in the bho_url parameter contains an anchor and if yes checks | 340 // url passed in the bho_url parameter contains an anchor and if yes checks |
321 // whether it matches the url retrieved from the moniker. If yes it returns | 341 // whether it matches the url retrieved from the moniker. If yes it returns |
322 // the bho url, if not the moniker url. | 342 // the bho url, if not the moniker url. |
323 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, | 343 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, |
324 IBindCtx* bind_context, | 344 IBindCtx* bind_context, |
325 const std::wstring& bho_url); | 345 const std::wstring& bho_url); |
326 | 346 |
327 #endif // CHROME_FRAME_UTILS_H_ | 347 #endif // CHROME_FRAME_UTILS_H_ |
OLD | NEW |