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

Unified Diff: components/sessions/content/content_serialized_navigation_driver.cc

Issue 2676893002: [Android History] Fix chrome://history redirect (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | content/public/common/content_features.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sessions/content/content_serialized_navigation_driver.cc
diff --git a/components/sessions/content/content_serialized_navigation_driver.cc b/components/sessions/content/content_serialized_navigation_driver.cc
index 7aa7de842ae547e4dd3a9187bfb839690088165e..43c1449137900565f7a8108e4c2fa89e6f2034e2 100644
--- a/components/sessions/content/content_serialized_navigation_driver.cc
+++ b/components/sessions/content/content_serialized_navigation_driver.cc
@@ -7,6 +7,7 @@
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "components/sessions/core/serialized_navigation_entry.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/page_state.h"
#include "content/public/common/referrer.h"
#include "content/public/common/url_constants.h"
@@ -138,6 +139,26 @@ void ContentSerializedNavigationDriver::Sanitize(
navigation->encoded_page_state_ = content::PageState::CreateFromURL(
navigation->virtual_url_).ToEncodedData();
}
+
+ if (base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager) &&
+ navigation->virtual_url_.SchemeIs(content::kChromeUIScheme) &&
+ (navigation->virtual_url_.host_piece() == content::kChromeUIHistoryHost ||
+ navigation->virtual_url_.host_piece() == "history-frame")) {
sky 2017/02/06 22:32:14 Is history-frame really not defined anywhere?
Theresa 2017/02/06 23:38:09 It wasn't defined anywhere that was accessible by
+ // Rewrite the old history Web UI to the new android native history.
+ navigation->virtual_url_ = GURL("chrome-native://history/");
sky 2017/02/06 22:32:14 Seems like this should be constants, right?
Theresa 2017/02/06 23:38:09 Done.
+ navigation->original_request_url_ = navigation->virtual_url_;
+ navigation->encoded_page_state_ = content::PageState::CreateFromURL(
+ navigation->virtual_url_).ToEncodedData();
+ } else if (
+ !base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager) &&
+ navigation->virtual_url_.SchemeIs("chrome-native") &&
+ navigation->virtual_url_.host_piece() == content::kChromeUIHistoryHost) {
+ // If the android native history UI has been disabled, redirect
+ // chrome-native://history to the old web UI.
+ navigation->virtual_url_ = GURL("chrome://history/");
+ navigation->original_request_url_ = navigation->virtual_url_;
+ navigation->encoded_page_state_ = std::string();
+ }
#endif // defined(OS_ANDROID)
}
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | content/public/common/content_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698