Chromium Code Reviews| 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/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 } | 237 } |
| 238 | 238 |
| 239 GURL ToolbarModelImpl::GetURL() const { | 239 GURL ToolbarModelImpl::GetURL() const { |
| 240 const NavigationController* navigation_controller = GetNavigationController(); | 240 const NavigationController* navigation_controller = GetNavigationController(); |
| 241 if (navigation_controller) { | 241 if (navigation_controller) { |
| 242 const NavigationEntry* entry = navigation_controller->GetVisibleEntry(); | 242 const NavigationEntry* entry = navigation_controller->GetVisibleEntry(); |
| 243 if (entry) | 243 if (entry) |
| 244 return ShouldDisplayURL() ? entry->GetVirtualURL() : GURL(); | 244 return ShouldDisplayURL() ? entry->GetVirtualURL() : GURL(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 return GURL(url::kAboutBlankURL); | 247 return GURL(); |
|
Maria
2015/01/28 18:34:49
It seems like if no original url was set, we will
| |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool ToolbarModelImpl::WouldPerformSearchTermReplacement( | 250 bool ToolbarModelImpl::WouldPerformSearchTermReplacement( |
| 251 bool ignore_editing) const { | 251 bool ignore_editing) const { |
| 252 return !GetSearchTerms(ignore_editing).empty(); | 252 return !GetSearchTerms(ignore_editing).empty(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( | 255 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( |
| 256 bool ignore_editing) const { | 256 bool ignore_editing) const { |
| 257 // When editing, assume no security style. | 257 // When editing, assume no security style. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 if (entry && | 418 if (entry && |
| 419 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) | 419 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) |
| 420 return search_terms; | 420 return search_terms; |
| 421 | 421 |
| 422 // Otherwise, extract search terms for HTTPS pages that do not have a security | 422 // Otherwise, extract search terms for HTTPS pages that do not have a security |
| 423 // error. | 423 // error. |
| 424 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); | 424 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); |
| 425 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? | 425 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? |
| 426 base::string16() : search_terms; | 426 base::string16() : search_terms; |
| 427 } | 427 } |
| OLD | NEW |