| OLD | NEW |
| 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 "ios/chrome/browser/web/chrome_web_client.h" | 5 #include "ios/chrome/browser/web/chrome_web_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" |
| 8 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 9 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| 10 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
| 11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 13 #include "components/dom_distiller/core/url_constants.h" | 14 #include "components/dom_distiller/core/url_constants.h" |
| 15 #include "components/payments/core/features.h" |
| 14 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 15 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
| 16 #include "components/task_scheduler_util/browser/initialization.h" | 18 #include "components/task_scheduler_util/browser/initialization.h" |
| 17 #include "components/version_info/version_info.h" | 19 #include "components/version_info/version_info.h" |
| 18 #include "ios/chrome/browser/application_context.h" | 20 #include "ios/chrome/browser/application_context.h" |
| 19 #include "ios/chrome/browser/browser_about_rewriter.h" | 21 #include "ios/chrome/browser/browser_about_rewriter.h" |
| 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 21 #include "ios/chrome/browser/chrome_switches.h" | 23 #include "ios/chrome/browser/chrome_switches.h" |
| 22 #include "ios/chrome/browser/chrome_url_constants.h" | 24 #include "ios/chrome/browser/chrome_url_constants.h" |
| 23 #include "ios/chrome/browser/experimental_flags.h" | 25 #include "ios/chrome/browser/experimental_flags.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 160 |
| 159 void ChromeWebClient::PostBrowserURLRewriterCreation( | 161 void ChromeWebClient::PostBrowserURLRewriterCreation( |
| 160 web::BrowserURLRewriter* rewriter) { | 162 web::BrowserURLRewriter* rewriter) { |
| 161 rewriter->AddURLRewriter(&WillHandleWebBrowserAboutURL); | 163 rewriter->AddURLRewriter(&WillHandleWebBrowserAboutURL); |
| 162 } | 164 } |
| 163 | 165 |
| 164 NSString* ChromeWebClient::GetEarlyPageScript( | 166 NSString* ChromeWebClient::GetEarlyPageScript( |
| 165 web::BrowserState* browser_state) const { | 167 web::BrowserState* browser_state) const { |
| 166 NSString* chrome_page_script = GetPageScript(@"chrome_bundle"); | 168 NSString* chrome_page_script = GetPageScript(@"chrome_bundle"); |
| 167 | 169 |
| 168 if (!experimental_flags::IsPaymentRequestEnabled()) | 170 if (!base::FeatureList::IsEnabled(payments::features::kWebPayments)) |
| 169 return chrome_page_script; | 171 return chrome_page_script; |
| 170 | 172 |
| 171 NSString* kScriptTemplate = @"%@; %@"; | 173 NSString* kScriptTemplate = @"%@; %@"; |
| 172 return [NSString stringWithFormat:kScriptTemplate, | 174 return [NSString stringWithFormat:kScriptTemplate, |
| 173 GetPageScript(@"payment_request"), | 175 GetPageScript(@"payment_request"), |
| 174 chrome_page_script]; | 176 chrome_page_script]; |
| 175 } | 177 } |
| 176 | 178 |
| 177 void ChromeWebClient::AllowCertificateError( | 179 void ChromeWebClient::AllowCertificateError( |
| 178 web::WebState* web_state, | 180 web::WebState* web_state, |
| 179 int cert_error, | 181 int cert_error, |
| 180 const net::SSLInfo& info, | 182 const net::SSLInfo& info, |
| 181 const GURL& request_url, | 183 const GURL& request_url, |
| 182 bool overridable, | 184 bool overridable, |
| 183 const base::Callback<void(bool)>& callback) { | 185 const base::Callback<void(bool)>& callback) { |
| 184 IOSSSLErrorHandler::HandleSSLError(web_state, cert_error, info, request_url, | 186 IOSSSLErrorHandler::HandleSSLError(web_state, cert_error, info, request_url, |
| 185 overridable, callback); | 187 overridable, callback); |
| 186 } | 188 } |
| 187 | 189 |
| 188 std::unique_ptr<base::TaskScheduler::InitParams> | 190 std::unique_ptr<base::TaskScheduler::InitParams> |
| 189 ChromeWebClient::GetTaskSchedulerInitParams() { | 191 ChromeWebClient::GetTaskSchedulerInitParams() { |
| 190 return task_scheduler_util::GetBrowserTaskSchedulerInitParamsFromVariations(); | 192 return task_scheduler_util::GetBrowserTaskSchedulerInitParamsFromVariations(); |
| 191 } | 193 } |
| 192 | 194 |
| 193 bool ChromeWebClient::IsSlimNavigationManagerEnabled() const { | 195 bool ChromeWebClient::IsSlimNavigationManagerEnabled() const { |
| 194 return experimental_flags::IsSlimNavigationManagerEnabled(); | 196 return experimental_flags::IsSlimNavigationManagerEnabled(); |
| 195 } | 197 } |
| OLD | NEW |