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) |
} |