Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: components/sessions/content/content_serialized_navigation_driver.cc

Issue 2310363002: Persist offline page info in a navigation entry if needed (Closed)
Patch Set: Update Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sessions/content/content_serialized_navigation_driver.h" 5 #include "components/sessions/content/content_serialized_navigation_driver.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/sessions/content/extended_info_handler.h"
9 #include "components/sessions/core/serialized_navigation_entry.h" 10 #include "components/sessions/core/serialized_navigation_entry.h"
10 #include "content/public/common/page_state.h" 11 #include "content/public/common/page_state.h"
11 #include "content/public/common/referrer.h" 12 #include "content/public/common/referrer.h"
12 #include "content/public/common/url_constants.h" 13 #include "content/public/common/url_constants.h"
13 14
14 namespace sessions { 15 namespace sessions {
15 16
16 namespace { 17 namespace {
17 const int kObsoleteReferrerPolicyAlways = 0; 18 const int kObsoleteReferrerPolicyAlways = 0;
18 const int kObsoleteReferrerPolicyDefault = 1; 19 const int kObsoleteReferrerPolicyDefault = 1;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #endif // defined(OS_ANDROID) 127 #endif // defined(OS_ANDROID)
127 } 128 }
128 129
129 std::string ContentSerializedNavigationDriver::StripReferrerFromPageState( 130 std::string ContentSerializedNavigationDriver::StripReferrerFromPageState(
130 const std::string& page_state) const { 131 const std::string& page_state) const {
131 return content::PageState::CreateFromEncodedData(page_state) 132 return content::PageState::CreateFromEncodedData(page_state)
132 .RemoveReferrer() 133 .RemoveReferrer()
133 .ToEncodedData(); 134 .ToEncodedData();
134 } 135 }
135 136
137 void ContentSerializedNavigationDriver::RegisterExtendedInfoHandler(
138 const std::string& key,
139 std::unique_ptr<ExtendedInfoHandler> handler) {
140 DCHECK(!key.empty());
sky 2016/09/29 03:08:19 Please also add a DCHECK that there isn't a handle
jianli 2016/09/29 22:02:29 Done.
141 extended_info_handler_map_[key] = std::move(handler);
142 }
143
144 const ContentSerializedNavigationDriver::ExtendedInfoHandlerMap&
145 ContentSerializedNavigationDriver::GetAllExtendedInfoHandlers() const {
146 return extended_info_handler_map_;
147 }
148
136 } // namespace sessions 149 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698