| OLD | NEW |
| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 bool ChromeToolbarModelDelegate::FailsMalwareCheck() const { | 92 bool ChromeToolbarModelDelegate::FailsMalwareCheck() const { |
| 93 content::WebContents* web_contents = GetActiveWebContents(); | 93 content::WebContents* web_contents = GetActiveWebContents(); |
| 94 // If there is no active WebContents (which can happen during toolbar | 94 // If there is no active WebContents (which can happen during toolbar |
| 95 // initialization), so nothing can fail. | 95 // initialization), so nothing can fail. |
| 96 if (!web_contents) | 96 if (!web_contents) |
| 97 return false; | 97 return false; |
| 98 security_state::SecurityStateModel::SecurityInfo security_info; | 98 security_state::SecurityStateModel::SecurityInfo security_info; |
| 99 ChromeSecurityStateModelClient::FromWebContents(web_contents) | 99 ChromeSecurityStateModelClient::FromWebContents(web_contents) |
| 100 ->GetSecurityInfo(&security_info); | 100 ->GetSecurityInfo(&security_info); |
| 101 return security_info.fails_malware_check; | 101 return security_info.malicious_content_status != |
| 102 security_state::SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE; |
| 102 } | 103 } |
| 103 | 104 |
| 104 content::NavigationController* | 105 content::NavigationController* |
| 105 ChromeToolbarModelDelegate::GetNavigationController() const { | 106 ChromeToolbarModelDelegate::GetNavigationController() const { |
| 106 // This |current_tab| can be null during the initialization of the toolbar | 107 // This |current_tab| can be null during the initialization of the toolbar |
| 107 // during window creation (i.e. before any tabs have been added to the | 108 // during window creation (i.e. before any tabs have been added to the |
| 108 // window). | 109 // window). |
| 109 content::WebContents* current_tab = GetActiveWebContents(); | 110 content::WebContents* current_tab = GetActiveWebContents(); |
| 110 return current_tab ? ¤t_tab->GetController() : nullptr; | 111 return current_tab ? ¤t_tab->GetController() : nullptr; |
| 111 } | 112 } |
| 112 | 113 |
| 113 content::NavigationEntry* ChromeToolbarModelDelegate::GetNavigationEntry() | 114 content::NavigationEntry* ChromeToolbarModelDelegate::GetNavigationEntry() |
| 114 const { | 115 const { |
| 115 content::NavigationController* controller = GetNavigationController(); | 116 content::NavigationController* controller = GetNavigationController(); |
| 116 return controller ? controller->GetVisibleEntry() : nullptr; | 117 return controller ? controller->GetVisibleEntry() : nullptr; |
| 117 } | 118 } |
| 118 | 119 |
| 119 Profile* ChromeToolbarModelDelegate::GetProfile() const { | 120 Profile* ChromeToolbarModelDelegate::GetProfile() const { |
| 120 content::NavigationController* controller = GetNavigationController(); | 121 content::NavigationController* controller = GetNavigationController(); |
| 121 return controller | 122 return controller |
| 122 ? Profile::FromBrowserContext(controller->GetBrowserContext()) | 123 ? Profile::FromBrowserContext(controller->GetBrowserContext()) |
| 123 : nullptr; | 124 : nullptr; |
| 124 } | 125 } |
| OLD | NEW |