| 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 #include "chrome_frame/chrome_frame_activex.h" | 5 #include "chrome_frame/chrome_frame_activex.h" |
| 6 | 6 |
| 7 #include <wininet.h> | 7 #include <wininet.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 HRESULT ChromeFrameActivex::GetDocumentWindow(IHTMLWindow2** window) { | 177 HRESULT ChromeFrameActivex::GetDocumentWindow(IHTMLWindow2** window) { |
| 178 ScopedComPtr<IHTMLDocument2> document; | 178 ScopedComPtr<IHTMLDocument2> document; |
| 179 HRESULT hr = GetContainingDocument(document.Receive()); | 179 HRESULT hr = GetContainingDocument(document.Receive()); |
| 180 if (document) | 180 if (document) |
| 181 hr = document->get_parentWindow(window); | 181 hr = document->get_parentWindow(window); |
| 182 return hr; | 182 return hr; |
| 183 } | 183 } |
| 184 | 184 |
| 185 void ChromeFrameActivex::OnLoad(int tab_handle, const GURL& gurl) { | 185 void ChromeFrameActivex::OnLoad(const GURL& gurl) { |
| 186 ScopedComPtr<IDispatch> event; | 186 ScopedComPtr<IDispatch> event; |
| 187 std::string url = gurl.spec(); | 187 std::string url = gurl.spec(); |
| 188 if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive()))) | 188 if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive()))) |
| 189 Fire_onload(event); | 189 Fire_onload(event); |
| 190 | 190 |
| 191 FireEvent(onload_, url); | 191 FireEvent(onload_, url); |
| 192 Base::OnLoad(tab_handle, gurl); | 192 Base::OnLoad(gurl); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) { | 195 void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) { |
| 196 ScopedComPtr<IDispatch> event; | 196 ScopedComPtr<IDispatch> event; |
| 197 if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive()))) | 197 if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive()))) |
| 198 Fire_onloaderror(event); | 198 Fire_onloaderror(event); |
| 199 | 199 |
| 200 FireEvent(onloaderror_, url); | 200 FireEvent(onloaderror_, url); |
| 201 Base::OnLoadFailed(error_code, url); | 201 Base::OnLoadFailed(error_code, url); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle, | 204 void ChromeFrameActivex::OnMessageFromChromeFrame(const std::string& message, |
| 205 const std::string& message, | |
| 206 const std::string& origin, | 205 const std::string& origin, |
| 207 const std::string& target) { | 206 const std::string& target) { |
| 208 DVLOG(1) << __FUNCTION__; | 207 DVLOG(1) << __FUNCTION__; |
| 209 | 208 |
| 210 if (target.compare("*") != 0) { | 209 if (target.compare("*") != 0) { |
| 211 bool drop = true; | 210 bool drop = true; |
| 212 | 211 |
| 213 if (is_privileged()) { | 212 if (is_privileged()) { |
| 214 // Forward messages if the control is in privileged mode. | 213 // Forward messages if the control is in privileged mode. |
| 215 ScopedComPtr<IDispatch> message_event; | 214 ScopedComPtr<IDispatch> message_event; |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 if (FAILED(hr)) { | 686 if (FAILED(hr)) { |
| 688 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" | 687 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" |
| 689 << base::StringPrintf(" 0x%08X", hr); | 688 << base::StringPrintf(" 0x%08X", hr); |
| 690 return hr; | 689 return hr; |
| 691 } | 690 } |
| 692 | 691 |
| 693 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), | 692 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), |
| 694 base::win::ScopedVariant(bho)); | 693 base::win::ScopedVariant(bho)); |
| 695 return S_OK; | 694 return S_OK; |
| 696 } | 695 } |
| OLD | NEW |