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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return string16(); // We mainly do this to enforce the subsequent DCHECK. | 259 return string16(); // We mainly do this to enforce the subsequent DCHECK. |
260 | 260 |
261 // If the page is still loading and the security style is unknown, consider | 261 // If the page is still loading and the security style is unknown, consider |
262 // the page secure. Without this, after the user hit enter on some search | 262 // the page secure. Without this, after the user hit enter on some search |
263 // terms, the omnibox would change to displaying the loading URL before | 263 // terms, the omnibox would change to displaying the loading URL before |
264 // changing back to the search terms once they could be extracted, thus | 264 // changing back to the search terms once they could be extracted, thus |
265 // causing annoying flicker. | 265 // causing annoying flicker. |
266 DCHECK(web_contents); | 266 DCHECK(web_contents); |
267 const NavigationController& nav_controller = web_contents->GetController(); | 267 const NavigationController& nav_controller = web_contents->GetController(); |
268 const NavigationEntry* entry = nav_controller.GetVisibleEntry(); | 268 const NavigationEntry* entry = nav_controller.GetVisibleEntry(); |
| 269 // NOTE: If the first condition in this next statement succeeds, |entry| must |
| 270 // be non-NULL. |
269 if ((entry != nav_controller.GetLastCommittedEntry()) && | 271 if ((entry != nav_controller.GetLastCommittedEntry()) && |
270 (entry->GetSSL().security_style == content::SECURITY_STYLE_UNKNOWN)) | 272 (entry->GetSSL().security_style == content::SECURITY_STYLE_UNKNOWN)) |
271 return search_terms; | 273 return search_terms; |
272 | 274 |
| 275 // If the URL is using a Google base URL specified via the command line, skip |
| 276 // the security check below. |
| 277 if (entry && |
| 278 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) |
| 279 return search_terms; |
| 280 |
273 // Otherwise, extract search terms for HTTPS pages that do not have a security | 281 // Otherwise, extract search terms for HTTPS pages that do not have a security |
274 // error. | 282 // error. |
275 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(); | 283 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(); |
276 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? | 284 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? |
277 string16() : search_terms; | 285 string16() : search_terms; |
278 } | 286 } |
OLD | NEW |