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

Side by Side Diff: chrome/browser/android/vr_shell/vr_web_contents_observer.cc

Issue 2556963006: Wire the VR omnibox directly to visible security state changes. (Closed)
Patch Set: Rebase onto 2524423002 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_web_contents_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/android/vr_shell/vr_web_contents_observer.h" 5 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h"
6 6
7 #include "chrome/browser/android/vr_shell/ui_interface.h" 7 #include "chrome/browser/android/vr_shell/ui_interface.h"
8 #include "chrome/browser/android/vr_shell/vr_shell.h" 8 #include "chrome/browser/android/vr_shell/vr_shell.h"
9 #include "chrome/browser/ssl/security_state_tab_helper.h" 9 #include "chrome/browser/ssl/security_state_tab_helper.h"
10 #include "components/security_state/core/security_state.h" 10 #include "components/security_state/core/security_state.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 void VrWebContentsObserver::DidStopLoading() { 38 void VrWebContentsObserver::DidStopLoading() {
39 ui_interface_->SetLoading(false); 39 ui_interface_->SetLoading(false);
40 } 40 }
41 41
42 void VrWebContentsObserver::DidStartNavigation( 42 void VrWebContentsObserver::DidStartNavigation(
43 content::NavigationHandle* navigation_handle) { 43 content::NavigationHandle* navigation_handle) {
44 if (navigation_handle->IsInMainFrame()) { 44 if (navigation_handle->IsInMainFrame()) {
45 ui_interface_->SetURL(navigation_handle->GetURL()); 45 ui_interface_->SetURL(navigation_handle->GetURL());
46 SetSecurityLevel();
47 } 46 }
48 } 47 }
49 48
50 void VrWebContentsObserver::DidRedirectNavigation( 49 void VrWebContentsObserver::DidRedirectNavigation(
51 content::NavigationHandle* navigation_handle) { 50 content::NavigationHandle* navigation_handle) {
52 if (navigation_handle->IsInMainFrame()) { 51 if (navigation_handle->IsInMainFrame()) {
53 ui_interface_->SetURL(navigation_handle->GetURL()); 52 ui_interface_->SetURL(navigation_handle->GetURL());
54 SetSecurityLevel();
55 } 53 }
56 } 54 }
57 55
58 void VrWebContentsObserver::DidFinishNavigation( 56 void VrWebContentsObserver::DidFinishNavigation(
59 content::NavigationHandle* navigation_handle) { 57 content::NavigationHandle* navigation_handle) {
60 if (navigation_handle->IsInMainFrame()) { 58 if (navigation_handle->IsInMainFrame()) {
61 ui_interface_->SetURL(navigation_handle->GetURL()); 59 ui_interface_->SetURL(navigation_handle->GetURL());
62 SetSecurityLevel();
63 } 60 }
64 } 61 }
65 62
63 // TODO(cjgrant): We care about security level, not style. Refactor
64 // WebContentsObserver (or equivalent) to expose more general security
65 // information, so we can stop abusing this callback.
66 void VrWebContentsObserver::SecurityStyleChanged(
67 blink::WebSecurityStyle security_style,
68 const content::SecurityStyleExplanations& explanations) {
69 SetSecurityLevel();
70 }
71
66 void VrWebContentsObserver::SetSecurityLevel() { 72 void VrWebContentsObserver::SetSecurityLevel() {
67 const auto* helper = SecurityStateTabHelper::FromWebContents(web_contents()); 73 const auto* helper = SecurityStateTabHelper::FromWebContents(web_contents());
68 DCHECK(helper); 74 DCHECK(helper);
69 security_state::SecurityInfo security_info; 75 security_state::SecurityInfo security_info;
70 helper->GetSecurityInfo(&security_info); 76 helper->GetSecurityInfo(&security_info);
71 ui_interface_->SetSecurityLevel(security_info.security_level); 77 ui_interface_->SetSecurityLevel(security_info.security_level);
72 } 78 }
73 79
74 void VrWebContentsObserver::DidToggleFullscreenModeForTab( 80 void VrWebContentsObserver::DidToggleFullscreenModeForTab(
75 bool entered_fullscreen, bool will_cause_resize) { 81 bool entered_fullscreen, bool will_cause_resize) {
76 ui_interface_->SetFullscreen(entered_fullscreen); 82 ui_interface_->SetFullscreen(entered_fullscreen);
77 } 83 }
78 84
79 void VrWebContentsObserver::WebContentsDestroyed() { 85 void VrWebContentsObserver::WebContentsDestroyed() {
80 vr_shell_->ContentWebContentsDestroyedOnUI(); 86 vr_shell_->ContentWebContentsDestroyedOnUI();
81 } 87 }
82 88
83 void VrWebContentsObserver::WasHidden() { 89 void VrWebContentsObserver::WasHidden() {
84 vr_shell_->ContentWasHiddenOnUI(); 90 vr_shell_->ContentWasHiddenOnUI();
85 } 91 }
86 92
87 void VrWebContentsObserver::RenderViewHostChanged( 93 void VrWebContentsObserver::RenderViewHostChanged(
88 content::RenderViewHost* old_host, 94 content::RenderViewHost* old_host,
89 content::RenderViewHost* new_host) { 95 content::RenderViewHost* new_host) {
90 new_host->GetWidget()->GetView()->SetShowingOverscrollGlow(false); 96 new_host->GetWidget()->GetView()->SetShowingOverscrollGlow(false);
91 } 97 }
92 98
93 } // namespace vr_shell 99 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_web_contents_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698