OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <OAidl.h> | 8 #include <OAidl.h> |
9 #include <objidl.h> | 9 #include <objidl.h> |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <wininet.h> | 11 #include <wininet.h> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/string16.h" | 18 #include "base/string16.h" |
19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
20 #include "base/win/scoped_com_initializer.h" | |
20 #include "base/win/scoped_comptr.h" | 21 #include "base/win/scoped_comptr.h" |
21 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
23 | 24 |
24 class FilePath; | 25 class FilePath; |
25 class RegistryListPreferencesHolder; | 26 class RegistryListPreferencesHolder; |
26 interface IBrowserService; | 27 interface IBrowserService; |
27 interface IWebBrowser2; | 28 interface IWebBrowser2; |
28 struct ContextMenuModel; | 29 struct ContextMenuModel; |
29 | 30 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 QueryInterfaceIfDelegateSupports<_ComMapClass>) | 393 QueryInterfaceIfDelegateSupports<_ComMapClass>) |
393 | 394 |
394 // Queries the delegated COM object for an interface, bypassing the wrapper. | 395 // Queries the delegated COM object for an interface, bypassing the wrapper. |
395 #define COM_INTERFACE_BLIND_DELEGATE() \ | 396 #define COM_INTERFACE_BLIND_DELEGATE() \ |
396 COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>) | 397 COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>) |
397 | 398 |
398 // Thread that enters STA and has a UI message loop. | 399 // Thread that enters STA and has a UI message loop. |
399 class STAThread : public base::Thread { | 400 class STAThread : public base::Thread { |
400 public: | 401 public: |
401 explicit STAThread(const char *name) : Thread(name) {} | 402 explicit STAThread(const char *name) : Thread(name) {} |
402 ~STAThread() { | 403 virtual ~STAThread() { |
403 Stop(); | 404 Stop(); |
404 } | 405 } |
406 | |
405 bool Start() { | 407 bool Start() { |
406 return StartWithOptions(Options(MessageLoop::TYPE_UI, 0)); | 408 return StartWithOptions(Options(MessageLoop::TYPE_UI, 0)); |
407 } | 409 } |
410 | |
408 protected: | 411 protected: |
409 // Called just prior to starting the message loop | |
410 virtual void Init() { | 412 virtual void Init() { |
grt (UTC plus 2)
2012/10/03 13:37:28
OVERRIDE
| |
411 ::CoInitialize(0); | 413 com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
412 } | 414 } |
413 | 415 |
414 // Called just after the message loop ends | |
415 virtual void CleanUp() { | 416 virtual void CleanUp() { |
grt (UTC plus 2)
2012/10/03 13:37:28
OVERRIDE
| |
416 ::CoUninitialize(); | 417 com_initializer_.reset(); |
417 } | 418 } |
419 | |
420 private: | |
421 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | |
422 | |
423 DISALLOW_COPY_AND_ASSIGN(STAThread); | |
418 }; | 424 }; |
419 | 425 |
420 std::wstring GuidToString(const GUID& guid); | 426 std::wstring GuidToString(const GUID& guid); |
421 | 427 |
422 // The urls retrieved from the IMoniker interface don't contain the anchor | 428 // The urls retrieved from the IMoniker interface don't contain the anchor |
423 // portion of the actual url navigated to. This function checks whether the | 429 // portion of the actual url navigated to. This function checks whether the |
424 // url passed in the bho_url parameter contains an anchor and if yes checks | 430 // url passed in the bho_url parameter contains an anchor and if yes checks |
425 // whether it matches the url retrieved from the moniker. If yes it returns | 431 // whether it matches the url retrieved from the moniker. If yes it returns |
426 // the bho url, if not the moniker url. | 432 // the bho url, if not the moniker url. |
427 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, | 433 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 // increase the connection count once per process. | 626 // increase the connection count once per process. |
621 // Returns true on success. | 627 // Returns true on success. |
622 bool IncreaseWinInetConnections(DWORD connections); | 628 bool IncreaseWinInetConnections(DWORD connections); |
623 | 629 |
624 // Sets |profile_path| to the path for the Chrome Frame |profile_name| | 630 // Sets |profile_path| to the path for the Chrome Frame |profile_name| |
625 // profile. | 631 // profile. |
626 void GetChromeFrameProfilePath(const string16& profile_name, | 632 void GetChromeFrameProfilePath(const string16& profile_name, |
627 FilePath* profile_path); | 633 FilePath* profile_path); |
628 | 634 |
629 #endif // CHROME_FRAME_UTILS_H_ | 635 #endif // CHROME_FRAME_UTILS_H_ |
OLD | NEW |