OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 handlers[i]->clear(); | 305 handlers[i]->clear(); |
306 | 306 |
307 // Drop privileged mode on uninitialization. | 307 // Drop privileged mode on uninitialization. |
308 set_is_privileged(false); | 308 set_is_privileged(false); |
309 } else { | 309 } else { |
310 base::win::ScopedComPtr<IHTMLDocument2> document; | 310 base::win::ScopedComPtr<IHTMLDocument2> document; |
311 GetContainingDocument(document.Receive()); | 311 GetContainingDocument(document.Receive()); |
312 if (document) { | 312 if (document) { |
313 base::win::ScopedBstr url; | 313 base::win::ScopedBstr url; |
314 if (SUCCEEDED(document->get_URL(url.Receive()))) | 314 if (SUCCEEDED(document->get_URL(url.Receive()))) |
315 WideToUTF8(url, url.Length(), &document_url_); | 315 base::WideToUTF8(url, url.Length(), &document_url_); |
316 } | 316 } |
317 | 317 |
318 // Probe to see whether the host implements the privileged service. | 318 // Probe to see whether the host implements the privileged service. |
319 base::win::ScopedComPtr<IChromeFramePrivileged> service; | 319 base::win::ScopedComPtr<IChromeFramePrivileged> service; |
320 HRESULT service_hr = DoQueryService(SID_ChromeFramePrivileged, | 320 HRESULT service_hr = DoQueryService(SID_ChromeFramePrivileged, |
321 m_spClientSite, | 321 m_spClientSite, |
322 service.Receive()); | 322 service.Receive()); |
323 if (SUCCEEDED(service_hr) && service) { | 323 if (SUCCEEDED(service_hr) && service) { |
324 // Does the host want privileged mode? | 324 // Does the host want privileged mode? |
325 boolean wants_privileged = false; | 325 boolean wants_privileged = false; |
326 service_hr = service->GetWantsPrivileged(&wants_privileged); | 326 service_hr = service->GetWantsPrivileged(&wants_privileged); |
327 | 327 |
328 if (SUCCEEDED(service_hr) && wants_privileged) | 328 if (SUCCEEDED(service_hr) && wants_privileged) |
329 set_is_privileged(true); | 329 set_is_privileged(true); |
330 | 330 |
331 url_fetcher_->set_privileged_mode(is_privileged()); | 331 url_fetcher_->set_privileged_mode(is_privileged()); |
332 } | 332 } |
333 | 333 |
334 std::wstring profile_name(GetHostProcessName(false)); | 334 std::wstring profile_name(GetHostProcessName(false)); |
335 if (is_privileged()) { | 335 if (is_privileged()) { |
336 base::win::ScopedBstr profile_name_arg; | 336 base::win::ScopedBstr profile_name_arg; |
337 service_hr = service->GetChromeProfileName(profile_name_arg.Receive()); | 337 service_hr = service->GetChromeProfileName(profile_name_arg.Receive()); |
338 if (S_OK == service_hr && profile_name_arg) | 338 if (S_OK == service_hr && profile_name_arg) |
339 profile_name.assign(profile_name_arg, profile_name_arg.Length()); | 339 profile_name.assign(profile_name_arg, profile_name_arg.Length()); |
340 } | 340 } |
341 | 341 |
342 std::string utf8_url; | 342 std::string utf8_url; |
343 if (url_.Length()) { | 343 if (url_.Length()) { |
344 WideToUTF8(url_, url_.Length(), &utf8_url); | 344 base::WideToUTF8(url_, url_.Length(), &utf8_url); |
345 } | 345 } |
346 | 346 |
347 InitializeAutomationSettings(); | 347 InitializeAutomationSettings(); |
348 | 348 |
349 | 349 |
350 url_fetcher_->set_frame_busting(!is_privileged()); | 350 url_fetcher_->set_frame_busting(!is_privileged()); |
351 automation_client_->SetUrlFetcher(url_fetcher_.get()); | 351 automation_client_->SetUrlFetcher(url_fetcher_.get()); |
352 if (!InitializeAutomation(profile_name, IsIEInPrivate(), true, | 352 if (!InitializeAutomation(profile_name, IsIEInPrivate(), true, |
353 GURL(utf8_url), GURL(), false)) { | 353 GURL(utf8_url), GURL(), false)) { |
354 DLOG(ERROR) << "Failed to navigate to url:" << utf8_url; | 354 DLOG(ERROR) << "Failed to navigate to url:" << utf8_url; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 if (FAILED(hr)) { | 533 if (FAILED(hr)) { |
534 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" | 534 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" |
535 << base::StringPrintf(" 0x%08X", hr); | 535 << base::StringPrintf(" 0x%08X", hr); |
536 return hr; | 536 return hr; |
537 } | 537 } |
538 | 538 |
539 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), | 539 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), |
540 base::win::ScopedVariant(bho)); | 540 base::win::ScopedVariant(bho)); |
541 return S_OK; | 541 return S_OK; |
542 } | 542 } |
OLD | NEW |