Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_web_contents_observer.cc |
| diff --git a/chrome/browser/android/vr_shell/vr_web_contents_observer.cc b/chrome/browser/android/vr_shell/vr_web_contents_observer.cc |
| index 4b337eb261a914e200a973509edb330a7095f619..246eb07f89a2e2305c930653ee770f7136ba70a7 100644 |
| --- a/chrome/browser/android/vr_shell/vr_web_contents_observer.cc |
| +++ b/chrome/browser/android/vr_shell/vr_web_contents_observer.cc |
| @@ -5,6 +5,8 @@ |
| #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" |
| #include "chrome/browser/android/vr_shell/ui_interface.h" |
| +#include "chrome/browser/ssl/security_state_tab_helper.h" |
| +#include "components/security_state/core/security_state.h" |
| #include "content/public/browser/navigation_handle.h" |
| namespace vr_shell { |
| @@ -12,7 +14,10 @@ namespace vr_shell { |
| VrWebContentsObserver::VrWebContentsObserver(content::WebContents* web_contents, |
| UiInterface* ui_interface) |
| : WebContentsObserver(web_contents), |
| - ui_interface_(ui_interface) {} |
| + ui_interface_(ui_interface) { |
| + ui_interface_->SetURL(web_contents->GetVisibleURL()); |
| + SetSecurityLevel(); |
| +} |
| VrWebContentsObserver::~VrWebContentsObserver() {} |
| @@ -30,17 +35,34 @@ void VrWebContentsObserver::DidStopLoading() { |
| void VrWebContentsObserver::DidStartNavigation( |
| content::NavigationHandle* navigation_handle) { |
| - ui_interface_->SetURL(navigation_handle->GetURL()); |
| + if (navigation_handle->IsInMainFrame()) { |
| + ui_interface_->SetURL(navigation_handle->GetURL()); |
| + SetSecurityLevel(); |
| + } |
| } |
| void VrWebContentsObserver::DidRedirectNavigation( |
| content::NavigationHandle* navigation_handle) { |
| - ui_interface_->SetURL(navigation_handle->GetURL()); |
| + if (navigation_handle->IsInMainFrame()) { |
| + ui_interface_->SetURL(navigation_handle->GetURL()); |
| + SetSecurityLevel(); |
| + } |
| } |
| void VrWebContentsObserver::DidFinishNavigation( |
| content::NavigationHandle* navigation_handle) { |
| - ui_interface_->SetURL(navigation_handle->GetURL()); |
| + if (navigation_handle->IsInMainFrame()) { |
| + ui_interface_->SetURL(navigation_handle->GetURL()); |
| + SetSecurityLevel(); |
| + } |
| +} |
| + |
| +void VrWebContentsObserver::SetSecurityLevel() { |
| + const auto* helper = SecurityStateTabHelper::FromWebContents(web_contents()); |
| + CHECK(helper); |
|
bshe
2016/12/01 15:32:46
Perhaps a DCHECK here so the code is not in produc
cjgrant
2016/12/01 21:21:51
The last time we discussed CHECK/DCHECK, we settle
bshe
2016/12/02 14:21:36
My understanding is that it is better to use DCHEC
cjgrant
2016/12/02 15:39:50
Done.
|
| + security_state::SecurityInfo security_info; |
| + helper->GetSecurityInfo(&security_info); |
| + ui_interface_->SetSecurityLevel(security_info.security_level); |
| } |
| void VrWebContentsObserver::DidToggleFullscreenModeForTab( |