Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: chrome_frame/utils.h

Issue 11048029: Allow Thread to initialize COM for Windows consumers who need it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
20 #include "base/win/scoped_com_initializer.h"
21 #include "base/win/scoped_comptr.h" 19 #include "base/win/scoped_comptr.h"
22 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
23 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
24 22
25 class FilePath; 23 class FilePath;
26 class RegistryListPreferencesHolder; 24 class RegistryListPreferencesHolder;
27 interface IBrowserService; 25 interface IBrowserService;
28 interface IWebBrowser2; 26 interface IWebBrowser2;
29 struct ContextMenuModel; 27 struct ContextMenuModel;
30 28
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // delegate() method that returns a pointer to the delegated COM object. 387 // delegate() method that returns a pointer to the delegated COM object.
390 #define COM_INTERFACE_ENTRY_IF_DELEGATE_SUPPORTS(x) \ 388 #define COM_INTERFACE_ENTRY_IF_DELEGATE_SUPPORTS(x) \
391 COM_INTERFACE_ENTRY_FUNC(_ATL_IIDOF(x), \ 389 COM_INTERFACE_ENTRY_FUNC(_ATL_IIDOF(x), \
392 offsetofclass(x, _ComMapClass), \ 390 offsetofclass(x, _ComMapClass), \
393 QueryInterfaceIfDelegateSupports<_ComMapClass>) 391 QueryInterfaceIfDelegateSupports<_ComMapClass>)
394 392
395 // Queries the delegated COM object for an interface, bypassing the wrapper. 393 // Queries the delegated COM object for an interface, bypassing the wrapper.
396 #define COM_INTERFACE_BLIND_DELEGATE() \ 394 #define COM_INTERFACE_BLIND_DELEGATE() \
397 COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>) 395 COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>)
398 396
399 // Thread that enters STA and has a UI message loop.
400 class STAThread : public base::Thread {
401 public:
402 explicit STAThread(const char *name) : Thread(name) {}
403 virtual ~STAThread() {
404 Stop();
405 }
406
407 bool Start() {
408 return StartWithOptions(Options(MessageLoop::TYPE_UI, 0));
409 }
410
411 private:
412 virtual void Init() OVERRIDE {
413 com_initializer_.reset(new base::win::ScopedCOMInitializer());
414 }
415
416 virtual void CleanUp() OVERRIDE {
417 com_initializer_.reset();
418 }
419
420 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
421
422 DISALLOW_COPY_AND_ASSIGN(STAThread);
423 };
424
425 std::wstring GuidToString(const GUID& guid); 397 std::wstring GuidToString(const GUID& guid);
426 398
427 // The urls retrieved from the IMoniker interface don't contain the anchor 399 // The urls retrieved from the IMoniker interface don't contain the anchor
428 // portion of the actual url navigated to. This function checks whether the 400 // portion of the actual url navigated to. This function checks whether the
429 // url passed in the bho_url parameter contains an anchor and if yes checks 401 // url passed in the bho_url parameter contains an anchor and if yes checks
430 // whether it matches the url retrieved from the moniker. If yes it returns 402 // whether it matches the url retrieved from the moniker. If yes it returns
431 // the bho url, if not the moniker url. 403 // the bho url, if not the moniker url.
432 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, 404 std::wstring GetActualUrlFromMoniker(IMoniker* moniker,
433 IBindCtx* bind_context, 405 IBindCtx* bind_context,
434 const std::wstring& bho_url); 406 const std::wstring& bho_url);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 // increase the connection count once per process. 597 // increase the connection count once per process.
626 // Returns true on success. 598 // Returns true on success.
627 bool IncreaseWinInetConnections(DWORD connections); 599 bool IncreaseWinInetConnections(DWORD connections);
628 600
629 // Sets |profile_path| to the path for the Chrome Frame |profile_name| 601 // Sets |profile_path| to the path for the Chrome Frame |profile_name|
630 // profile. 602 // profile.
631 void GetChromeFrameProfilePath(const string16& profile_name, 603 void GetChromeFrameProfilePath(const string16& profile_name,
632 FilePath* profile_path); 604 FilePath* profile_path);
633 605
634 #endif // CHROME_FRAME_UTILS_H_ 606 #endif // CHROME_FRAME_UTILS_H_
OLDNEW
« no previous file with comments | « chrome_frame/urlmon_url_request.cc ('k') | content/browser/renderer_host/media/media_stream_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698