Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: chrome/browser/android/vr_shell/vr_web_contents_observer.cc

Issue 2536223002: Omnibox improvements and fixes. (Closed)
Patch Set: Make unit tests compile by including chrome/browser and blink. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 dd39ac5ed77e8843d1febf6f11b63e74e906d2c4..48cddbc3589634ce09e4c94f98e1bf7177da2cdd 100644
--- a/chrome/browser/android/vr_shell/vr_web_contents_observer.cc
+++ b/chrome/browser/android/vr_shell/vr_web_contents_observer.cc
@@ -6,6 +6,8 @@
#include "chrome/browser/android/vr_shell/ui_interface.h"
#include "chrome/browser/android/vr_shell/vr_shell.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 {
@@ -15,7 +17,10 @@ VrWebContentsObserver::VrWebContentsObserver(content::WebContents* web_contents,
VrShell* vr_shell)
: WebContentsObserver(web_contents),
ui_interface_(ui_interface),
- vr_shell_(vr_shell) {}
+ vr_shell_(vr_shell) {
+ ui_interface_->SetURL(web_contents->GetVisibleURL());
+ SetSecurityLevel();
+}
VrWebContentsObserver::~VrWebContentsObserver() {}
@@ -33,17 +38,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());
+ DCHECK(helper);
+ security_state::SecurityInfo security_info;
+ helper->GetSecurityInfo(&security_info);
+ ui_interface_->SetSecurityLevel(security_info.security_level);
}
void VrWebContentsObserver::DidToggleFullscreenModeForTab(

Powered by Google App Engine
This is Rietveld 408576698