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/threading/thread.h" | 19 #include "base/threading/thread.h" |
19 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
21 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
22 | 23 |
23 class FilePath; | 24 class FilePath; |
| 25 class RegistryListPreferencesHolder; |
24 interface IBrowserService; | 26 interface IBrowserService; |
25 interface IWebBrowser2; | 27 interface IWebBrowser2; |
26 struct ContextMenuModel; | 28 struct ContextMenuModel; |
27 | 29 |
28 // utils.h : Various utility functions and classes | 30 // utils.h : Various utility functions and classes |
| 31 extern const char kGCFProtocol[]; |
29 | 32 |
| 33 extern const wchar_t kAllowUnsafeURLs[]; |
30 extern const wchar_t kChromeContentPrefix[]; | 34 extern const wchar_t kChromeContentPrefix[]; |
31 extern const char kGCFProtocol[]; | |
32 extern const wchar_t kChromeProtocolPrefix[]; | |
33 extern const wchar_t kChromeFrameHeadlessMode[]; | |
34 extern const wchar_t kChromeFrameAccessibleMode[]; | 35 extern const wchar_t kChromeFrameAccessibleMode[]; |
35 extern const wchar_t kChromeFrameUnpinnedMode[]; | |
36 extern const wchar_t kAllowUnsafeURLs[]; | |
37 extern const wchar_t kEnableBuggyBhoIntercept[]; | |
38 extern const wchar_t kChromeMimeType[]; | |
39 extern const wchar_t kChromeFrameAttachTabPattern[]; | 36 extern const wchar_t kChromeFrameAttachTabPattern[]; |
40 extern const wchar_t kChromeFrameConfigKey[]; | 37 extern const wchar_t kChromeFrameConfigKey[]; |
| 38 extern const wchar_t kChromeFrameHeadlessMode[]; |
| 39 extern const wchar_t kChromeFrameUnpinnedMode[]; |
| 40 extern const wchar_t kChromeMimeType[]; |
| 41 extern const wchar_t kChromeProtocolPrefix[]; |
| 42 extern const wchar_t kEnableBuggyBhoIntercept[]; |
| 43 extern const wchar_t kEnableGCFRendererByDefault[]; |
| 44 extern const wchar_t kExcludeUAFromDomainList[]; |
| 45 extern const wchar_t kIexploreProfileName[]; |
41 extern const wchar_t kRenderInGCFUrlList[]; | 46 extern const wchar_t kRenderInGCFUrlList[]; |
42 extern const wchar_t kRenderInHostUrlList[]; | 47 extern const wchar_t kRenderInHostUrlList[]; |
43 extern const wchar_t kEnableGCFRendererByDefault[]; | |
44 extern const wchar_t kIexploreProfileName[]; | |
45 extern const wchar_t kRundllProfileName[]; | 48 extern const wchar_t kRundllProfileName[]; |
46 extern const wchar_t kUseBackgroundThreadForSubResources[]; | 49 extern const wchar_t kUseBackgroundThreadForSubResources[]; |
47 | 50 |
48 // This function is very similar to the AtlRegisterTypeLib function except | 51 // This function is very similar to the AtlRegisterTypeLib function except |
49 // that it takes a parameter that specifies whether to register the typelib | 52 // that it takes a parameter that specifies whether to register the typelib |
50 // for the current user only or on a machine-wide basis | 53 // for the current user only or on a machine-wide basis |
51 // Refer to the MSDN documentation for AtlRegisterTypeLib for a description of | 54 // Refer to the MSDN documentation for AtlRegisterTypeLib for a description of |
52 // the arguments | 55 // the arguments |
53 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance, | 56 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance, |
54 LPCOLESTR index, | 57 LPCOLESTR index, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // Returns true if all HTML pages should be rendered in GCF by default. | 268 // Returns true if all HTML pages should be rendered in GCF by default. |
266 bool IsGcfDefaultRenderer(); | 269 bool IsGcfDefaultRenderer(); |
267 | 270 |
268 // Check if this url is opting into Chrome Frame based on static settings. | 271 // Check if this url is opting into Chrome Frame based on static settings. |
269 // Returns one of: | 272 // Returns one of: |
270 // - RENDERER_TYPE_UNDETERMINED if not opt-in or if explicit opt-out | 273 // - RENDERER_TYPE_UNDETERMINED if not opt-in or if explicit opt-out |
271 // - RENDERER_TYPE_CHROME_DEFAULT_RENDERER | 274 // - RENDERER_TYPE_CHROME_DEFAULT_RENDERER |
272 // - RENDERER_TYPE_CHROME_OPT_IN_URL | 275 // - RENDERER_TYPE_CHROME_OPT_IN_URL |
273 RendererType RendererTypeForUrl(const std::wstring& url); | 276 RendererType RendererTypeForUrl(const std::wstring& url); |
274 | 277 |
| 278 // Check if we should try to remove the CF user agent based on registry |
| 279 // settings. |
| 280 bool ShouldRemoveUAForUrl(const string16& url); |
| 281 |
| 282 // Testing methods that return the backing stores behind RendererTypeForUrl and |
| 283 // ShouldRemoveUAForUrl. Intended to allow unit testing code that calls the |
| 284 // above methods. |
| 285 // TODO(robertshield): All of the FooForUrl code should be removed from here |
| 286 // and further refactored. |
| 287 RegistryListPreferencesHolder& GetRendererTypePreferencesHolderForTesting(); |
| 288 RegistryListPreferencesHolder& GetUserAgentPreferencesHolderForTesting(); |
| 289 |
275 // A shortcut for QueryService | 290 // A shortcut for QueryService |
276 template <typename T> | 291 template <typename T> |
277 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { | 292 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { |
278 DCHECK(service); | 293 DCHECK(service); |
279 if (!unk) | 294 if (!unk) |
280 return E_INVALIDARG; | 295 return E_INVALIDARG; |
281 | 296 |
282 base::win::ScopedComPtr<IServiceProvider> service_provider; | 297 base::win::ScopedComPtr<IServiceProvider> service_provider; |
283 HRESULT hr = service_provider.QueryFrom(unk); | 298 HRESULT hr = service_provider.QueryFrom(unk); |
284 if (service_provider) | 299 if (service_provider) |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 bool IsChromeFrameDocument(IWebBrowser2* web_browser); | 615 bool IsChromeFrameDocument(IWebBrowser2* web_browser); |
601 | 616 |
602 // Increases the wininet connection limit for HTTP 1.0/1.1 connections to the | 617 // Increases the wininet connection limit for HTTP 1.0/1.1 connections to the |
603 // value passed in. This is only done if the existing connection limit is | 618 // value passed in. This is only done if the existing connection limit is |
604 // lesser than the connection limit passed in. This function attempts to | 619 // lesser than the connection limit passed in. This function attempts to |
605 // increase the connection count once per process. | 620 // increase the connection count once per process. |
606 // Returns true on success. | 621 // Returns true on success. |
607 bool IncreaseWinInetConnections(DWORD connections); | 622 bool IncreaseWinInetConnections(DWORD connections); |
608 | 623 |
609 #endif // CHROME_FRAME_UTILS_H_ | 624 #endif // CHROME_FRAME_UTILS_H_ |
OLD | NEW |