diff options
Diffstat (limited to 'chrome_frame/utils.h')
-rw-r--r-- | chrome_frame/utils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index f42062c..e90a0d4 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -12,6 +12,7 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "base/thread.h" // utils.h : Various utility functions and classes @@ -315,6 +316,25 @@ STDMETHODIMP QueryInterfaceIfDelegateSupports(void* obj, REFIID iid, extern const wchar_t kChromeFrameHeadlessMode[]; +// Thread that enters STA and has a UI message loop. +class STAThread : public base::Thread { + public: + explicit STAThread(const char *name) : Thread(name) {} + bool Start() { + return StartWithOptions(Options(MessageLoop::TYPE_UI, 0)); + } + protected: + // Called just prior to starting the message loop + virtual void Init() { + ::CoInitialize(0); + } + + // Called just after the message loop ends + virtual void CleanUp() { + ::CoUninitialize(); + } +}; + // The urls retrieved from the IMoniker interface don't contain the anchor // portion of the actual url navigated to. This function checks whether the // url passed in the bho_url parameter contains an anchor and if yes checks |