OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/sessions/chrome_serialized_navigation_driver.h" | 5 #include "chrome/browser/sessions/chrome_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 "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "components/sessions/core/serialized_navigation_entry.h" | 10 #include "components/sessions/core/serialized_navigation_entry.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (navigation->virtual_url().SchemeIs(content::kChromeUIScheme) && | 69 if (navigation->virtual_url().SchemeIs(content::kChromeUIScheme) && |
70 (navigation->virtual_url().host_piece() == chrome::kChromeUIWelcomeHost || | 70 (navigation->virtual_url().host_piece() == chrome::kChromeUIWelcomeHost || |
71 navigation->virtual_url().host_piece() == chrome::kChromeUINewTabHost)) { | 71 navigation->virtual_url().host_piece() == chrome::kChromeUINewTabHost)) { |
72 navigation->set_virtual_url(GURL(chrome::kChromeUINativeNewTabURL)); | 72 navigation->set_virtual_url(GURL(chrome::kChromeUINativeNewTabURL)); |
73 navigation->set_original_request_url(navigation->virtual_url()); | 73 navigation->set_original_request_url(navigation->virtual_url()); |
74 navigation->set_encoded_page_state( | 74 navigation->set_encoded_page_state( |
75 content::PageState::CreateFromURL(navigation->virtual_url()) | 75 content::PageState::CreateFromURL(navigation->virtual_url()) |
76 .ToEncodedData()); | 76 .ToEncodedData()); |
77 } | 77 } |
78 | 78 |
79 if (base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager) && | 79 if (navigation->virtual_url().SchemeIs(content::kChromeUIScheme) && |
80 navigation->virtual_url().SchemeIs(content::kChromeUIScheme) && | |
81 (navigation->virtual_url().host_piece() == chrome::kChromeUIHistoryHost || | 80 (navigation->virtual_url().host_piece() == chrome::kChromeUIHistoryHost || |
82 navigation->virtual_url().host_piece() == | 81 navigation->virtual_url().host_piece() == |
83 chrome::kChromeUIHistoryFrameHost)) { | 82 chrome::kDeprecatedChromeUIHistoryFrameHost)) { |
84 // Rewrite the old history Web UI to the new android native history. | 83 // Rewrite the old history Web UI to the new android native history. |
85 navigation->set_virtual_url(GURL(chrome::kChromeUINativeHistoryURL)); | 84 navigation->set_virtual_url(GURL(chrome::kChromeUINativeHistoryURL)); |
86 navigation->set_original_request_url(navigation->virtual_url()); | 85 navigation->set_original_request_url(navigation->virtual_url()); |
87 navigation->set_encoded_page_state( | 86 navigation->set_encoded_page_state( |
88 content::PageState::CreateFromURL(navigation->virtual_url()) | 87 content::PageState::CreateFromURL(navigation->virtual_url()) |
89 .ToEncodedData()); | 88 .ToEncodedData()); |
90 } else if (!base::FeatureList::IsEnabled( | |
91 features::kNativeAndroidHistoryManager) && | |
92 navigation->virtual_url().SchemeIs( | |
93 chrome::kChromeUINativeScheme) && | |
94 navigation->virtual_url().host_piece() == | |
95 chrome::kChromeUIHistoryHost) { | |
96 // If the android native history UI has been disabled, redirect | |
97 // chrome-native://history to the old web UI. | |
98 navigation->set_virtual_url(GURL(chrome::kChromeUIHistoryURL)); | |
99 navigation->set_original_request_url(navigation->virtual_url()); | |
100 navigation->set_encoded_page_state(std::string()); | |
101 } | 89 } |
102 #endif // defined(OS_ANDROID) | 90 #endif // defined(OS_ANDROID) |
103 } | 91 } |
104 | 92 |
105 ChromeSerializedNavigationDriver::ChromeSerializedNavigationDriver() {} | 93 ChromeSerializedNavigationDriver::ChromeSerializedNavigationDriver() {} |
OLD | NEW |