diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 17:12:55 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 17:12:55 +0000 |
commit | e6f546c3ab626d39d375376890b7f4bfef92f48e (patch) | |
tree | cbf7b1218db462116ea45f8536ee0900cb1f9ea6 /webkit/api | |
parent | 0e2dc851dc1ba72d849d22eba47ea053b2721916 (diff) | |
download | chromium_src-e6f546c3ab626d39d375376890b7f4bfef92f48e.zip chromium_src-e6f546c3ab626d39d375376890b7f4bfef92f48e.tar.gz chromium_src-e6f546c3ab626d39d375376890b7f4bfef92f48e.tar.bz2 |
Add Reload and LoadData methods to WebFrame. LoadData replaces
LoadAlternateHTMLString, changing types to WebKit API types and
allowing for more flexibility (supports loading non-HTML data).
LoadHTMLString is modified to support some optional parameters.
Note: Since WebFrame is going to soon be part of the WebKit API,
it is OK style-wise for it to use optional parameters.
This patch also includes a change to remove the securityInfo
property from WebURLRequest. I did this so that I could eliminate
the need to pass a WebURLRequest to LoadData / LoadHTMLString.
This also fixes a TODO of mine to eliminate this field on
WebCore::ResourceRequest since securityInfo (SSL cert info) is
really more of a response property. It was only part of the
request as a hack to support certain error pages. I work around
that by leveraging NavigationState in chrome/renderer.
I added some templatized, implicit constructors to WebData for
convenience. I plan to make similar changes to WebCString and
WebString in a future CL.
This CL is a incremental step toward moving ResourceFetcher out
of WebFrame.
BUG=15648
TEST=none
R=dglazkov
Review URL: http://codereview.chromium.org/150146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/api')
-rw-r--r-- | webkit/api/public/WebData.h | 25 | ||||
-rw-r--r-- | webkit/api/public/WebFrame.h | 17 | ||||
-rw-r--r-- | webkit/api/public/WebURLRequest.h | 6 | ||||
-rw-r--r-- | webkit/api/src/WebURLRequest.cpp | 10 |
4 files changed, 33 insertions, 25 deletions
diff --git a/webkit/api/public/WebData.h b/webkit/api/public/WebData.h index 2666789..ad14fa1 100644 --- a/webkit/api/public/WebData.h +++ b/webkit/api/public/WebData.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -57,6 +57,12 @@ namespace WebKit { assign(data, size); } + template <int N> + WebData(const char (&data)[N]) : m_private(0) + { + assign(data, N - 1); + } + WebData(const WebData& d) : m_private(0) { assign(d); } WebData& operator=(const WebData& d) @@ -79,6 +85,19 @@ namespace WebKit { WebData(const WTF::PassRefPtr<WebCore::SharedBuffer>&); WebData& operator=(const WTF::PassRefPtr<WebCore::SharedBuffer>&); operator WTF::PassRefPtr<WebCore::SharedBuffer>() const; +#else + template <class C> + WebData(const C& c) : m_private(0) + { + assign(c.data(), c.size()); + } + + template <class C> + WebData& operator=(const C& c) + { + assign(c.data(), c.size()); + return *this; + } #endif private: diff --git a/webkit/api/public/WebFrame.h b/webkit/api/public/WebFrame.h index be58d6c..fa7e5f5 100644 --- a/webkit/api/public/WebFrame.h +++ b/webkit/api/public/WebFrame.h @@ -158,18 +158,23 @@ namespace WebKit { // Navigation ---------------------------------------------------------- - virtual void loadURL(const WebURLRequest&) = 0; + virtual void reload() = 0; + + virtual void loadRequest(const WebURLRequest&) = 0; + + virtual void loadHistoryItem(const WebHistoryItem&) = 0; virtual void loadData(const WebData& data, const WebString& mimeType, const WebString& textEncoding, const WebURL& baseURL, - const WebURL& unreachableURL, - bool replace) = 0; + const WebURL& unreachableURL = WebURL(), + bool replace = false) = 0; - virtual void loadHistorical(const WebHistoryItem&) = 0; - - virtual void reload() = 0; + virtual void loadHTMLString(const WebData& html, + const WebURL& baseURL, + const WebURL& unreachableURL = WebURL(), + bool replace = false) = 0; virtual bool isLoading() = 0; diff --git a/webkit/api/public/WebURLRequest.h b/webkit/api/public/WebURLRequest.h index dcd580a..6499b85 100644 --- a/webkit/api/public/WebURLRequest.h +++ b/webkit/api/public/WebURLRequest.h @@ -125,12 +125,6 @@ namespace WebKit { WEBKIT_API int appCacheContextID() const; WEBKIT_API void setAppCacheContextID(int id); - // A consumer controlled value intended to be used to record opaque - // security info related to this request. - // FIXME: This really doesn't belong here! - WEBKIT_API WebCString securityInfo() const; - WEBKIT_API void setSecurityInfo(const WebCString&); - #if defined(WEBKIT_IMPLEMENTATION) WebCore::ResourceRequest& toMutableResourceRequest(); const WebCore::ResourceRequest& toResourceRequest() const; diff --git a/webkit/api/src/WebURLRequest.cpp b/webkit/api/src/WebURLRequest.cpp index 542dc23..4611872 100644 --- a/webkit/api/src/WebURLRequest.cpp +++ b/webkit/api/src/WebURLRequest.cpp @@ -209,16 +209,6 @@ void WebURLRequest::setAppCacheContextID(int appCacheContextID) m_private->m_resourceRequest->setAppCacheContextID(appCacheContextID); } -WebCString WebURLRequest::securityInfo() const -{ - return m_private->m_resourceRequest->securityInfo(); -} - -void WebURLRequest::setSecurityInfo(const WebCString& securityInfo) -{ - m_private->m_resourceRequest->setSecurityInfo(securityInfo); -} - ResourceRequest& WebURLRequest::toMutableResourceRequest() { ASSERT(m_private); |