diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 21:15:15 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 21:15:15 +0000 |
commit | c4e45b3be08a8cefa237b25096f8a18fb5a5051d (patch) | |
tree | c6cb1e682bfde672b293406f8c6ea508694f3979 /chrome_frame/utils.h | |
parent | 437d1c7f6cf70dbdc3d008745d974714db7dd68a (diff) | |
download | chromium_src-c4e45b3be08a8cefa237b25096f8a18fb5a5051d.zip chromium_src-c4e45b3be08a8cefa237b25096f8a18fb5a5051d.tar.gz chromium_src-c4e45b3be08a8cefa237b25096f8a18fb5a5051d.tar.bz2 |
Ensure that window.open requests issued by ChromeFrame carry the correct cookies in the outgoing HTTP requests.
To achieve this we no longer issue navigations with the gcf:attach* prefix. We now issue a navigation to the current
page URL with the attach external tab suffix, which indicates that the page is forced into ChromeFrame without making
an actual HTTP request. This ensures that the new IE8 process has access to all HTTP cookies.
We need to patch IInternetProtocol::LockRequest and UnlockRequest to not call the underlying implementations for our
dummy request as this crashes in IE8 in the prebinding code path.
Fixes bug http://b/issue?id=2277519
Added tests for the CanNavigateFullTabMode helper function.
Bug=2277519
Review URL: http://codereview.chromium.org/3051018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.h')
-rw-r--r-- | chrome_frame/utils.h | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index b40a741..beb7fa1 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -30,6 +30,7 @@ extern const wchar_t kChromeFrameUnpinnedMode[]; extern const wchar_t kEnableGCFProtocol[]; extern const wchar_t kEnableBuggyBhoIntercept[]; extern const wchar_t kChromeMimeType[]; +extern const wchar_t kChromeFrameAttachTabPattern[]; typedef enum ProtocolPatchMethod { PATCH_METHOD_IBROWSER = 0, @@ -472,13 +473,58 @@ std::string Bscf2Str(DWORD flags); // Reads data from a stream into a string. HRESULT ReadStream(IStream* stream, size_t size, std::string* data); -// Parses the attach external tab url, which comes in from Chrome in the course -// of a window.open operation. The format of this URL is as below:- -// gcf:attach_external_tab&n1&n2&x&y&width&height -// n1 -> cookie, n2 -> disposition, x, y, width, height -> dimensions of the -// window. -// Returns true on success. -bool ParseAttachExternalTabUrl(const std::wstring& url, uint64* cookie, - gfx::Rect* dimensions, int* disposition); +// Parses urls targetted at ChromeFrame. This class maintains state like +// whether a url is prefixed with the gcf: prefix, whether it is being +// attached to an existing external tab, etc. +class ChromeFrameUrl { + public: + ChromeFrameUrl(); + + // Parses the url passed in. Returns true on success. + bool Parse(const std::wstring& url); + + bool is_chrome_protocol() const { + return is_chrome_protocol_; + } + + bool attach_to_external_tab() const { + return attach_to_external_tab_; + } + + uint64 cookie() const { + return cookie_; + } + + int disposition() const { + return disposition_; + } + + const gfx::Rect& dimensions() const { + return dimensions_; + } + + const std::wstring& url() const { + return url_; + } + + private: + // If we are attaching to an existing external tab, this function parses the + // suffix portion of the URL which contains the attach_external_tab prefix. + bool ParseAttachExternalTabUrl(); + + bool attach_to_external_tab_; + bool is_chrome_protocol_; + std::wstring url_; + uint64 cookie_; + gfx::Rect dimensions_; + int disposition_; +}; + +// Returns true if we can navigate to this URL. +// This function checks if the url scheme is valid for navigation within +// chrome and whether it is a restricted URL as per IE settings. In either of +// these cases it returns false. +bool CanNavigateInFullTabMode(const ChromeFrameUrl& cf_url, + IInternetSecurityManager* security_manager); #endif // CHROME_FRAME_UTILS_H_ |