| 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 <shdeprecated.h> | 8 #include <shdeprecated.h> |
| 9 #include <urlmon.h> | 9 #include <urlmon.h> |
| 10 #include <wininet.h> | 10 #include <wininet.h> |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 BrowserType GetBrowserType(); | 174 BrowserType GetBrowserType(); |
| 175 | 175 |
| 176 typedef enum IEVersion { | 176 typedef enum IEVersion { |
| 177 IE_INVALID, | 177 IE_INVALID, |
| 178 NON_IE, | 178 NON_IE, |
| 179 IE_UNSUPPORTED, | 179 IE_UNSUPPORTED, |
| 180 IE_6, | 180 IE_6, |
| 181 IE_7, | 181 IE_7, |
| 182 IE_8, | 182 IE_8, |
| 183 IE_9, |
| 183 }; | 184 }; |
| 184 | 185 |
| 186 // The renderer to be used for a page. Values for Chrome also convey the |
| 187 // reason why Chrome is used. |
| 188 enum RendererType { |
| 189 RENDERER_TYPE_UNDETERMINED = 0, |
| 190 RENDERER_TYPE_CHROME_MIN, |
| 191 // NOTE: group all _CHROME_ values together below here, as they are used for |
| 192 // generating metrics reported via UMA (adjust MIN/MAX as needed). |
| 193 RENDERER_TYPE_CHROME_GCF_PROTOCOL = RENDERER_TYPE_CHROME_MIN, |
| 194 RENDERER_TYPE_CHROME_HTTP_EQUIV, |
| 195 RENDERER_TYPE_CHROME_RESPONSE_HEADER, |
| 196 RENDERER_TYPE_CHROME_DEFAULT_RENDERER, |
| 197 RENDERER_TYPE_CHROME_OPT_IN_URL, |
| 198 RENDERER_TYPE_CHROME_WIDGET, |
| 199 // NOTE: all _CHOME_ values must go above here (adjust MIN/MAX as needed). |
| 200 RENDERER_TYPE_CHROME_MAX = RENDERER_TYPE_CHROME_WIDGET, |
| 201 RENDERER_TYPE_OTHER, |
| 202 }; |
| 203 |
| 204 // Returns true if the given RendererType represents Chrome. |
| 205 bool IsChrome(RendererType renderer_type); |
| 206 |
| 207 // Convenience macro for logging a sample for the launch type metric. |
| 208 #define THREAD_SAFE_UMA_LAUNCH_TYPE_COUNT(sample) \ |
| 209 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchType", sample, \ |
| 210 RENDERER_TYPE_CHROME_MIN, RENDERER_TYPE_CHROME_MAX, \ |
| 211 RENDERER_TYPE_CHROME_MAX + 1 - RENDERER_TYPE_CHROME_MIN) |
| 212 |
| 185 // To get the IE version when Chrome Frame is hosted in IE. Make sure that | 213 // To get the IE version when Chrome Frame is hosted in IE. Make sure that |
| 186 // the hosting browser is IE before calling this function, otherwise NON_IE | 214 // the hosting browser is IE before calling this function, otherwise NON_IE |
| 187 // will be returned. | 215 // will be returned. |
| 188 IEVersion GetIEVersion(); | 216 IEVersion GetIEVersion(); |
| 189 | 217 |
| 190 FilePath GetIETemporaryFilesFolder(); | 218 FilePath GetIETemporaryFilesFolder(); |
| 191 | 219 |
| 192 // Retrieves the file version from a module handle without extra round trips | 220 // Retrieves the file version from a module handle without extra round trips |
| 193 // to the disk (as happens with the regular GetFileVersionInfo API). | 221 // to the disk (as happens with the regular GetFileVersionInfo API). |
| 194 // | 222 // |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 bool IsAccessibleMode(); | 273 bool IsAccessibleMode(); |
| 246 | 274 |
| 247 // Returns true if we are running in unpinned mode in which case DLL | 275 // Returns true if we are running in unpinned mode in which case DLL |
| 248 // eviction should be possible. | 276 // eviction should be possible. |
| 249 bool IsUnpinnedMode(); | 277 bool IsUnpinnedMode(); |
| 250 | 278 |
| 251 // Returns true if all HTML pages should be rendered in GCF by default. | 279 // Returns true if all HTML pages should be rendered in GCF by default. |
| 252 bool IsGcfDefaultRenderer(); | 280 bool IsGcfDefaultRenderer(); |
| 253 | 281 |
| 254 // Check if this url is opting into Chrome Frame based on static settings. | 282 // Check if this url is opting into Chrome Frame based on static settings. |
| 255 bool IsOptInUrl(const wchar_t* url); | 283 // Returns one of: |
| 284 // - RENDERER_TYPE_UNDETERMINED if not opt-in or if explicit opt-out |
| 285 // - RENDERER_TYPE_CHROME_DEFAULT_RENDERER |
| 286 // - RENDERER_TYPE_CHROME_OPT_IN_URL |
| 287 RendererType RendererTypeForUrl(const std::wstring& url); |
| 256 | 288 |
| 257 // A shortcut for QueryService | 289 // A shortcut for QueryService |
| 258 template <typename T> | 290 template <typename T> |
| 259 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { | 291 HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) { |
| 260 DCHECK(service); | 292 DCHECK(service); |
| 261 if (!unk) | 293 if (!unk) |
| 262 return E_INVALIDARG; | 294 return E_INVALIDARG; |
| 263 | 295 |
| 264 ScopedComPtr<IServiceProvider> service_provider; | 296 ScopedComPtr<IServiceProvider> service_provider; |
| 265 HRESULT hr = service_provider.QueryFrom(unk); | 297 HRESULT hr = service_provider.QueryFrom(unk); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 585 |
| 554 // Utility function that prevents the current module from ever being unloaded. | 586 // Utility function that prevents the current module from ever being unloaded. |
| 555 // Call if you make irreversible patches. | 587 // Call if you make irreversible patches. |
| 556 void PinModule(); | 588 void PinModule(); |
| 557 | 589 |
| 558 // Helper function to spin a message loop and dispatch messages while waiting | 590 // Helper function to spin a message loop and dispatch messages while waiting |
| 559 // for a handle to be signaled. | 591 // for a handle to be signaled. |
| 560 void WaitWithMessageLoop(HANDLE* handles, int count, DWORD timeout); | 592 void WaitWithMessageLoop(HANDLE* handles, int count, DWORD timeout); |
| 561 | 593 |
| 562 #endif // CHROME_FRAME_UTILS_H_ | 594 #endif // CHROME_FRAME_UTILS_H_ |
| OLD | NEW |