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/omnibox/omnibox_edit_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 // never actually use it. This avoids running the autocomplete providers (and | 361 // never actually use it. This avoids running the autocomplete providers (and |
| 362 // any systems they then spin up) during startup. | 362 // any systems they then spin up) during startup. |
| 363 const AutocompleteMatch& current_match = user_input_in_progress_ ? | 363 const AutocompleteMatch& current_match = user_input_in_progress_ ? |
| 364 CurrentMatch(NULL) : AutocompleteMatch(); | 364 CurrentMatch(NULL) : AutocompleteMatch(); |
| 365 | 365 |
| 366 AutocompleteActionPredictor::Action recommended_action = | 366 AutocompleteActionPredictor::Action recommended_action = |
| 367 AutocompleteActionPredictor::ACTION_NONE; | 367 AutocompleteActionPredictor::ACTION_NONE; |
| 368 if (user_input_in_progress_) { | 368 if (user_input_in_progress_) { |
| 369 InstantSearchPrerenderer* prerenderer = | 369 InstantSearchPrerenderer* prerenderer = |
| 370 InstantSearchPrerenderer::GetForProfile(profile_); | 370 InstantSearchPrerenderer::GetForProfile(profile_); |
| 371 if (prerenderer && | 371 if (prerenderer && !chrome::ShouldPrerenderInstantUrlOnOmniboxFocus() && |
|
kmadhusu
2014/06/18 16:23:50
We should not add this check here. Consider the fo
sidharthms
2014/06/19 20:36:52
Done.
| |
| 372 prerenderer->IsAllowed(current_match, controller_->GetWebContents()) && | 372 prerenderer->IsAllowed(current_match, controller_->GetWebContents()) && |
| 373 popup_model()->IsOpen() && has_focus()) { | 373 popup_model()->IsOpen() && has_focus()) { |
| 374 recommended_action = AutocompleteActionPredictor::ACTION_PRERENDER; | 374 recommended_action = AutocompleteActionPredictor::ACTION_PRERENDER; |
| 375 } else { | 375 } else { |
| 376 AutocompleteActionPredictor* action_predictor = | 376 AutocompleteActionPredictor* action_predictor = |
| 377 predictors::AutocompleteActionPredictorFactory::GetForProfile( | 377 predictors::AutocompleteActionPredictorFactory::GetForProfile( |
| 378 profile_); | 378 profile_); |
| 379 action_predictor->RegisterTransitionalMatches(user_text_, result()); | 379 action_predictor->RegisterTransitionalMatches(user_text_, result()); |
| 380 // Confer with the AutocompleteActionPredictor to determine what action, | 380 // Confer with the AutocompleteActionPredictor to determine what action, |
| 381 // if any, we should take. Get the recommended action here even if we | 381 // if any, we should take. Get the recommended action here even if we |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1466 // Update state and notify view if the omnibox has focus and the caret | 1466 // Update state and notify view if the omnibox has focus and the caret |
| 1467 // visibility changed. | 1467 // visibility changed. |
| 1468 const bool was_caret_visible = is_caret_visible(); | 1468 const bool was_caret_visible = is_caret_visible(); |
| 1469 focus_state_ = state; | 1469 focus_state_ = state; |
| 1470 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1470 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1471 is_caret_visible() != was_caret_visible) | 1471 is_caret_visible() != was_caret_visible) |
| 1472 view_->ApplyCaretVisibility(); | 1472 view_->ApplyCaretVisibility(); |
| 1473 | 1473 |
| 1474 delegate_->OnFocusChanged(focus_state_, reason); | 1474 delegate_->OnFocusChanged(focus_state_, reason); |
| 1475 } | 1475 } |
| OLD | NEW |