| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/toolbar_model_impl.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 GURL ToolbarModelImpl::GetURL() const { | 147 GURL ToolbarModelImpl::GetURL() const { |
| 148 const NavigationController* navigation_controller = GetNavigationController(); | 148 const NavigationController* navigation_controller = GetNavigationController(); |
| 149 if (navigation_controller) { | 149 if (navigation_controller) { |
| 150 const NavigationEntry* entry = navigation_controller->GetVisibleEntry(); | 150 const NavigationEntry* entry = navigation_controller->GetVisibleEntry(); |
| 151 if (entry) | 151 if (entry) |
| 152 return ShouldDisplayURL() ? entry->GetVirtualURL() : GURL(); | 152 return ShouldDisplayURL() ? entry->GetVirtualURL() : GURL(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 return GURL(content::kAboutBlankURL); | 155 return GURL(url::kAboutBlankURL); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool ToolbarModelImpl::WouldPerformSearchTermReplacement( | 158 bool ToolbarModelImpl::WouldPerformSearchTermReplacement( |
| 159 bool ignore_editing) const { | 159 bool ignore_editing) const { |
| 160 return !GetSearchTerms(ignore_editing).empty(); | 160 return !GetSearchTerms(ignore_editing).empty(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( | 163 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( |
| 164 bool ignore_editing) const { | 164 bool ignore_editing) const { |
| 165 // When editing, assume no security style. | 165 // When editing, assume no security style. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 if (entry && | 326 if (entry && |
| 327 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) | 327 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) |
| 328 return search_terms; | 328 return search_terms; |
| 329 | 329 |
| 330 // Otherwise, extract search terms for HTTPS pages that do not have a security | 330 // Otherwise, extract search terms for HTTPS pages that do not have a security |
| 331 // error. | 331 // error. |
| 332 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); | 332 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); |
| 333 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? | 333 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? |
| 334 base::string16() : search_terms; | 334 base::string16() : search_terms; |
| 335 } | 335 } |
| OLD | NEW |