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 // Implementation of ChromeActiveDocument | 5 // Implementation of ChromeActiveDocument |
6 #include "chrome_frame/chrome_active_document.h" | 6 #include "chrome_frame/chrome_active_document.h" |
7 | 7 |
8 #include <hlink.h> | 8 #include <hlink.h> |
9 #include <htiface.h> | 9 #include <htiface.h> |
10 #include <initguid.h> | 10 #include <initguid.h> |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 if (NULL == url) | 457 if (NULL == url) |
458 return E_POINTER; | 458 return E_POINTER; |
459 *url = ::SysAllocString(url_); | 459 *url = ::SysAllocString(url_); |
460 return S_OK; | 460 return S_OK; |
461 } | 461 } |
462 | 462 |
463 STDMETHODIMP ChromeActiveDocument::GetAddressBarUrl(BSTR* url) { | 463 STDMETHODIMP ChromeActiveDocument::GetAddressBarUrl(BSTR* url) { |
464 return GetUrlForEvents(url); | 464 return GetUrlForEvents(url); |
465 } | 465 } |
466 | 466 |
| 467 STDMETHODIMP ChromeActiveDocument::PutProperty( |
| 468 MONIKERPROPERTY moniker_prop, LPCWSTR value) { |
| 469 return S_OK; |
| 470 } |
| 471 |
| 472 |
467 STDMETHODIMP ChromeActiveDocument::Reset() { | 473 STDMETHODIMP ChromeActiveDocument::Reset() { |
468 next_privacy_record_ = privacy_info_.privacy_records.begin(); | 474 next_privacy_record_ = privacy_info_.privacy_records.begin(); |
469 return S_OK; | 475 return S_OK; |
470 } | 476 } |
471 | 477 |
472 STDMETHODIMP ChromeActiveDocument::GetSize(DWORD* size) { | 478 STDMETHODIMP ChromeActiveDocument::GetSize(DWORD* size) { |
473 if (!size) | 479 if (!size) |
474 return E_POINTER; | 480 return E_POINTER; |
475 | 481 |
476 *size = privacy_info_.privacy_records.size(); | 482 *size = privacy_info_.privacy_records.size(); |
(...skipping 17 matching lines...) Expand all Loading... |
494 return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS); | 500 return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS); |
495 | 501 |
496 *url = SysAllocString(next_privacy_record_->first.c_str()); | 502 *url = SysAllocString(next_privacy_record_->first.c_str()); |
497 *policy = SysAllocString(next_privacy_record_->second.policy_ref.c_str()); | 503 *policy = SysAllocString(next_privacy_record_->second.policy_ref.c_str()); |
498 *flags = next_privacy_record_->second.flags; | 504 *flags = next_privacy_record_->second.flags; |
499 | 505 |
500 next_privacy_record_++; | 506 next_privacy_record_++; |
501 return S_OK; | 507 return S_OK; |
502 } | 508 } |
503 | 509 |
| 510 bool ChromeActiveDocument::IsSchemeAllowed(const GURL& url) { |
| 511 bool allowed = BaseActiveX::IsSchemeAllowed(url); |
| 512 if (allowed) |
| 513 return true; |
| 514 |
| 515 if (url.SchemeIs(chrome::kAboutScheme)) { |
| 516 if (LowerCaseEqualsASCII(url.spec(), chrome::kAboutPluginsURL)) |
| 517 return true; |
| 518 } |
| 519 return false; |
| 520 } |
| 521 |
504 HRESULT ChromeActiveDocument::GetInPlaceFrame( | 522 HRESULT ChromeActiveDocument::GetInPlaceFrame( |
505 IOleInPlaceFrame** in_place_frame) { | 523 IOleInPlaceFrame** in_place_frame) { |
506 DCHECK(in_place_frame); | 524 DCHECK(in_place_frame); |
507 if (in_place_frame_) { | 525 if (in_place_frame_) { |
508 *in_place_frame = in_place_frame_.get(); | 526 *in_place_frame = in_place_frame_.get(); |
509 (*in_place_frame)->AddRef(); | 527 (*in_place_frame)->AddRef(); |
510 return S_OK; | 528 return S_OK; |
511 } else { | 529 } else { |
512 return S_FALSE; | 530 return S_FALSE; |
513 } | 531 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 } | 1043 } |
1026 } | 1044 } |
1027 | 1045 |
1028 url_.Allocate(UTF8ToWide(cf_url.gurl().spec()).c_str()); | 1046 url_.Allocate(UTF8ToWide(cf_url.gurl().spec()).c_str()); |
1029 if (cf_url.attach_to_external_tab()) { | 1047 if (cf_url.attach_to_external_tab()) { |
1030 dimensions_ = cf_url.dimensions(); | 1048 dimensions_ = cf_url.dimensions(); |
1031 automation_client_->AttachExternalTab(cf_url.cookie()); | 1049 automation_client_->AttachExternalTab(cf_url.cookie()); |
1032 SetWindowDimensions(); | 1050 SetWindowDimensions(); |
1033 } else if (!automation_client_->InitiateNavigation(cf_url.gurl().spec(), | 1051 } else if (!automation_client_->InitiateNavigation(cf_url.gurl().spec(), |
1034 referrer, | 1052 referrer, |
1035 is_privileged_)) { | 1053 this)) { |
1036 DLOG(ERROR) << "Invalid URL: " << url_; | 1054 DLOG(ERROR) << "Invalid URL: " << url_; |
1037 Error(L"Invalid URL"); | 1055 Error(L"Invalid URL"); |
1038 url_.Reset(); | 1056 url_.Reset(); |
1039 return false; | 1057 return false; |
1040 } | 1058 } |
1041 | 1059 |
1042 if (is_automation_client_reused_) | 1060 if (is_automation_client_reused_) |
1043 return true; | 1061 return true; |
1044 | 1062 |
1045 automation_client_->SetUrlFetcher(url_fetcher_.get()); | 1063 automation_client_->SetUrlFetcher(url_fetcher_.get()); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 return true; | 1392 return true; |
1375 | 1393 |
1376 if (new_navigation_info.url != navigation_info_.url) | 1394 if (new_navigation_info.url != navigation_info_.url) |
1377 return true; | 1395 return true; |
1378 | 1396 |
1379 if (new_navigation_info.referrer != navigation_info_.referrer) | 1397 if (new_navigation_info.referrer != navigation_info_.referrer) |
1380 return true; | 1398 return true; |
1381 | 1399 |
1382 return false; | 1400 return false; |
1383 } | 1401 } |
OLD | NEW |