diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-19 16:50:43 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-19 16:50:43 +0000 |
commit | 80b5a8d9ebf236533f154e87b18c9130835ccf06 (patch) | |
tree | 72db1dce801baa370e4f9536820edd7f8f1048a3 /chrome_frame/urlmon_url_request.cc | |
parent | 84e1dff96238dfede15aed36ee2a9bf5a71dd9f9 (diff) | |
download | chromium_src-80b5a8d9ebf236533f154e87b18c9130835ccf06.zip chromium_src-80b5a8d9ebf236533f154e87b18c9130835ccf06.tar.gz chromium_src-80b5a8d9ebf236533f154e87b18c9130835ccf06.tar.bz2 |
Initial support for IE View->Privacy. To support this menu option the active document now implements
the Exec command for the CGID_ShellDocView group and command id 75. We invoke the DoPrivacyDlg function
exported by shdocvw and pass in our implementation of the IEnumPrivacyServices interface.
The actual privacy data is gathered and maintained by the UrlmonUrlRequestManager. If we detect a privacy
violation we notify the shell browser via the ITridentService2::FirePrivacyImpactedStateChange function
which ensures that IE displays the privacy icon.
Thanks to stoyan for his help in getting this done.
I will add tests in a followup CL.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=25479
Bug=25479
Review URL: http://codereview.chromium.org/1127003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/urlmon_url_request.cc')
-rw-r--r-- | chrome_frame/urlmon_url_request.cc | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc index ae077c2..229e196 100644 --- a/chrome_frame/urlmon_url_request.cc +++ b/chrome_frame/urlmon_url_request.cc @@ -186,6 +186,34 @@ STDMETHODIMP UrlmonUrlRequest::OnProgress(ULONG progress, ULONG max_progress, return E_ABORT; } + case BINDSTATUS_COOKIE_SENT: + delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_READ); + break; + + case BINDSTATUS_COOKIE_SUPPRESSED: + delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_SUPPRESS); + break; + + case BINDSTATUS_COOKIE_STATE_ACCEPT: + delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_ACCEPT); + break; + + case BINDSTATUS_COOKIE_STATE_REJECT: + delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_REJECT); + break; + + case BINDSTATUS_COOKIE_STATE_LEASH: + delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_LEASH); + break; + + case BINDSTATUS_COOKIE_STATE_DOWNGRADE: + delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_DOWNGRADE); + break; + + case BINDSTATUS_COOKIE_STATE_UNKNOWN: + NOTREACHED() << L"Unknown cookie state received"; + break; + default: DLOG(INFO) << " Obj: " << std::hex << this << " OnProgress(" << url() << StringPrintf(L") code: %i status: %ls", status_code, status_text); @@ -449,6 +477,8 @@ STDMETHODIMP UrlmonUrlRequest::OnResponse(DWORD dwResponseCode, std::string raw_headers = WideToUTF8(response_headers); + delegate_->AddPrivacyDataForUrl(url(), "", 0); + // Security check for frame busting headers. We don't honor the headers // as-such, but instead simply kill requests which we've been asked to // look for if they specify a value for "X-Frame-Options" other than @@ -866,7 +896,7 @@ void UrlmonUrlRequestManager::StartRequestWorker(int request_id, request_info.extra_request_headers, request_info.upload_data, enable_frame_busting_); - new_request->set_parent_window(err_dialog_parent_wnd_); + new_request->set_parent_window(notification_window_); // Shall we use previously fetched data? if (request_for_url.get()) { @@ -1009,7 +1039,7 @@ scoped_refptr<UrlmonUrlRequest> UrlmonUrlRequestManager::LookupRequest( UrlmonUrlRequestManager::UrlmonUrlRequestManager() : stopping_(false), worker_thread_("UrlMon fetch thread"), - map_empty_(true, true), err_dialog_parent_wnd_(NULL) { + map_empty_(true, true), notification_window_(NULL) { } UrlmonUrlRequestManager::~UrlmonUrlRequestManager() { @@ -1056,7 +1086,35 @@ bool UrlmonUrlRequestManager::ExecuteInWorkerThread( return true; } -void UrlmonUrlRequestManager::SetErrorDialogsParentWindow(HWND window) { - err_dialog_parent_wnd_ = window; +void UrlmonUrlRequestManager::AddPrivacyDataForUrl( + const std::string& url, const std::string& policy_ref, + int32 flags) { + bool fire_privacy_event = false; + + { + AutoLock lock(privacy_info_lock_); + + if (privacy_info_.privacy_records.size() == 0) + flags |= PRIVACY_URLISTOPLEVEL; + + if (!privacy_info_.privacy_impacted) { + if (flags & (COOKIEACTION_ACCEPT | COOKIEACTION_REJECT | + COOKIEACTION_DOWNGRADE)) { + privacy_info_.privacy_impacted = true; + fire_privacy_event = true; + } + } + + PrivacyInfo::PrivacyEntry& privacy_entry = + privacy_info_.privacy_records[UTF8ToWide(url)]; + + privacy_entry.flags |= flags; + privacy_entry.policy_ref = UTF8ToWide(policy_ref); + } + + if (fire_privacy_event && IsWindow(notification_window_)) { + PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, + 0); + } } |