summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 16:50:43 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 16:50:43 +0000
commit80b5a8d9ebf236533f154e87b18c9130835ccf06 (patch)
tree72db1dce801baa370e4f9536820edd7f8f1048a3 /chrome_frame
parent84e1dff96238dfede15aed36ee2a9bf5a71dd9f9 (diff)
downloadchromium_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')
-rw-r--r--chrome_frame/chrome_active_document.cc75
-rw-r--r--chrome_frame/chrome_active_document.h28
-rw-r--r--chrome_frame/chrome_frame.gyp5
-rw-r--r--chrome_frame/chrome_frame_activex_base.h30
-rw-r--r--chrome_frame/extra_system_apis.h31
-rw-r--r--chrome_frame/plugin_url_request.h6
-rw-r--r--chrome_frame/urlmon_url_request.cc66
-rw-r--r--chrome_frame/urlmon_url_request.h42
-rw-r--r--chrome_frame/utils.cc27
-rw-r--r--chrome_frame/utils.h8
10 files changed, 302 insertions, 16 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 3c10d15..fe9499d 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -398,6 +398,43 @@ STDMETHODIMP ChromeActiveDocument::GetAddressBarUrl(BSTR* url) {
return GetUrlForEvents(url);
}
+STDMETHODIMP ChromeActiveDocument::Reset() {
+ next_privacy_record_ = privacy_info_.privacy_records.begin();
+ return S_OK;
+}
+
+STDMETHODIMP ChromeActiveDocument::GetSize(unsigned long* size) {
+ if (!size)
+ return E_POINTER;
+
+ *size = privacy_info_.privacy_records.size();
+ return S_OK;
+}
+
+STDMETHODIMP ChromeActiveDocument::GetPrivacyImpacted(BOOL* privacy_impacted) {
+ if (!privacy_impacted)
+ return E_POINTER;
+
+ *privacy_impacted = privacy_info_.privacy_impacted;
+ return S_OK;
+}
+
+STDMETHODIMP ChromeActiveDocument::Next(BSTR* url, BSTR* policy,
+ long* reserved, unsigned long* flags) {
+ if (!url || !policy || !flags)
+ return E_POINTER;
+
+ if (next_privacy_record_ == privacy_info_.privacy_records.end())
+ return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
+
+ *url = SysAllocString(next_privacy_record_->first.c_str());
+ *policy = SysAllocString(next_privacy_record_->second.policy_ref.c_str());
+ *flags = next_privacy_record_->second.flags;
+
+ next_privacy_record_++;
+ return S_OK;
+}
+
HRESULT ChromeActiveDocument::IOleObject_SetClientSite(
IOleClientSite* client_site) {
if (client_site == NULL) {
@@ -421,13 +458,13 @@ HRESULT ChromeActiveDocument::IOleObject_SetClientSite(
in_place_frame_.Release();
}
- if (client_site != m_spClientSite)
+ if (client_site != m_spClientSite) {
return Base::IOleObject_SetClientSite(client_site);
+ }
return S_OK;
}
-
HRESULT ChromeActiveDocument::ActiveXDocActivate(LONG verb) {
HRESULT hr = S_OK;
m_bNegotiatedWnd = TRUE;
@@ -721,6 +758,12 @@ void ChromeActiveDocument::OnDetermineSecurityZone(const GUID* cmd_group_guid,
}
}
+void ChromeActiveDocument::OnDisplayPrivacyInfo() {
+ privacy_info_ = url_fetcher_.privacy_info();
+ Reset();
+ DoPrivacyDlg(m_hWnd, url_, this, TRUE);
+}
+
void ChromeActiveDocument::OnOpenURL(int tab_handle,
const GURL& url_to_open,
const GURL& referrer,
@@ -1098,3 +1141,31 @@ LRESULT ChromeActiveDocument::OnBack(WORD notify_code, WORD id,
return 0;
}
+LRESULT ChromeActiveDocument::OnFirePrivacyChange(UINT message, WPARAM wparam,
+ LPARAM lparam,
+ BOOL& handled) {
+ if (!m_spClientSite)
+ return 0;
+
+ ScopedComPtr<IWebBrowser2> web_browser2;
+ DoQueryService(SID_SWebBrowserApp, m_spClientSite,
+ web_browser2.Receive());
+ if (!web_browser2) {
+ NOTREACHED() << "Failed to retrieve IWebBrowser2 interface.";
+ return 0;
+ }
+
+ ScopedComPtr<IShellBrowser> shell_browser;
+ DoQueryService(SID_STopLevelBrowser, web_browser2,
+ shell_browser.Receive());
+ DCHECK(shell_browser.get() != NULL);
+ ScopedComPtr<ITridentService2> trident_services;
+ trident_services.QueryFrom(shell_browser);
+ if (trident_services) {
+ trident_services->FirePrivacyImpactedStateChange(wparam);
+ } else {
+ NOTREACHED() << "Failed to retrieve IWebBrowser2 interface.";
+ }
+ return 0;
+}
+
diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h
index 2e8840c..56e1822 100644
--- a/chrome_frame/chrome_active_document.h
+++ b/chrome_frame/chrome_active_document.h
@@ -8,6 +8,7 @@
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
+#include <htiframe.h>
#include <map>
#include <mshtmcid.h>
#include <perhist.h>
@@ -25,6 +26,7 @@
#include "chrome_frame/ole_document_impl.h"
#include "chrome_frame/resource.h"
#include "chrome_frame/extra_system_apis.h"
+#include "chrome_frame/utils.h"
class Thread;
class TabProxy;
@@ -66,6 +68,8 @@ class ChromeActiveDocument;
// document cannot perform its own navigation.)
#define DOCHOST_DOCCANNAVIGATE (0)
+#define DOCHOST_DISPLAY_PRIVACY (75)
+
// This macro should be defined in the public section of the class.
#define BEGIN_EXEC_COMMAND_MAP(theClass) \
public: \
@@ -121,11 +125,13 @@ class ATL_NO_VTABLE ChromeActiveDocument
public InPlaceMenu<ChromeActiveDocument>,
public IWebBrowserEventsUrlService,
public IPersistHistory,
+ public IEnumPrivacyRecords,
public HTMLWindowImpl<IHTMLWindow2>,
public HTMLPrivateWindowImpl<IHTMLPrivateWindow> {
public:
typedef ChromeFrameActivexBase<ChromeActiveDocument,
CLSID_ChromeActiveDocument> Base;
+
ChromeActiveDocument();
~ChromeActiveDocument();
@@ -142,10 +148,12 @@ BEGIN_COM_MAP(ChromeActiveDocument)
COM_INTERFACE_ENTRY(IHTMLFramesCollection2)
COM_INTERFACE_ENTRY(IHTMLWindow2)
COM_INTERFACE_ENTRY(IHTMLPrivateWindow)
+ COM_INTERFACE_ENTRY(IEnumPrivacyRecords)
COM_INTERFACE_ENTRY_CHAIN(Base)
END_COM_MAP()
BEGIN_MSG_MAP(ChromeActiveDocument)
+ MESSAGE_HANDLER(WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, OnFirePrivacyChange)
COMMAND_ID_HANDLER(IDC_FORWARD, OnForward)
COMMAND_ID_HANDLER(IDC_BACK, OnBack)
CHAIN_MSG_MAP(Base)
@@ -177,6 +185,8 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument)
EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT3, SetPageFontSize)
EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT4, SetPageFontSize)
EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT5, SetPageFontSize)
+ EXEC_COMMAND_HANDLER_NO_ARGS(&CGID_ShellDocView, DOCHOST_DISPLAY_PRIVACY,
+ OnDisplayPrivacyInfo)
END_EXEC_COMMAND_MAP()
// IPCs from automation server.
@@ -248,6 +258,13 @@ END_EXEC_COMMAND_MAP()
// ChromeFramePlugin overrides.
virtual void OnAutomationServerReady();
+ // IEnumPrivacyRecords
+ STDMETHOD(Reset)();
+ STDMETHOD(GetSize)(unsigned long* size);
+ STDMETHOD(GetPrivacyImpacted)(BOOL* privacy_impacted);
+ STDMETHOD(Next)(BSTR* url, BSTR* policy, long* reserved,
+ unsigned long* flags);
+
protected:
// ChromeFrameActivexBase overrides
virtual void OnOpenURL(int tab_handle, const GURL& url_to_open,
@@ -273,6 +290,7 @@ END_EXEC_COMMAND_MAP()
void OnDetermineSecurityZone(const GUID* cmd_group_guid, DWORD command_id,
DWORD cmd_exec_opt, VARIANT* in_args,
VARIANT* out_args);
+ void OnDisplayPrivacyInfo();
// Call exec on our site's command target
HRESULT IEExec(const GUID* cmd_group_guid, DWORD command_id,
@@ -312,6 +330,9 @@ END_EXEC_COMMAND_MAP()
LRESULT OnBack(WORD notify_code, WORD id, HWND control_window,
BOOL& bHandled);
+ LRESULT OnFirePrivacyChange(UINT message, WPARAM wparam, LPARAM lparam,
+ BOOL& handled);
+
protected:
typedef std::map<int, bool> EnabledCommandsMap;
@@ -339,6 +360,13 @@ END_EXEC_COMMAND_MAP()
bool popup_allowed_;
HACCEL accelerator_table_;
+ // Contains privacy data retrieved from the UrlmonUrlRequestManager. This
+ // is used to return privacy data in response to the View->Privacy policy
+ // command.
+ UrlmonUrlRequestManager::PrivacyInfo privacy_info_;
+ UrlmonUrlRequestManager::PrivacyInfo::PrivacyRecords::iterator
+ next_privacy_record_;
+
public:
ScopedComPtr<IOleInPlaceFrame> in_place_frame_;
OLEINPLACEFRAMEINFO frame_info_;
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index 6b5ec4d..36c2e62 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -712,6 +712,11 @@
'crash_reporting/crash_reporting.gyp:crash_report',
'crash_reporting/crash_reporting.gyp:vectored_handler_tests',
],
+ 'link_settings': {
+ 'libraries': [
+ '-lshdocvw.lib',
+ ],
+ },
'msvs_settings': {
'VCLinkerTool': {
'OutputFile':
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index c585766..a8191a9 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -428,9 +428,14 @@ END_MSG_MAP()
data = cookie;
}
- BOOL ret = InternetSetCookieA(url.spec().c_str(), name.c_str(),
- data.c_str());
- DCHECK(ret) << "InternetSetcookie failed. Error: " << GetLastError();
+ int32 flags = INTERNET_COOKIE_EVALUATE_P3P;
+
+ InternetCookieState cookie_state = static_cast<InternetCookieState>(
+ InternetSetCookieExA(url.spec().c_str(), name.c_str(), data.c_str(),
+ flags, NULL));
+
+ int32 cookie_action = MapCookieStateToCookieAction(cookie_state);
+ url_fetcher_.AddPrivacyDataForUrl(url.spec(), "", cookie_action);
}
virtual void OnGetCookiesFromHost(int tab_handle, const GURL& url,
@@ -438,19 +443,25 @@ END_MSG_MAP()
DWORD cookie_size = 0;
bool success = true;
std::string cookie_string;
- InternetGetCookieA(url.spec().c_str(), NULL, NULL, &cookie_size);
+
+ int32 cookie_action = COOKIEACTION_READ;
+ BOOL result = InternetGetCookieA(url.spec().c_str(), NULL, NULL,
+ &cookie_size);
+ DWORD error = 0;
if (cookie_size) {
scoped_array<char> cookies(new char[cookie_size + 1]);
if (!InternetGetCookieA(url.spec().c_str(), NULL, cookies.get(),
&cookie_size)) {
success = false;
- NOTREACHED() << "InternetGetCookie failed. Error: " << GetLastError();
+ error = GetLastError();
+ NOTREACHED() << "InternetGetCookie failed. Error: " << error;
} else {
cookie_string = cookies.get();
}
} else {
success = false;
- DLOG(INFO) << "InternetGetCookie failed. Error: " << GetLastError();
+ error = GetLastError();
+ DLOG(INFO) << "InternetGetCookie failed. Error: " << error;
}
if (automation_client_->automation_server()) {
@@ -459,6 +470,11 @@ END_MSG_MAP()
url, cookie_string,
cookie_id));
}
+
+ if (!success && !error)
+ cookie_action = COOKIEACTION_SUPPRESS;
+
+ url_fetcher_.AddPrivacyDataForUrl(url.spec(), "", cookie_action);
}
virtual void OnAttachExternalTab(int tab_handle,
@@ -480,7 +496,7 @@ END_MSG_MAP()
LRESULT OnCreate(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled) { // NO_LINT
ModifyStyle(0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0);
- url_fetcher_.SetErrorDialogsParentWindow(m_hWnd);
+ url_fetcher_.put_notification_window(m_hWnd);
automation_client_->SetParentWindow(m_hWnd);
// Only fire the 'interactive' ready state if we aren't there already.
if (ready_state_ < READYSTATE_INTERACTIVE) {
diff --git a/chrome_frame/extra_system_apis.h b/chrome_frame/extra_system_apis.h
index 93aad26..6a53bd6 100644
--- a/chrome_frame/extra_system_apis.h
+++ b/chrome_frame/extra_system_apis.h
@@ -84,6 +84,37 @@ IDocObjectService : public IUnknown {
STDMETHOD(IsErrorUrl)(LPCTSTR url, BOOL* is_error) = 0;
};
+// This interface is used to notify the shellbrowser about events.
+interface __declspec(uuid("f62d9369-75ef-4578-8856-232802c76468"))
+ITridentService2 : public IUnknown {
+ STDMETHOD(FireBeforeNavigate2)(IDispatch* dispatch,
+ LPCTSTR url, DWORD flags, LPCTSTR frame_name, BYTE* post_data,
+ DWORD post_data_len, LPCTSTR headers, BOOL play_nav_sound,
+ BOOL* cancel) = 0;
+ STDMETHOD(FireNavigateComplete2)(IHTMLWindow2*, uint32);
+ STDMETHOD(FireDownloadBegin)(VOID);
+ STDMETHOD(FireDownloadComplete)(VOID);
+ STDMETHOD(FireDocumentComplete)(IHTMLWindow2*, uint32);
+ STDMETHOD(UpdateDesktopComponent)(IHTMLWindow2*);
+ STDMETHOD(GetPendingUrl)(uint16**);
+ STDMETHOD(ActiveElementChanged)(IHTMLElement*);
+ STDMETHOD(GetUrlSearchComponent)(uint16**);
+ STDMETHOD(IsErrorUrl)(uint16 const*, int32*);
+ STDMETHOD(AttachMyPics)(VOID *, VOID**);
+ STDMETHOD(ReleaseMyPics)(VOID*);
+ STDMETHOD(IsGalleryMeta)(int32, VOID*);
+ STDMETHOD(EmailPicture)(uint16*);
+ STDMETHOD(FireNavigateError)(IHTMLWindow2*,
+ uint16*,
+ uint16*,
+ uint32, int*);
+ STDMETHOD(FirePrintTemplateEvent)(IHTMLWindow2*, int32);
+ STDMETHOD(FireUpdatePageStatus)(IHTMLWindow2*, uint32, int32);
+ STDMETHOD(FirePrivacyImpactedStateChange)(int32 privacy_violated);
+ STDMETHOD(InitAutoImageResize)(VOID);
+ STDMETHOD(UnInitAutoImageResize)(VOID);
+};
+
// Flags for ITravelLogEx::CountEntryNodes, CreateEnumEntry.
#define TLEF_RELATIVE_INCLUDE_CURRENT (0x01) // count the current entry
#define TLEF_RELATIVE_BACK (0x10) // count backward entries
diff --git a/chrome_frame/plugin_url_request.h b/chrome_frame/plugin_url_request.h
index ffe0c73..a2b6ffe 100644
--- a/chrome_frame/plugin_url_request.h
+++ b/chrome_frame/plugin_url_request.h
@@ -27,7 +27,11 @@ class DECLSPEC_NOVTABLE PluginUrlRequestDelegate {
const char* headers, int size, base::Time last_modified,
const std::string& redirect_url, int redirect_status) = 0;
virtual void OnReadComplete(int request_id, const void* buffer, int len) = 0;
- virtual void OnResponseEnd(int request_id, const URLRequestStatus& status) = 0;
+ virtual void OnResponseEnd(int request_id,
+ const URLRequestStatus& status) = 0;
+ virtual void AddPrivacyDataForUrl(const std::string& url,
+ const std::string& policy_ref,
+ int32 flags) {}
protected:
PluginUrlRequestDelegate() {}
~PluginUrlRequestDelegate() {}
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);
+ }
}
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h
index 5382314..38ba257 100644
--- a/chrome_frame/urlmon_url_request.h
+++ b/chrome_frame/urlmon_url_request.h
@@ -46,6 +46,23 @@ class UrlmonUrlRequestManager
: public PluginUrlRequestManager,
public PluginUrlRequestDelegate {
public:
+ // Contains the privacy information for all requests issued by this instance.
+ struct PrivacyInfo {
+ public:
+ struct PrivacyEntry {
+ PrivacyEntry() : flags(0) {}
+ std::wstring policy_ref;
+ int32 flags;
+ };
+
+ typedef std::map<std::wstring, PrivacyEntry> PrivacyRecords;
+
+ PrivacyInfo() : privacy_impacted(false) {}
+
+ bool privacy_impacted;
+ PrivacyRecords privacy_records;
+ };
+
UrlmonUrlRequestManager();
~UrlmonUrlRequestManager();
@@ -53,7 +70,22 @@ class UrlmonUrlRequestManager
// Used from ChromeActiveDocument's implementation of IPersistMoniker::Load().
void UseRequestDataForUrl(RequestData* data, const std::wstring& url);
void StealMonikerFromRequest(int request_id, IMoniker** moniker);
- void SetErrorDialogsParentWindow(HWND window);
+
+ // Returns a copy of the url privacy information for this instance.
+ PrivacyInfo privacy_info() {
+ AutoLock lock(privacy_info_lock_);
+ return privacy_info_;
+ }
+
+ virtual void AddPrivacyDataForUrl(const std::string& url,
+ const std::string& policy_ref,
+ int32 flags);
+
+ // This function passes the window on which notifications are to be fired.
+ void put_notification_window(HWND window) {
+ notification_window_ = window;
+ }
+
private:
friend class MessageLoop;
friend struct RunnableMethodTraits<UrlmonUrlRequestManager>;
@@ -98,7 +130,13 @@ class UrlmonUrlRequestManager
base::WaitableEvent map_empty_;
bool stopping_;
Lock worker_thread_access_;
- HWND err_dialog_parent_wnd_;
+
+ // This lock is used to synchronize access to the PrivacyInfo data structure
+ // as it can be accessed from the ui thread and the worker thread.
+ Lock privacy_info_lock_;
+ PrivacyInfo privacy_info_;
+ // The window to be used to fire notifications on.
+ HWND notification_window_;
};
#endif // CHROME_FRAME_URLMON_URL_REQUEST_H_
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 4e6b843..bec0595 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -902,3 +902,30 @@ std::wstring GuidToString(const GUID& guid) {
::StringFromGUID2(guid, WriteInto(&ret, 39), 39);
return ret;
}
+
+int32 MapCookieStateToCookieAction(InternetCookieState cookie_state) {
+ int32 cookie_action = COOKIEACTION_NONE;
+
+ switch (cookie_state) {
+ case COOKIE_STATE_UNKNOWN:
+ cookie_action = COOKIEACTION_NONE;
+ break;
+ case COOKIE_STATE_ACCEPT:
+ cookie_action = COOKIEACTION_ACCEPT;
+ break;
+ case COOKIE_STATE_LEASH:
+ cookie_action = COOKIEACTION_LEASH;
+ break;
+ case COOKIE_STATE_DOWNGRADE:
+ cookie_action = COOKIEACTION_DOWNGRADE;
+ break;
+ case COOKIE_STATE_REJECT:
+ cookie_action = COOKIEACTION_REJECT;
+ break;
+ default:
+ cookie_action = COOKIEACTION_REJECT;
+ break;
+ }
+ return cookie_action;
+}
+
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h
index 6209248..ace15ae 100644
--- a/chrome_frame/utils.h
+++ b/chrome_frame/utils.h
@@ -9,6 +9,7 @@
#include <string>
#include <shdeprecated.h>
#include <urlmon.h>
+#include <wininet.h>
#include "base/basictypes.h"
#include "base/histogram.h"
@@ -386,4 +387,11 @@ extern Lock g_ChromeFrameHistogramLock;
UMA_HISTOGRAM_TIMES(name, sample); \
}
+// Fired when we want to notify IE about privacy changes.
+#define WM_FIRE_PRIVACY_CHANGE_NOTIFICATION (WM_APP + 1)
+
+// Maps the InternetCookieState enum to the corresponding CookieAction values
+// used for IE privacy stuff.
+int32 MapCookieStateToCookieAction(InternetCookieState cookie_state);
+
#endif // CHROME_FRAME_UTILS_H_