| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/interstitials/ios_chrome_controller_client.h" | 5 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/security_interstitials/core/metrics_helper.h" | 8 #include "components/security_interstitials/core/metrics_helper.h" |
| 9 #include "ios/chrome/browser/application_context.h" | 9 #include "ios/chrome/browser/application_context.h" |
| 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 11 #include "ios/chrome/browser/pref_names.h" | 11 #include "ios/chrome/browser/pref_names.h" |
| 12 #include "ios/web/public/interstitials/web_interstitial.h" | 12 #include "ios/web/public/interstitials/web_interstitial.h" |
| 13 #import "ios/web/public/navigation_manager.h" | 13 #import "ios/web/public/navigation_manager.h" |
| 14 #include "ios/web/public/reload_type.h" |
| 14 #include "ios/web/public/web_state/web_state.h" | 15 #include "ios/web/public/web_state/web_state.h" |
| 15 | 16 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) | 17 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." | 18 #error "This file requires ARC support." |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 IOSChromeControllerClient::IOSChromeControllerClient( | 21 IOSChromeControllerClient::IOSChromeControllerClient( |
| 21 web::WebState* web_state, | 22 web::WebState* web_state, |
| 22 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper) | 23 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper) |
| 23 : security_interstitials::ControllerClient(std::move(metrics_helper)), | 24 : security_interstitials::ControllerClient(std::move(metrics_helper)), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 void IOSChromeControllerClient::GoBackAfterNavigationCommitted() { | 48 void IOSChromeControllerClient::GoBackAfterNavigationCommitted() { |
| 48 NOTREACHED(); | 49 NOTREACHED(); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void IOSChromeControllerClient::Proceed() { | 52 void IOSChromeControllerClient::Proceed() { |
| 52 DCHECK(web_interstitial_); | 53 DCHECK(web_interstitial_); |
| 53 web_interstitial_->Proceed(); | 54 web_interstitial_->Proceed(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void IOSChromeControllerClient::Reload() { | 57 void IOSChromeControllerClient::Reload() { |
| 57 web_state_->GetNavigationManager()->Reload(true); | 58 web_state_->GetNavigationManager()->Reload(web::ReloadType::NORMAL, true); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void IOSChromeControllerClient::OpenUrlInCurrentTab(const GURL& url) { | 61 void IOSChromeControllerClient::OpenUrlInCurrentTab(const GURL& url) { |
| 61 web_state_->OpenURL(web::WebState::OpenURLParams( | 62 web_state_->OpenURL(web::WebState::OpenURLParams( |
| 62 url, web::Referrer(), WindowOpenDisposition::CURRENT_TAB, | 63 url, web::Referrer(), WindowOpenDisposition::CURRENT_TAB, |
| 63 ui::PAGE_TRANSITION_LINK, false)); | 64 ui::PAGE_TRANSITION_LINK, false)); |
| 64 } | 65 } |
| 65 | 66 |
| 66 const std::string& IOSChromeControllerClient::GetApplicationLocale() const { | 67 const std::string& IOSChromeControllerClient::GetApplicationLocale() const { |
| 67 return GetApplicationContext()->GetApplicationLocale(); | 68 return GetApplicationContext()->GetApplicationLocale(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 PrefService* IOSChromeControllerClient::GetPrefService() { | 71 PrefService* IOSChromeControllerClient::GetPrefService() { |
| 71 return ios::ChromeBrowserState::FromBrowserState( | 72 return ios::ChromeBrowserState::FromBrowserState( |
| 72 web_state_->GetBrowserState()) | 73 web_state_->GetBrowserState()) |
| 73 ->GetPrefs(); | 74 ->GetPrefs(); |
| 74 } | 75 } |
| 75 | 76 |
| 76 const std::string IOSChromeControllerClient::GetExtendedReportingPrefName() | 77 const std::string IOSChromeControllerClient::GetExtendedReportingPrefName() |
| 77 const { | 78 const { |
| 78 return std::string(); | 79 return std::string(); |
| 79 } | 80 } |
| OLD | NEW |