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/tools | |
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/tools')
-rw-r--r-- | webkit/tools/test_shell/plugin_tests.cc | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 18 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 13 |
3 files changed, 13 insertions, 21 deletions
diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc index f739aec..a0951c9 100644 --- a/webkit/tools/test_shell/plugin_tests.cc +++ b/webkit/tools/test_shell/plugin_tests.cc @@ -10,8 +10,9 @@ #include "base/string_util.h" #include "net/base/escape.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/api/public/WebScriptSource.h" +#include "webkit/api/public/WebData.h" #include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebScriptSource.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webview.h" #include "webkit/tools/test_shell/test_shell.h" diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 568f401..b2249a6 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -526,23 +526,15 @@ bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) { // If we are reloading, then WebKit will use the state of the current page. // Otherwise, we give it the state to navigate to. - if (!reload && !entry.GetContentState().empty()) { + if (reload) { + frame->Reload(); + } else if (!entry.GetContentState().empty()) { DCHECK(entry.GetPageID() != -1); frame->LoadHistoryItem( webkit_glue::HistoryItemFromString(entry.GetContentState())); } else { - WebURLRequest::CachePolicy cache_policy; - if (reload) { - cache_policy = WebURLRequest::ReloadIgnoringCacheData; - } else { - DCHECK(entry.GetPageID() == -1); - cache_policy = WebURLRequest::UseProtocolCachePolicy; - } - - WebURLRequest request(entry.GetURL()); - request.setCachePolicy(cache_policy); - - frame->LoadRequest(request); + DCHECK(entry.GetPageID() == -1); + frame->LoadRequest(WebURLRequest(entry.GetURL())); } // In case LoadRequest failed before DidCreateDataSource was called. diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 912b937..b97c923 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -18,6 +18,7 @@ #include "base/string_util.h" #include "base/trace_event.h" #include "net/base/net_errors.h" +#include "webkit/api/public/WebData.h" #include "webkit/api/public/WebDataSource.h" #include "webkit/api/public/WebDragData.h" #include "webkit/api/public/WebHistoryItem.h" @@ -50,6 +51,7 @@ #include "webkit/tools/test_shell/drop_delegate.h" #endif +using WebKit::WebData; using WebKit::WebDataSource; using WebKit::WebDragData; using WebKit::WebHistoryItem; @@ -342,18 +344,15 @@ void TestWebViewDelegate::DidFailProvisionalLoadWithError( static_cast<TestShellExtraData*>(failed_ds->extraData()); bool replace = extra_data && extra_data->pending_page_id != -1; - WebURLRequest request = failed_ds->request(); - - std::string error_text = + const std::string& error_text = StringPrintf("Error %d when loading url %s", error.reason, - request.url().spec().data()); - request.setURL(GURL("testshell-error:")); + failed_ds->request().url().spec().data()); // Make sure we never show errors in view source mode. frame->SetInViewSourceMode(false); - frame->LoadAlternateHTMLString( - request, error_text, error.unreachableURL, replace); + frame->LoadHTMLString( + error_text, GURL("testshell-error:"), error.unreachableURL, replace); } void TestWebViewDelegate::DidCommitLoadForFrame(WebView* webview, |