summaryrefslogtreecommitdiffstats
path: root/content/shell/webkit_test_controller.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 22:52:04 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 22:52:04 +0000
commit691aa2f403e454c0590ccdab2cf4a7c3d7e1fae0 (patch)
tree86c86e4f5c9168b2efc48415d9a2ccab3946869d /content/shell/webkit_test_controller.cc
parent2d174304df035f99c737ff10a1a1be1485b30f70 (diff)
downloadchromium_src-691aa2f403e454c0590ccdab2cf4a7c3d7e1fae0.zip
chromium_src-691aa2f403e454c0590ccdab2cf4a7c3d7e1fae0.tar.gz
chromium_src-691aa2f403e454c0590ccdab2cf4a7c3d7e1fae0.tar.bz2
Introduce content::PageState (again).
This is a concrete class wrapping a string that contains the data of a serialized WebKit::WebHistoryItem class. Previously, we've just passed around these as strings, giving them names like "state", "content_state" or "history_state". It has been hard to identify all of the places in the code where these strings get passed around. A concrete class should make usage more apparent. Plus, instead of manipulating the strings using methods from webkit/glue/glue_serialize.h, we can just declare methods on the PageState class. This makes the code much cleaner. This first pass just implements PageState in terms of glue_serialize. It also adds content/public/renderer/history_item_serialization.h as the home for PageState to WebKit::WebHistoryItem conversion, which should ideally only be usable from the renderer process. (This bit is a step toward resolving bug 237243.) page_state.h declares operator==() to support DCHECK_EQ, which seems consistent with the idea of PageState being a replacement for std::string. I didn't want to litter tests with calls to PageState::ToEncodedData(). That would get cumbersome. Originally reviewed at: https://codereview.chromium.org/14985014 The only difference is that page_state.cc is now split into two pieces: page_state.cc and page_state_webkit.cc. The second holds the definition of all methods that depend on webkit/glue. That way code like Chrome Frame and the iOS port of Chromium can use PageState without pulling in a dependency on webkit/glue at link time. BUG=240426 R=brettw@chromium.org, grt@chromium.org, joth@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/16162003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/webkit_test_controller.cc')
-rw-r--r--content/shell/webkit_test_controller.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/content/shell/webkit_test_controller.cc b/content/shell/webkit_test_controller.cc
index fb3214d..9c537fe 100644
--- a/content/shell/webkit_test_controller.cc
+++ b/content/shell/webkit_test_controller.cc
@@ -29,7 +29,6 @@
#include "content/shell/shell.h"
#include "content/shell/shell_browser_context.h"
#include "content/shell/shell_content_browser_client.h"
-#include "webkit/glue/glue_serialize.h"
#include "webkit/support/webkit_support_gfx.h"
namespace content {
@@ -568,7 +567,7 @@ void WebKitTestController::OnLoadURLForFrame(const GURL& url,
void WebKitTestController::OnCaptureSessionHistory() {
std::vector<int> routing_ids;
- std::vector<std::vector<std::string> > session_histories;
+ std::vector<std::vector<PageState> > session_histories;
std::vector<unsigned> current_entry_indexes;
RenderViewHost* render_view_host =
@@ -590,13 +589,13 @@ void WebKitTestController::OnCaptureSessionHistory() {
routing_ids.push_back(web_contents->GetRenderViewHost()->GetRoutingID());
current_entry_indexes.push_back(
web_contents->GetController().GetCurrentEntryIndex());
- std::vector<std::string> history;
+ std::vector<PageState> history;
for (int entry = 0; entry < web_contents->GetController().GetEntryCount();
++entry) {
- std::string state = web_contents->GetController().GetEntryAtIndex(entry)
- ->GetContentState();
- if (state.empty()) {
- state = webkit_glue::CreateHistoryStateForURL(
+ PageState state = web_contents->GetController().GetEntryAtIndex(entry)->
+ GetPageState();
+ if (!state.IsValid()) {
+ state = PageState::CreateFromURL(
web_contents->GetController().GetEntryAtIndex(entry)->GetURL());
}
history.push_back(state);