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

Side by Side Diff: chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc

Issue 2331133002: [Material] Show "Dangerous" for Safe Browsing Security State (Closed)
Patch Set: Fix for pkasting Created 4 years, 3 months 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
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/ui/toolbar/chrome_toolbar_model_delegate.h" 5 #include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 8 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search/search.h" 10 #include "chrome/browser/search/search.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 const { 84 const {
85 scoped_refptr<net::X509Certificate> cert; 85 scoped_refptr<net::X509Certificate> cert;
86 content::NavigationEntry* entry = GetNavigationEntry(); 86 content::NavigationEntry* entry = GetNavigationEntry();
87 if (entry) { 87 if (entry) {
88 content::CertStore::GetInstance()->RetrieveCert(entry->GetSSL().cert_id, 88 content::CertStore::GetInstance()->RetrieveCert(entry->GetSSL().cert_id,
89 &cert); 89 &cert);
90 } 90 }
91 return cert; 91 return cert;
92 } 92 }
93 93
94 bool ChromeToolbarModelDelegate::FailsMalwareCheck() const {
95 content::WebContents* web_contents = GetActiveWebContents();
96 // If there is no active WebContents (which can happen during toolbar
97 // initialization), so nothing can fail.
98 return web_contents &&
99 ChromeSecurityStateModelClient::FromWebContents(web_contents)
100 ->GetSecurityInfo()
101 .fails_malware_check;
102 }
103
94 content::NavigationController* 104 content::NavigationController*
95 ChromeToolbarModelDelegate::GetNavigationController() const { 105 ChromeToolbarModelDelegate::GetNavigationController() const {
96 // This |current_tab| can be null during the initialization of the toolbar 106 // This |current_tab| can be null during the initialization of the toolbar
97 // during window creation (i.e. before any tabs have been added to the 107 // during window creation (i.e. before any tabs have been added to the
98 // window). 108 // window).
99 content::WebContents* current_tab = GetActiveWebContents(); 109 content::WebContents* current_tab = GetActiveWebContents();
100 return current_tab ? &current_tab->GetController() : nullptr; 110 return current_tab ? &current_tab->GetController() : nullptr;
101 } 111 }
102 112
103 content::NavigationEntry* ChromeToolbarModelDelegate::GetNavigationEntry() 113 content::NavigationEntry* ChromeToolbarModelDelegate::GetNavigationEntry()
104 const { 114 const {
105 content::NavigationController* controller = GetNavigationController(); 115 content::NavigationController* controller = GetNavigationController();
106 return controller ? controller->GetVisibleEntry() : nullptr; 116 return controller ? controller->GetVisibleEntry() : nullptr;
107 } 117 }
108 118
109 Profile* ChromeToolbarModelDelegate::GetProfile() const { 119 Profile* ChromeToolbarModelDelegate::GetProfile() const {
110 content::NavigationController* controller = GetNavigationController(); 120 content::NavigationController* controller = GetNavigationController();
111 return controller 121 return controller
112 ? Profile::FromBrowserContext(controller->GetBrowserContext()) 122 ? Profile::FromBrowserContext(controller->GetBrowserContext())
113 : nullptr; 123 : nullptr;
114 } 124 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h ('k') | components/omnibox_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698