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

Side by Side Diff: chrome_frame/urlmon_moniker.h

Issue 6493002: A number of poorly written IE BHO's crash IE if ChromeFrame is the currently ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 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 <ExDisp.h>
10 #include <urlmon.h> 11 #include <urlmon.h>
11 #include <string> 12 #include <string>
12 13
13 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/threading/thread_local.h" 16 #include "base/threading/thread_local.h"
17 #include "base/win/scoped_comptr.h"
16 #include "base/win/scoped_variant.h" 18 #include "base/win/scoped_variant.h"
17 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
18 #include "chrome_frame/utils.h" 20 #include "chrome_frame/utils.h"
19 21
20 // This file contains classes that are used to cache the contents of a top-level 22 // 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 23 // 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. 24 // presence of a meta tag indicating that the page should be rendered in CF.
23 25
24 // Here are a few scenarios we handle and how the classes come to play. 26 // Here are a few scenarios we handle and how the classes come to play.
25 27
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // this interface for easier testability. 83 // this interface for easier testability.
82 class NavigationManager { 84 class NavigationManager {
83 public: 85 public:
84 NavigationManager() { 86 NavigationManager() {
85 } 87 }
86 88
87 // Returns the Bho instance for the current thread. This is returned from 89 // Returns the Bho instance for the current thread. This is returned from
88 // TLS. Returns NULL if no instance exists on the current thread. 90 // TLS. Returns NULL if no instance exists on the current thread.
89 static NavigationManager* GetThreadInstance(); 91 static NavigationManager* GetThreadInstance();
90 92
91 void RegisterThreadInstance(); 93 void RegisterThreadInstance(IWebBrowser2* web_browser2);
92 void UnregisterThreadInstance(); 94 void UnregisterThreadInstance();
93 95
94 virtual ~NavigationManager() { 96 virtual ~NavigationManager() {
95 DCHECK(GetThreadInstance() != this); 97 DCHECK(GetThreadInstance() != this);
96 } 98 }
97 99
98 // Returns the url of the current top level navigation. 100 // Returns the url of the current top level navigation.
99 const std::wstring& url() const { 101 const std::wstring& url() const {
100 return url_; 102 return url_;
101 } 103 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 headers_.Reset(); 145 headers_.Reset();
144 if (headers) { 146 if (headers) {
145 headers_ = *headers; 147 headers_ = *headers;
146 } 148 }
147 } 149 }
148 150
149 const base::win::ScopedVariant& headers() const { 151 const base::win::ScopedVariant& headers() const {
150 return headers_; 152 return headers_;
151 } 153 }
152 154
155 IWebBrowser2* web_browser() {
156 return web_browser2_.get();
157 }
158
153 protected: 159 protected:
154 std::string referrer_; 160 std::string referrer_;
155 std::wstring url_; 161 std::wstring url_;
156 base::win::ScopedVariant post_data_; 162 base::win::ScopedVariant post_data_;
157 base::win::ScopedVariant headers_; 163 base::win::ScopedVariant headers_;
158 164
159 static base::LazyInstance<base::ThreadLocalPointer<NavigationManager> > 165 static base::LazyInstance<base::ThreadLocalPointer<NavigationManager> >
160 thread_singleton_; 166 thread_singleton_;
167 // The IWebBrowser2 instance associated with this NavigationManager
168 // instance.
169 base::win::ScopedComPtr<IWebBrowser2> web_browser2_;
161 170
162 private: 171 private:
163 DISALLOW_COPY_AND_ASSIGN(NavigationManager); 172 DISALLOW_COPY_AND_ASSIGN(NavigationManager);
164 }; 173 };
165 174
166 // static-only class that manages an IMoniker patch. 175 // static-only class that manages an IMoniker patch.
167 // We need this patch to stay in the loop when top-level HTML content is 176 // 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. 177 // downloaded that might have the CF http-equiv meta tag.
169 // When we detect candidates for those requests, we add our own callback 178 // 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 179 // object (as explained at the top of this file) and use it to cache the
(...skipping 20 matching lines...) Expand all
191 200
192 static STDMETHODIMP BindToStorage(IMoniker_BindToStorage_Fn original, 201 static STDMETHODIMP BindToStorage(IMoniker_BindToStorage_Fn original,
193 IMoniker* me, IBindCtx* bind_ctx, 202 IMoniker* me, IBindCtx* bind_ctx,
194 IMoniker* to_left, REFIID iid, void** obj); 203 IMoniker* to_left, REFIID iid, void** obj);
195 204
196 }; 205 };
197 206
198 extern wchar_t* kChromeRequestParam; 207 extern wchar_t* kChromeRequestParam;
199 208
200 #endif // CHROME_FRAME_URLMON_MONIKER_H_ 209 #endif // CHROME_FRAME_URLMON_MONIKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698