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

Side by Side Diff: chrome_frame/utils.h

Issue 9720001: Add a setting to CF to remove 'chromeframe' from the UserAgent on a per-pattern basis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor tweak to UA building. Created 8 years, 9 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/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;
24 interface IBrowserService; 25 interface IBrowserService;
25 interface IWebBrowser2; 26 interface IWebBrowser2;
26 struct ContextMenuModel; 27 struct ContextMenuModel;
27 28
28 // utils.h : Various utility functions and classes 29 // utils.h : Various utility functions and classes
30 extern const char kGCFProtocol[];
29 31
32 extern const wchar_t kAllowUnsafeURLs[];
30 extern const wchar_t kChromeContentPrefix[]; 33 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[]; 34 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[]; 35 extern const wchar_t kChromeFrameAttachTabPattern[];
40 extern const wchar_t kChromeFrameConfigKey[]; 36 extern const wchar_t kChromeFrameConfigKey[];
37 extern const wchar_t kChromeFrameHeadlessMode[];
38 extern const wchar_t kChromeFrameUnpinnedMode[];
39 extern const wchar_t kChromeMimeType[];
40 extern const wchar_t kChromeProtocolPrefix[];
41 extern const wchar_t kEnableBuggyBhoIntercept[];
42 extern const wchar_t kEnableGCFRendererByDefault[];
43 extern const wchar_t kExcludeUAFromDomainList[];
44 extern const wchar_t kIexploreProfileName[];
41 extern const wchar_t kRenderInGCFUrlList[]; 45 extern const wchar_t kRenderInGCFUrlList[];
42 extern const wchar_t kRenderInHostUrlList[]; 46 extern const wchar_t kRenderInHostUrlList[];
43 extern const wchar_t kEnableGCFRendererByDefault[];
44 extern const wchar_t kIexploreProfileName[];
45 extern const wchar_t kRundllProfileName[]; 47 extern const wchar_t kRundllProfileName[];
46 extern const wchar_t kUseBackgroundThreadForSubResources[]; 48 extern const wchar_t kUseBackgroundThreadForSubResources[];
47 49
48 // This function is very similar to the AtlRegisterTypeLib function except 50 // This function is very similar to the AtlRegisterTypeLib function except
49 // that it takes a parameter that specifies whether to register the typelib 51 // that it takes a parameter that specifies whether to register the typelib
50 // for the current user only or on a machine-wide basis 52 // for the current user only or on a machine-wide basis
51 // Refer to the MSDN documentation for AtlRegisterTypeLib for a description of 53 // Refer to the MSDN documentation for AtlRegisterTypeLib for a description of
52 // the arguments 54 // the arguments
53 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance, 55 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance,
54 LPCOLESTR index, 56 LPCOLESTR index,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 RENDERER_TYPE_CHROME_HTTP_EQUIV, 179 RENDERER_TYPE_CHROME_HTTP_EQUIV,
178 RENDERER_TYPE_CHROME_RESPONSE_HEADER, 180 RENDERER_TYPE_CHROME_RESPONSE_HEADER,
179 RENDERER_TYPE_CHROME_DEFAULT_RENDERER, 181 RENDERER_TYPE_CHROME_DEFAULT_RENDERER,
180 RENDERER_TYPE_CHROME_OPT_IN_URL, 182 RENDERER_TYPE_CHROME_OPT_IN_URL,
181 RENDERER_TYPE_CHROME_WIDGET, 183 RENDERER_TYPE_CHROME_WIDGET,
182 // NOTE: all _CHOME_ values must go above here (adjust MIN/MAX as needed). 184 // NOTE: all _CHOME_ values must go above here (adjust MIN/MAX as needed).
183 RENDERER_TYPE_CHROME_MAX = RENDERER_TYPE_CHROME_WIDGET, 185 RENDERER_TYPE_CHROME_MAX = RENDERER_TYPE_CHROME_WIDGET,
184 RENDERER_TYPE_OTHER, 186 RENDERER_TYPE_OTHER,
185 }; 187 };
186 188
189 enum UserAgentAction {
190 USER_AGENT_DEFAULT,
191 USER_AGENT_REMOVE
192 };
193
187 // Returns true if the given RendererType represents Chrome. 194 // Returns true if the given RendererType represents Chrome.
188 bool IsChrome(RendererType renderer_type); 195 bool IsChrome(RendererType renderer_type);
189 196
190 // Convenience macro for logging a sample for the launch type metric. 197 // Convenience macro for logging a sample for the launch type metric.
191 #define UMA_LAUNCH_TYPE_COUNT(sample) \ 198 #define UMA_LAUNCH_TYPE_COUNT(sample) \
192 UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchType", sample, \ 199 UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchType", sample, \
193 RENDERER_TYPE_CHROME_MIN, RENDERER_TYPE_CHROME_MAX, \ 200 RENDERER_TYPE_CHROME_MIN, RENDERER_TYPE_CHROME_MAX, \
194 RENDERER_TYPE_CHROME_MAX + 1 - RENDERER_TYPE_CHROME_MIN) 201 RENDERER_TYPE_CHROME_MAX + 1 - RENDERER_TYPE_CHROME_MIN)
195 202
196 // To get the IE version when Chrome Frame is hosted in IE. Make sure that 203 // To get the IE version when Chrome Frame is hosted in IE. Make sure that
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // Returns true if all HTML pages should be rendered in GCF by default. 272 // Returns true if all HTML pages should be rendered in GCF by default.
266 bool IsGcfDefaultRenderer(); 273 bool IsGcfDefaultRenderer();
267 274
268 // Check if this url is opting into Chrome Frame based on static settings. 275 // Check if this url is opting into Chrome Frame based on static settings.
269 // Returns one of: 276 // Returns one of:
270 // - RENDERER_TYPE_UNDETERMINED if not opt-in or if explicit opt-out 277 // - RENDERER_TYPE_UNDETERMINED if not opt-in or if explicit opt-out
271 // - RENDERER_TYPE_CHROME_DEFAULT_RENDERER 278 // - RENDERER_TYPE_CHROME_DEFAULT_RENDERER
272 // - RENDERER_TYPE_CHROME_OPT_IN_URL 279 // - RENDERER_TYPE_CHROME_OPT_IN_URL
273 RendererType RendererTypeForUrl(const std::wstring& url); 280 RendererType RendererTypeForUrl(const std::wstring& url);
274 281
282 // Check if we should try to remove the CF user agent based on registry
283 // settings.
284 UserAgentAction ShouldRemoveUAForUrl(const string16& url);
grt (UTC plus 2) 2012/03/20 17:27:45 since there are only two options and the function
robertshield 2012/03/26 02:43:33 Done.
285
275 // A shortcut for QueryService 286 // A shortcut for QueryService
276 template <typename T> 287 template <typename T>
277 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { 288 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) {
278 DCHECK(service); 289 DCHECK(service);
279 if (!unk) 290 if (!unk)
280 return E_INVALIDARG; 291 return E_INVALIDARG;
281 292
282 base::win::ScopedComPtr<IServiceProvider> service_provider; 293 base::win::ScopedComPtr<IServiceProvider> service_provider;
283 HRESULT hr = service_provider.QueryFrom(unk); 294 HRESULT hr = service_provider.QueryFrom(unk);
284 if (service_provider) 295 if (service_provider)
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 bool IsChromeFrameDocument(IWebBrowser2* web_browser); 611 bool IsChromeFrameDocument(IWebBrowser2* web_browser);
601 612
602 // Increases the wininet connection limit for HTTP 1.0/1.1 connections to the 613 // 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 614 // 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 615 // lesser than the connection limit passed in. This function attempts to
605 // increase the connection count once per process. 616 // increase the connection count once per process.
606 // Returns true on success. 617 // Returns true on success.
607 bool IncreaseWinInetConnections(DWORD connections); 618 bool IncreaseWinInetConnections(DWORD connections);
608 619
609 #endif // CHROME_FRAME_UTILS_H_ 620 #endif // CHROME_FRAME_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698