summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-02 19:08:56 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-02 19:08:56 +0000
commit606843faf131685e7802df12f2ee97efc7cf2f3b (patch)
treef4d494147c9190ba22c370148ab5aab2020f6d1a /webkit
parent63e78057b6ae2685ed3525d832fed48b7c85ee1e (diff)
downloadchromium_src-606843faf131685e7802df12f2ee97efc7cf2f3b.zip
chromium_src-606843faf131685e7802df12f2ee97efc7cf2f3b.tar.gz
chromium_src-606843faf131685e7802df12f2ee97efc7cf2f3b.tar.bz2
Remove the URL and title from the state getting functions and IPC messages.
If the title or URL changes, we'll be updated in other ways, so this extra processing is wasted. Review URL: http://codereview.chromium.org/12859 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webframe.h24
-rw-r--r--webkit/glue/webframe_impl.cc14
-rw-r--r--webkit/glue/webframe_impl.h8
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc8
4 files changed, 21 insertions, 33 deletions
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h
index 7c6c1fc..2edc1eb 100644
--- a/webkit/glue/webframe.h
+++ b/webkit/glue/webframe.h
@@ -99,21 +99,25 @@ class WebFrame : public base::RefCounted<WebFrame> {
const GURL& script_url) = 0;
// Returns a string representing the state of the previous page load for
- // later use when loading as well as the uri and title of the page. The
- // previous page is the page that was loaded before DidCommitLoadForFrame was
- // received. Returns false if there is no state.
- virtual bool GetPreviousState(GURL* url, std::wstring* title,
- std::string* history_state) const = 0;
+ // later use when loading. The previous page is the page that was loaded
+ // before DidCommitLoadForFrame was received.
+ //
+ // Returns false if there is no valid state to return (for example, there is
+ // no previous item). Returns true if the previous item's state was retrieved,
+ // even if that state may be empty.
+ virtual bool GetPreviousHistoryState(std::string* history_state) const = 0;
// Returns a string representing the state of the current page load for later
- // use when loading as well as the url and title of the page. Returns false
- // if there is no state.
- virtual bool GetCurrentState(GURL* url, std::wstring* title,
- std::string* history_state) const = 0;
+ // use when loading as well as the url and title of the page.
+ //
+ // Returns false if there is no valid state to return (for example, there is
+ // no previous item). Returns true if the current item's state was retrieved,
+ // even if that state may be empty.
+ virtual bool GetCurrentHistoryState(std::string* history_state) const = 0;
// Returns true if there is a current history item. A newly created WebFrame
// lacks a history item. Otherwise, this will always be true.
- virtual bool HasCurrentState() const = 0;
+ virtual bool HasCurrentHistoryState() const = 0;
// Returns the current URL of the frame, or the empty string if there is no
// URL to retrieve (for example, the frame may never have had any content).
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 78ac3d4..d639558 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -477,8 +477,7 @@ GURL WebFrameImpl::GetOSDDURL() const {
return GURL();
}
-bool WebFrameImpl::GetPreviousState(GURL* url, std::wstring* title,
- std::string* history_state) const {
+bool WebFrameImpl::GetPreviousHistoryState(std::string* history_state) const {
// We use the previous item here because documentState (filled-out forms)
// only get saved to history when it becomes the previous item. The caller
// is expected to query the history state after a navigation occurs, after
@@ -494,14 +493,10 @@ bool WebFrameImpl::GetPreviousState(GURL* url, std::wstring* title,
StatsScope<StatsCounterTimer> history_scope(history_timer);
webkit_glue::HistoryItemToString(item, history_state);
- *url = webkit_glue::KURLToGURL(item->url());
- *title = webkit_glue::StringToStdWString(item->title());
-
return true;
}
-bool WebFrameImpl::GetCurrentState(GURL* url, std::wstring* title,
- std::string* state) const {
+bool WebFrameImpl::GetCurrentHistoryState(std::string* state) const {
if (frame_->loader())
frame_->loader()->saveDocumentAndScrollState();
RefPtr<HistoryItem> item = frame_->page()->backForwardList()->currentItem();
@@ -509,13 +504,10 @@ bool WebFrameImpl::GetCurrentState(GURL* url, std::wstring* title,
return false;
webkit_glue::HistoryItemToString(item, state);
- *url = webkit_glue::KURLToGURL(item->url());
- *title = webkit_glue::StringToStdWString(item->title());
-
return true;
}
-bool WebFrameImpl::HasCurrentState() const {
+bool WebFrameImpl::HasCurrentHistoryState() const {
return frame_->page()->backForwardList()->currentItem() != NULL;
}
diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h
index 61c9851..635b396 100644
--- a/webkit/glue/webframe_impl.h
+++ b/webkit/glue/webframe_impl.h
@@ -97,11 +97,9 @@ class WebFrameImpl : public WebFrame {
const GURL& fake_url);
virtual void ExecuteJavaScript(const std::string& js_code,
const GURL& script_url);
- virtual bool GetPreviousState(GURL* url, std::wstring* title,
- std::string* history_state) const;
- virtual bool GetCurrentState(GURL* url, std::wstring* title,
- std::string* history_state) const;
- virtual bool HasCurrentState() const;
+ virtual bool GetPreviousHistoryState(std::string* history_state) const;
+ virtual bool GetCurrentHistoryState(std::string* history_state) const;
+ virtual bool HasCurrentHistoryState() const;
virtual GURL GetURL() const;
virtual GURL GetFavIconURL() const;
virtual GURL GetOSDDURL() const;
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 3adcf08..17d3786 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -763,15 +763,9 @@ void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) {
if (!entry)
return;
- GURL url;
- std::wstring title;
std::string state;
- if (!shell_->webView()->GetMainFrame()->
- GetPreviousState(&url, &title, &state))
+ if (!shell_->webView()->GetMainFrame()->GetPreviousHistoryState(&state))
return;
-
- entry->SetURL(url);
- entry->SetTitle(title);
entry->SetContentState(state);
}