summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser_commands.cc
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-26 02:02:18 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-26 02:02:18 +0000
commite0185f9fe7ba991f701ac7bb6d8dbafa745a31ab (patch)
treed43a5f87c837ba410e30e0d9095f1cd3e1a9c95c /chrome/browser/ui/browser_commands.cc
parentd70d82db35eecb586629a05bffc580282c0c30b4 (diff)
downloadchromium_src-e0185f9fe7ba991f701ac7bb6d8dbafa745a31ab.zip
chromium_src-e0185f9fe7ba991f701ac7bb6d8dbafa745a31ab.tar.gz
chromium_src-e0185f9fe7ba991f701ac7bb6d8dbafa745a31ab.tar.bz2
Revert 202188 "Introduce content::PageState."
This change bloated npchrome_frame.dll (see http://build.chromium.org/f/chromium/perf/xp-release/sizes/report.html?=undefined&history=3&rev=202214&graph=npchrome_frame.dll) because content_common.lib's common_param_traits.obj depends on content_common.lib's page_state.obj which, in turn, depends on webkit. This means that consumers of IPC messages in content_common suddenly require all of webkit. > Introduce content::PageState. > > 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. > > BUG=240426 > R=brettw@chromium.org, tsepez@chromium.org > > Review URL: https://codereview.chromium.org/14985014 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/16068002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_commands.cc')
-rw-r--r--chrome/browser/ui/browser_commands.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index fd1c0ad..4000083 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -73,6 +73,7 @@
#include "content/public/common/url_utils.h"
#include "net/base/escape.h"
#include "webkit/common/user_agent/user_agent_util.h"
+#include "webkit/glue/glue_serialize.h"
#if defined(OS_MACOSX)
#include "ui/base/cocoa/find_pasteboard.h"
@@ -995,13 +996,13 @@ void ViewSource(Browser* browser, WebContents* contents) {
if (!entry)
return;
- ViewSource(browser, contents, entry->GetURL(), entry->GetPageState());
+ ViewSource(browser, contents, entry->GetURL(), entry->GetContentState());
}
void ViewSource(Browser* browser,
WebContents* contents,
const GURL& url,
- const content::PageState& page_state) {
+ const std::string& content_state) {
content::RecordAction(UserMetricsAction("ViewSource"));
DCHECK(contents);
@@ -1019,7 +1020,8 @@ void ViewSource(Browser* browser,
active_entry->SetVirtualURL(view_source_url);
// Do not restore scroller position.
- active_entry->SetPageState(page_state.RemoveScrollOffset());
+ active_entry->SetContentState(
+ webkit_glue::RemoveScrollOffsetFromHistoryState(content_state));
// Do not restore title, derive it from the url.
active_entry->SetTitle(string16());