| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 Base::OnAutomationServerLaunchFailed(reason, server_version); | 302 Base::OnAutomationServerLaunchFailed(reason, server_version); |
| 303 | 303 |
| 304 if (reason == AUTOMATION_VERSION_MISMATCH && | 304 if (reason == AUTOMATION_VERSION_MISMATCH && |
| 305 ShouldShowVersionMismatchDialog(is_privileged(), m_spClientSite)) { | 305 ShouldShowVersionMismatchDialog(is_privileged(), m_spClientSite)) { |
| 306 THREAD_SAFE_UMA_HISTOGRAM_COUNTS( | 306 THREAD_SAFE_UMA_HISTOGRAM_COUNTS( |
| 307 "ChromeFrame.VersionMismatchDisplayed", 1); | 307 "ChromeFrame.VersionMismatchDisplayed", 1); |
| 308 DisplayVersionMismatchWarning(m_hWnd, server_version); | 308 DisplayVersionMismatchWarning(m_hWnd, server_version); |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 | 311 |
| 312 void ChromeFrameActivex::OnExtensionInstalled( | |
| 313 const FilePath& path, | |
| 314 void* user_data, | |
| 315 AutomationMsg_ExtensionResponseValues response) { | |
| 316 base::win::ScopedBstr path_str(path.value().c_str()); | |
| 317 Fire_onextensionready(path_str, response); | |
| 318 } | |
| 319 | |
| 320 void ChromeFrameActivex::OnGetEnabledExtensionsComplete( | |
| 321 void* user_data, | |
| 322 const std::vector<FilePath>& extension_directories) { | |
| 323 SAFEARRAY* sa = ::SafeArrayCreateVector(VT_BSTR, 0, | |
| 324 extension_directories.size()); | |
| 325 sa->fFeatures = sa->fFeatures | FADF_BSTR; | |
| 326 ::SafeArrayLock(sa); | |
| 327 | |
| 328 for (size_t i = 0; i < extension_directories.size(); ++i) { | |
| 329 LONG index = static_cast<LONG>(i); | |
| 330 ::SafeArrayPutElement(sa, &index, reinterpret_cast<void*>( | |
| 331 CComBSTR(extension_directories[i].value().c_str()).Detach())); | |
| 332 } | |
| 333 | |
| 334 Fire_ongetenabledextensionscomplete(sa); | |
| 335 ::SafeArrayUnlock(sa); | |
| 336 ::SafeArrayDestroy(sa); | |
| 337 } | |
| 338 | |
| 339 void ChromeFrameActivex::OnChannelError() { | 312 void ChromeFrameActivex::OnChannelError() { |
| 340 Fire_onchannelerror(); | 313 Fire_onchannelerror(); |
| 341 } | 314 } |
| 342 | 315 |
| 343 HRESULT ChromeFrameActivex::OnDraw(ATL_DRAWINFO& draw_info) { // NOLINT | 316 HRESULT ChromeFrameActivex::OnDraw(ATL_DRAWINFO& draw_info) { // NOLINT |
| 344 HRESULT hr = S_OK; | 317 HRESULT hr = S_OK; |
| 345 int dc_type = ::GetObjectType(draw_info.hicTargetDev); | 318 int dc_type = ::GetObjectType(draw_info.hicTargetDev); |
| 346 if (dc_type == OBJ_ENHMETADC) { | 319 if (dc_type == OBJ_ENHMETADC) { |
| 347 RECT print_bounds = {0}; | 320 RECT print_bounds = {0}; |
| 348 print_bounds.left = draw_info.prcBounds->left; | 321 print_bounds.left = draw_info.prcBounds->left; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 service_hr = service->GetWantsPrivileged(&wants_privileged); | 451 service_hr = service->GetWantsPrivileged(&wants_privileged); |
| 479 | 452 |
| 480 if (SUCCEEDED(service_hr) && wants_privileged) | 453 if (SUCCEEDED(service_hr) && wants_privileged) |
| 481 set_is_privileged(true); | 454 set_is_privileged(true); |
| 482 | 455 |
| 483 url_fetcher_->set_privileged_mode(is_privileged()); | 456 url_fetcher_->set_privileged_mode(is_privileged()); |
| 484 } | 457 } |
| 485 | 458 |
| 486 std::wstring profile_name(GetHostProcessName(false)); | 459 std::wstring profile_name(GetHostProcessName(false)); |
| 487 if (is_privileged()) { | 460 if (is_privileged()) { |
| 488 | |
| 489 base::win::ScopedBstr automated_functions_arg; | |
| 490 service_hr = service->GetExtensionApisToAutomate( | |
| 491 automated_functions_arg.Receive()); | |
| 492 if (S_OK == service_hr && automated_functions_arg) { | |
| 493 std::string automated_functions( | |
| 494 WideToASCII(static_cast<BSTR>(automated_functions_arg))); | |
| 495 functions_enabled_.clear(); | |
| 496 // base::SplitString writes one empty entry for blank strings, so we | |
| 497 // need this to allow specifying zero automation of API functions. | |
| 498 if (!automated_functions.empty()) | |
| 499 base::SplitString(automated_functions, ',', &functions_enabled_); | |
| 500 } | |
| 501 | |
| 502 base::win::ScopedBstr profile_name_arg; | 461 base::win::ScopedBstr profile_name_arg; |
| 503 service_hr = service->GetChromeProfileName(profile_name_arg.Receive()); | 462 service_hr = service->GetChromeProfileName(profile_name_arg.Receive()); |
| 504 if (S_OK == service_hr && profile_name_arg) | 463 if (S_OK == service_hr && profile_name_arg) |
| 505 profile_name.assign(profile_name_arg, profile_name_arg.Length()); | 464 profile_name.assign(profile_name_arg, profile_name_arg.Length()); |
| 506 } | 465 } |
| 507 | 466 |
| 508 std::string utf8_url; | 467 std::string utf8_url; |
| 509 if (url_.Length()) { | 468 if (url_.Length()) { |
| 510 WideToUTF8(url_, url_.Length(), &utf8_url); | 469 WideToUTF8(url_, url_.Length(), &utf8_url); |
| 511 } | 470 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 if (FAILED(hr)) { | 684 if (FAILED(hr)) { |
| 726 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" | 685 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" |
| 727 << base::StringPrintf(" 0x%08X", hr); | 686 << base::StringPrintf(" 0x%08X", hr); |
| 728 return hr; | 687 return hr; |
| 729 } | 688 } |
| 730 | 689 |
| 731 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), | 690 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), |
| 732 base::win::ScopedVariant(bho)); | 691 base::win::ScopedVariant(bho)); |
| 733 return S_OK; | 692 return S_OK; |
| 734 } | 693 } |
| OLD | NEW |