OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <windows.h> | 9 #include <windows.h> |
10 #include <wininet.h> | 10 #include <wininet.h> |
11 | 11 |
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/lock.h" | 16 #include "base/lock.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/thread.h" | 19 #include "base/thread.h" |
| 20 #include "base/win/scoped_comptr.h" |
20 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
21 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
22 | 23 |
23 class FilePath; | 24 class FilePath; |
24 interface IBrowserService; | 25 interface IBrowserService; |
25 | 26 |
26 // utils.h : Various utility functions and classes | 27 // utils.h : Various utility functions and classes |
27 | 28 |
28 extern const wchar_t kChromeContentPrefix[]; | 29 extern const wchar_t kChromeContentPrefix[]; |
29 extern const char kGCFProtocol[]; | 30 extern const char kGCFProtocol[]; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // - RENDERER_TYPE_CHROME_OPT_IN_URL | 282 // - RENDERER_TYPE_CHROME_OPT_IN_URL |
282 RendererType RendererTypeForUrl(const std::wstring& url); | 283 RendererType RendererTypeForUrl(const std::wstring& url); |
283 | 284 |
284 // A shortcut for QueryService | 285 // A shortcut for QueryService |
285 template <typename T> | 286 template <typename T> |
286 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { | 287 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { |
287 DCHECK(service); | 288 DCHECK(service); |
288 if (!unk) | 289 if (!unk) |
289 return E_INVALIDARG; | 290 return E_INVALIDARG; |
290 | 291 |
291 ScopedComPtr<IServiceProvider> service_provider; | 292 base::win::ScopedComPtr<IServiceProvider> service_provider; |
292 HRESULT hr = service_provider.QueryFrom(unk); | 293 HRESULT hr = service_provider.QueryFrom(unk); |
293 if (service_provider) | 294 if (service_provider) |
294 hr = service_provider->QueryService(service_id, service); | 295 hr = service_provider->QueryService(service_id, service); |
295 | 296 |
296 DCHECK(FAILED(hr) || *service); | 297 DCHECK(FAILED(hr) || *service); |
297 return hr; | 298 return hr; |
298 } | 299 } |
299 | 300 |
300 // Navigates an IWebBrowser2 object to a moniker. | 301 // Navigates an IWebBrowser2 object to a moniker. |
301 // |headers| can be NULL. | 302 // |headers| can be NULL. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 356 } |
356 | 357 |
357 // See COM_INTERFACE_ENTRY_IF_DELEGATE_SUPPORTS below for details. | 358 // See COM_INTERFACE_ENTRY_IF_DELEGATE_SUPPORTS below for details. |
358 template <class T> | 359 template <class T> |
359 STDMETHODIMP QueryInterfaceIfDelegateSupports(void* obj, REFIID iid, | 360 STDMETHODIMP QueryInterfaceIfDelegateSupports(void* obj, REFIID iid, |
360 void** ret, DWORD cookie) { | 361 void** ret, DWORD cookie) { |
361 HRESULT hr = E_NOINTERFACE; | 362 HRESULT hr = E_NOINTERFACE; |
362 T* instance = reinterpret_cast<T*>(obj); | 363 T* instance = reinterpret_cast<T*>(obj); |
363 IUnknown* delegate = instance ? instance->delegate() : NULL; | 364 IUnknown* delegate = instance ? instance->delegate() : NULL; |
364 if (delegate) { | 365 if (delegate) { |
365 ScopedComPtr<IUnknown> original; | 366 base::win::ScopedComPtr<IUnknown> original; |
366 hr = delegate->QueryInterface(iid, | 367 hr = delegate->QueryInterface(iid, |
367 reinterpret_cast<void**>(original.Receive())); | 368 reinterpret_cast<void**>(original.Receive())); |
368 if (original) { | 369 if (original) { |
369 IUnknown* supported_interface = reinterpret_cast<IUnknown*>( | 370 IUnknown* supported_interface = reinterpret_cast<IUnknown*>( |
370 reinterpret_cast<DWORD_PTR>(obj) + cookie); | 371 reinterpret_cast<DWORD_PTR>(obj) + cookie); |
371 supported_interface->AddRef(); | 372 supported_interface->AddRef(); |
372 *ret = supported_interface; | 373 *ret = supported_interface; |
373 hr = S_OK; | 374 hr = S_OK; |
374 } | 375 } |
375 } | 376 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 // | 609 // |
609 // The string is first interpreted using ';' as a delimiter. It is reevaluated | 610 // The string is first interpreted using ';' as a delimiter. It is reevaluated |
610 // using ',' iff no valid 'chrome=' value is found. | 611 // using ',' iff no valid 'chrome=' value is found. |
611 bool CheckXUaCompatibleDirective(const std::string& directive, | 612 bool CheckXUaCompatibleDirective(const std::string& directive, |
612 int ie_major_version); | 613 int ie_major_version); |
613 | 614 |
614 // Returns the version of the current module as a string. | 615 // Returns the version of the current module as a string. |
615 std::wstring GetCurrentModuleVersion(); | 616 std::wstring GetCurrentModuleVersion(); |
616 | 617 |
617 #endif // CHROME_FRAME_UTILS_H_ | 618 #endif // CHROME_FRAME_UTILS_H_ |
OLD | NEW |