| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 Fire_onloaderror(event); | 197 Fire_onloaderror(event); |
| 198 | 198 |
| 199 FireEvent(onloaderror_, url); | 199 FireEvent(onloaderror_, url); |
| 200 Base::OnLoadFailed(error_code, url); | 200 Base::OnLoadFailed(error_code, url); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle, | 203 void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle, |
| 204 const std::string& message, | 204 const std::string& message, |
| 205 const std::string& origin, | 205 const std::string& origin, |
| 206 const std::string& target) { | 206 const std::string& target) { |
| 207 DLOG(INFO) << __FUNCTION__; | 207 DVLOG(1) << __FUNCTION__; |
| 208 | 208 |
| 209 if (target.compare("*") != 0) { | 209 if (target.compare("*") != 0) { |
| 210 bool drop = true; | 210 bool drop = true; |
| 211 | 211 |
| 212 if (is_privileged_) { | 212 if (is_privileged_) { |
| 213 // Forward messages if the control is in privileged mode. | 213 // Forward messages if the control is in privileged mode. |
| 214 ScopedComPtr<IDispatch> message_event; | 214 ScopedComPtr<IDispatch> message_event; |
| 215 if (SUCCEEDED(CreateDomEvent("message", message, origin, | 215 if (SUCCEEDED(CreateDomEvent("message", message, origin, |
| 216 message_event.Receive()))) { | 216 message_event.Receive()))) { |
| 217 ScopedBstr target_bstr(UTF8ToWide(target).c_str()); | 217 ScopedBstr target_bstr(UTF8ToWide(target).c_str()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ScopedBstr prop(event_props[i]); | 327 ScopedBstr prop(event_props[i]); |
| 328 ScopedVariant value; | 328 ScopedVariant value; |
| 329 if (SUCCEEDED(bag->Read(prop, value.Receive(), error_log))) { | 329 if (SUCCEEDED(bag->Read(prop, value.Receive(), error_log))) { |
| 330 if (value.type() != VT_BSTR || | 330 if (value.type() != VT_BSTR || |
| 331 FAILED(hr = CreateScriptBlockForEvent(element, object_id, | 331 FAILED(hr = CreateScriptBlockForEvent(element, object_id, |
| 332 V_BSTR(&value), prop))) { | 332 V_BSTR(&value), prop))) { |
| 333 DLOG(ERROR) << "Failed to create script block for " << prop | 333 DLOG(ERROR) << "Failed to create script block for " << prop |
| 334 << base::StringPrintf(L"hr=0x%08X, vt=%i", hr, | 334 << base::StringPrintf(L"hr=0x%08X, vt=%i", hr, |
| 335 value.type()); | 335 value.type()); |
| 336 } else { | 336 } else { |
| 337 DLOG(INFO) << "script block created for event " << prop << | 337 DVLOG(1) << "script block created for event " << prop |
| 338 base::StringPrintf(" (0x%08X)", hr) << " connections: " << | 338 << base::StringPrintf(" (0x%08X)", hr) << " connections: " << |
| 339 ProxyDIChromeFrameEvents<ChromeFrameActivex>::m_vec.GetSize(); | 339 ProxyDIChromeFrameEvents<ChromeFrameActivex>::m_vec.GetSize(); |
| 340 } | 340 } |
| 341 } else { | 341 } else { |
| 342 DLOG(INFO) << "event property " << prop << " not in property bag"; | 342 DVLOG(1) << "event property " << prop << " not in property bag"; |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 ScopedVariant src; | 346 ScopedVariant src; |
| 347 if (SUCCEEDED(bag->Read(StackBstr(L"src"), src.Receive(), error_log))) { | 347 if (SUCCEEDED(bag->Read(StackBstr(L"src"), src.Receive(), error_log))) { |
| 348 if (src.type() == VT_BSTR) { | 348 if (src.type() == VT_BSTR) { |
| 349 hr = put_src(V_BSTR(&src)); | 349 hr = put_src(V_BSTR(&src)); |
| 350 DCHECK(hr != E_UNEXPECTED); | 350 DCHECK(hr != E_UNEXPECTED); |
| 351 } | 351 } |
| 352 } | 352 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 return chrome_wndproc_hook_ ? S_OK : E_FAIL; | 622 return chrome_wndproc_hook_ ? S_OK : E_FAIL; |
| 623 } | 623 } |
| 624 | 624 |
| 625 HRESULT ChromeFrameActivex::registerBhoIfNeeded() { | 625 HRESULT ChromeFrameActivex::registerBhoIfNeeded() { |
| 626 if (!m_spUnkSite) { | 626 if (!m_spUnkSite) { |
| 627 NOTREACHED() << "Invalid client site"; | 627 NOTREACHED() << "Invalid client site"; |
| 628 return E_FAIL; | 628 return E_FAIL; |
| 629 } | 629 } |
| 630 | 630 |
| 631 if (NavigationManager::GetThreadInstance() != NULL) { | 631 if (NavigationManager::GetThreadInstance() != NULL) { |
| 632 DLOG(INFO) << "BHO already loaded"; | 632 DVLOG(1) << "BHO already loaded"; |
| 633 return S_OK; | 633 return S_OK; |
| 634 } | 634 } |
| 635 | 635 |
| 636 ScopedComPtr<IWebBrowser2> web_browser2; | 636 ScopedComPtr<IWebBrowser2> web_browser2; |
| 637 HRESULT hr = DoQueryService(SID_SWebBrowserApp, m_spUnkSite, | 637 HRESULT hr = DoQueryService(SID_SWebBrowserApp, m_spUnkSite, |
| 638 web_browser2.Receive()); | 638 web_browser2.Receive()); |
| 639 if (FAILED(hr) || web_browser2.get() == NULL) { | 639 if (FAILED(hr) || web_browser2.get() == NULL) { |
| 640 DLOG(WARNING) << "Failed to get IWebBrowser2 from client site. Error:" | 640 DLOG(WARNING) << "Failed to get IWebBrowser2 from client site. Error:" |
| 641 << base::StringPrintf(" 0x%08X", hr); | 641 << base::StringPrintf(" 0x%08X", hr); |
| 642 return hr; | 642 return hr; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 658 if (FAILED(hr)) { | 658 if (FAILED(hr)) { |
| 659 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" | 659 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" |
| 660 << base::StringPrintf(" 0x%08X", hr); | 660 << base::StringPrintf(" 0x%08X", hr); |
| 661 return hr; | 661 return hr; |
| 662 } | 662 } |
| 663 | 663 |
| 664 web_browser2->PutProperty(ScopedBstr(bho_class_id_as_string), | 664 web_browser2->PutProperty(ScopedBstr(bho_class_id_as_string), |
| 665 ScopedVariant(bho)); | 665 ScopedVariant(bho)); |
| 666 return S_OK; | 666 return S_OK; |
| 667 } | 667 } |
| OLD | NEW |