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

Side by Side Diff: chrome_frame/chrome_frame_activex_base.h

Issue 5698005: Add support for gcf:about:plugins in chrome frame full tab mode. The URL vali... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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_CHROME_FRAME_ACTIVEX_BASE_H_ 5 #ifndef CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_
6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ 6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 #include <atlctl.h> 10 #include <atlctl.h>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 FireMethodWithParams(CF_EVENT_DISPID_ONCHANNELERROR, NULL, 0); 142 FireMethodWithParams(CF_EVENT_DISPID_ONCHANNELERROR, NULL, 0);
143 } 143 }
144 144
145 void Fire_onclose() { // NOLINT 145 void Fire_onclose() { // NOLINT
146 FireMethodWithParams(CF_EVENT_DISPID_ONCLOSE, NULL, 0); 146 FireMethodWithParams(CF_EVENT_DISPID_ONCLOSE, NULL, 0);
147 } 147 }
148 }; 148 };
149 149
150 extern bool g_first_launch_by_process_; 150 extern bool g_first_launch_by_process_;
151 151
152 // Posted when the worker thread used for handling URL requests in IE finishes
153 // uninitialization.
154 #define WM_WORKER_THREAD_UNINITIALIZED_MSG (WM_APP + 1)
155
156 // Common implementation for ActiveX and Active Document 152 // Common implementation for ActiveX and Active Document
157 template <class T, const CLSID& class_id> 153 template <class T, const CLSID& class_id>
158 class ATL_NO_VTABLE ChromeFrameActivexBase : // NOLINT 154 class ATL_NO_VTABLE ChromeFrameActivexBase : // NOLINT
159 public CComObjectRootEx<CComMultiThreadModel>, 155 public CComObjectRootEx<CComMultiThreadModel>,
160 public IOleControlImpl<T>, 156 public IOleControlImpl<T>,
161 public IOleObjectImpl<T>, 157 public IOleObjectImpl<T>,
162 public IOleInPlaceActiveObjectImpl<T>, 158 public IOleInPlaceActiveObjectImpl<T>,
163 public IViewObjectExImpl<T>, 159 public IViewObjectExImpl<T>,
164 public IOleInPlaceObjectWindowlessImpl<T>, 160 public IOleInPlaceObjectWindowlessImpl<T>,
165 public ISupportErrorInfo, 161 public ISupportErrorInfo,
166 public IQuickActivateImpl<T>, 162 public IQuickActivateImpl<T>,
167 public com_util::IProvideClassInfo2Impl<class_id, 163 public com_util::IProvideClassInfo2Impl<class_id,
168 DIID_DIChromeFrameEvents>, 164 DIID_DIChromeFrameEvents>,
169 public com_util::IDispatchImpl<IChromeFrame>, 165 public com_util::IDispatchImpl<IChromeFrame>,
170 public IChromeFrameInternal, 166 public IChromeFrameInternal,
171 public IConnectionPointContainerImpl<T>, 167 public IConnectionPointContainerImpl<T>,
172 public ProxyDIChromeFrameEvents<T>, 168 public ProxyDIChromeFrameEvents<T>,
173 public IPropertyNotifySinkCP<T>, 169 public IPropertyNotifySinkCP<T>,
174 public CComCoClass<T, &class_id>, 170 public CComCoClass<T, &class_id>,
175 public CComControl<T>, 171 public CComControl<T>,
176 public ChromeFramePlugin<T> { 172 public ChromeFramePlugin<T>,
173 public NavigationConstraintsImpl {
177 protected: 174 protected:
178 typedef std::set<base::win::ScopedComPtr<IDispatch> > EventHandlers; 175 typedef std::set<base::win::ScopedComPtr<IDispatch> > EventHandlers;
179 typedef ChromeFrameActivexBase<T, class_id> BasePlugin; 176 typedef ChromeFrameActivexBase<T, class_id> BasePlugin;
180 177
181 public: 178 public:
182 ChromeFrameActivexBase() 179 ChromeFrameActivexBase()
183 : ready_state_(READYSTATE_UNINITIALIZED), 180 : ready_state_(READYSTATE_UNINITIALIZED),
184 url_fetcher_(new UrlmonUrlRequestManager()), 181 url_fetcher_(new UrlmonUrlRequestManager()),
185 failed_to_fetch_in_place_frame_(false), 182 failed_to_fetch_in_place_frame_(false),
186 draw_sad_tab_(false), 183 draw_sad_tab_(false),
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 draw_sad_tab_ = true; 565 draw_sad_tab_ = true;
569 566
570 ready_state_ = READYSTATE_UNINITIALIZED; 567 ready_state_ = READYSTATE_UNINITIALIZED;
571 FireOnChanged(DISPID_READYSTATE); 568 FireOnChanged(DISPID_READYSTATE);
572 } 569 }
573 570
574 virtual void OnCloseTab(int tab_handle) { 571 virtual void OnCloseTab(int tab_handle) {
575 Fire_onclose(); 572 Fire_onclose();
576 } 573 }
577 574
575 // NavigationConstraints overrides.
576 virtual bool IsSchemeAllowed(const GURL&url) {
amit 2010/12/10 23:56:17 nit: space after &
ananta 2010/12/11 02:11:11 Done.
577 bool allowed = NavigationConstraintsImpl::IsSchemeAllowed(url);
578 if (allowed)
579 return true;
580
581 if (is_privileged_ &&
582 (url.SchemeIs(chrome::kDataScheme) ||
583 url.SchemeIs(chrome::kExtensionScheme))) {
584 return true;
585 }
586 return false;
587 }
588
589 virtual bool IsZoneAllowed(const GURL& url) {
590 if (!security_manager_) {
591 HRESULT hr = security_manager_.CreateInstance(
592 CLSID_InternetSecurityManager);
593 if (FAILED(hr)) {
594 NOTREACHED() << __FUNCTION__
595 << " Failed to create SecurityManager. Error: 0x%x"
596 << hr;
597 return false;
598 }
599 }
600 DWORD zone = URLZONE_INVALID;
601 std::wstring unicode_url = UTF8ToWide(url.spec());
602 security_manager_->MapUrlToZone(unicode_url.c_str(), &zone, 0);
603 if (zone == URLZONE_UNTRUSTED) {
604 DLOG(WARNING) << __FUNCTION__
605 << " Disallowing navigation to restricted url: " << url;
606 return false;
607 }
608 return true;
609 }
610
578 // Overridden to take advantage of readystate prop changes and send those 611 // Overridden to take advantage of readystate prop changes and send those
579 // to potential listeners. 612 // to potential listeners.
580 HRESULT FireOnChanged(DISPID dispid) { 613 HRESULT FireOnChanged(DISPID dispid) {
581 if (dispid == DISPID_READYSTATE) { 614 if (dispid == DISPID_READYSTATE) {
582 Fire_onreadystatechanged(ready_state_); 615 Fire_onreadystatechanged(ready_state_);
583 } 616 }
584 return __super::FireOnChanged(dispid); 617 return __super::FireOnChanged(dispid);
585 } 618 }
586 619
587 // IChromeFrame 620 // IChromeFrame
(...skipping 16 matching lines...) Expand all
604 // Switch the src to UTF8 and try to expand to full URL 637 // Switch the src to UTF8 and try to expand to full URL
605 std::string src_utf8; 638 std::string src_utf8;
606 WideToUTF8(src, SysStringLen(src), &src_utf8); 639 WideToUTF8(src, SysStringLen(src), &src_utf8);
607 std::string full_url = ResolveURL(GetDocumentUrl(), src_utf8); 640 std::string full_url = ResolveURL(GetDocumentUrl(), src_utf8);
608 641
609 // We can initiate navigation here even if ready_state is not complete. 642 // We can initiate navigation here even if ready_state is not complete.
610 // We do not have to set proxy, and AutomationClient will take care 643 // We do not have to set proxy, and AutomationClient will take care
611 // of navigation just after CreateExternalTab is done. 644 // of navigation just after CreateExternalTab is done.
612 if (!automation_client_->InitiateNavigation(full_url, 645 if (!automation_client_->InitiateNavigation(full_url,
613 GetDocumentUrl(), 646 GetDocumentUrl(),
614 is_privileged_)) { 647 this)) {
615 // TODO(robertshield): Make InitiateNavigation return more useful 648 // TODO(robertshield): Make InitiateNavigation return more useful
616 // error information. 649 // error information.
617 return E_INVALIDARG; 650 return E_INVALIDARG;
618 } 651 }
619 652
620 // Save full URL in BSTR member 653 // Save full URL in BSTR member
621 url_.Reset(::SysAllocString(UTF8ToWide(full_url).c_str())); 654 url_.Reset(::SysAllocString(UTF8ToWide(full_url).c_str()));
622 655
623 return S_OK; 656 return S_OK;
624 } 657 }
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 EventHandlers onmessage_; 1303 EventHandlers onmessage_;
1271 EventHandlers onloaderror_; 1304 EventHandlers onloaderror_;
1272 EventHandlers onload_; 1305 EventHandlers onload_;
1273 EventHandlers onreadystatechanged_; 1306 EventHandlers onreadystatechanged_;
1274 EventHandlers onprivatemessage_; 1307 EventHandlers onprivatemessage_;
1275 EventHandlers onextensionready_; 1308 EventHandlers onextensionready_;
1276 1309
1277 // Handle network requests when host network stack is used. Passed to the 1310 // Handle network requests when host network stack is used. Passed to the
1278 // automation client on initialization. 1311 // automation client on initialization.
1279 scoped_ptr<UrlmonUrlRequestManager> url_fetcher_; 1312 scoped_ptr<UrlmonUrlRequestManager> url_fetcher_;
1313 ScopedComPtr<IInternetSecurityManager> security_manager_;
1280 1314
1281 HINSTANCE prev_resource_instance_; 1315 HINSTANCE prev_resource_instance_;
1282 }; 1316 };
1283 1317
1284 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ 1318 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698