| 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_URLMON_MONIKER_H_ | 5 #ifndef CHROME_FRAME_URLMON_MONIKER_H_ |
| 6 #define CHROME_FRAME_URLMON_MONIKER_H_ | 6 #define CHROME_FRAME_URLMON_MONIKER_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlcom.h> | 9 #include <atlcom.h> |
| 10 #include <urlmon.h> | 10 #include <urlmon.h> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/threading/thread_local.h" | 15 #include "base/threading/thread_local.h" |
| 16 #include "base/win/scoped_variant.h" | 16 #include "base/win/scoped_variant.h" |
| 17 #include "googleurl/src/gurl.h" | |
| 18 #include "chrome_frame/utils.h" | 17 #include "chrome_frame/utils.h" |
| 19 | 18 |
| 20 // This file contains classes that are used to cache the contents of a top-level | 19 // This file contains classes that are used to cache the contents of a top-level |
| 21 // http request (not for sub frames) while that request is parsed for the | 20 // http request (not for sub frames) while that request is parsed for the |
| 22 // presence of a meta tag indicating that the page should be rendered in CF. | 21 // presence of a meta tag indicating that the page should be rendered in CF. |
| 23 | 22 |
| 24 // Here are a few scenarios we handle and how the classes come to play. | 23 // Here are a few scenarios we handle and how the classes come to play. |
| 25 | 24 |
| 26 // | 25 // |
| 27 // Scenario 1: Non CF url navigation through address bar (www.msn.com) | 26 // Scenario 1: Non CF url navigation through address bar (www.msn.com) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 }; | 163 }; |
| 165 | 164 |
| 166 // static-only class that manages an IMoniker patch. | 165 // static-only class that manages an IMoniker patch. |
| 167 // We need this patch to stay in the loop when top-level HTML content is | 166 // We need this patch to stay in the loop when top-level HTML content is |
| 168 // downloaded that might have the CF http-equiv meta tag. | 167 // downloaded that might have the CF http-equiv meta tag. |
| 169 // When we detect candidates for those requests, we add our own callback | 168 // When we detect candidates for those requests, we add our own callback |
| 170 // object (as explained at the top of this file) and use it to cache the | 169 // object (as explained at the top of this file) and use it to cache the |
| 171 // original document contents in order to avoid multiple network trips | 170 // original document contents in order to avoid multiple network trips |
| 172 // if we need to switch the renderer over to CF. | 171 // if we need to switch the renderer over to CF. |
| 173 class MonikerPatch { | 172 class MonikerPatch { |
| 174 MonikerPatch() {} // no instances should be created of this class. | 173 MonikerPatch() {} // no instances should be created of this class. |
| 175 public: | 174 public: |
| 176 // Patches two IMoniker methods, BindToObject and BindToStorage. | 175 // Patches two IMoniker methods, BindToObject and BindToStorage. |
| 177 static bool Initialize(); | 176 static bool Initialize(); |
| 178 | 177 |
| 179 // Nullifies the IMoniker patches. | 178 // Nullifies the IMoniker patches. |
| 180 static void Uninitialize(); | 179 static void Uninitialize(); |
| 181 | 180 |
| 182 // Typedefs for IMoniker methods. | 181 // Typedefs for IMoniker methods. |
| 183 typedef HRESULT (STDMETHODCALLTYPE* IMoniker_BindToObject_Fn)(IMoniker* me, | 182 typedef HRESULT (STDMETHODCALLTYPE* IMoniker_BindToObject_Fn)(IMoniker* me, |
| 184 IBindCtx* bind_ctx, IMoniker* to_left, REFIID iid, void** obj); | 183 IBindCtx* bind_ctx, IMoniker* to_left, REFIID iid, void** obj); |
| 185 typedef HRESULT (STDMETHODCALLTYPE* IMoniker_BindToStorage_Fn)(IMoniker* me, | 184 typedef HRESULT (STDMETHODCALLTYPE* IMoniker_BindToStorage_Fn)(IMoniker* me, |
| 186 IBindCtx* bind_ctx, IMoniker* to_left, REFIID iid, void** obj); | 185 IBindCtx* bind_ctx, IMoniker* to_left, REFIID iid, void** obj); |
| 187 | 186 |
| 188 static STDMETHODIMP BindToObject(IMoniker_BindToObject_Fn original, | 187 static STDMETHODIMP BindToObject(IMoniker_BindToObject_Fn original, |
| 189 IMoniker* me, IBindCtx* bind_ctx, | 188 IMoniker* me, IBindCtx* bind_ctx, |
| 190 IMoniker* to_left, REFIID iid, void** obj); | 189 IMoniker* to_left, REFIID iid, void** obj); |
| 191 | 190 |
| 192 static STDMETHODIMP BindToStorage(IMoniker_BindToStorage_Fn original, | 191 static STDMETHODIMP BindToStorage(IMoniker_BindToStorage_Fn original, |
| 193 IMoniker* me, IBindCtx* bind_ctx, | 192 IMoniker* me, IBindCtx* bind_ctx, |
| 194 IMoniker* to_left, REFIID iid, void** obj); | 193 IMoniker* to_left, REFIID iid, void** obj); |
| 195 | |
| 196 }; | 194 }; |
| 197 | 195 |
| 198 extern wchar_t* kChromeRequestParam; | 196 extern wchar_t* kChromeRequestParam; |
| 199 | 197 |
| 200 #endif // CHROME_FRAME_URLMON_MONIKER_H_ | 198 #endif // CHROME_FRAME_URLMON_MONIKER_H_ |
| OLD | NEW |