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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 if (delegate_->CurrentPageExists() && !user_input_in_progress_) { | 937 if (delegate_->CurrentPageExists() && !user_input_in_progress_) { |
| 938 // TODO(jered): We may want to merge this into Start() and just call that | 938 // TODO(jered): We may want to merge this into Start() and just call that |
| 939 // here rather than having a special entry point for zero-suggest. Note | 939 // here rather than having a special entry point for zero-suggest. Note |
| 940 // that we avoid PermanentURL() here because it's not guaranteed to give us | 940 // that we avoid PermanentURL() here because it's not guaranteed to give us |
| 941 // the actual underlying current URL, e.g. if we're on the NTP and the | 941 // the actual underlying current URL, e.g. if we're on the NTP and the |
| 942 // |permanent_text_| is empty. | 942 // |permanent_text_| is empty. |
| 943 autocomplete_controller()->StartZeroSuggest(AutocompleteInput( | 943 autocomplete_controller()->StartZeroSuggest(AutocompleteInput( |
| 944 permanent_text_, base::string16::npos, base::string16(), | 944 permanent_text_, base::string16::npos, base::string16(), |
| 945 delegate_->GetURL(), ClassifyPage(), false, false, true, true)); | 945 delegate_->GetURL(), ClassifyPage(), false, false, true, true)); |
| 946 } | 946 } |
| 947 // Prerender instant search base page. | |
| 948 if (chrome::ShouldPrerenderInstantSearchBaseOnFocus() && | |
| 949 InstantSearchPrerenderer::GetForProfile(profile_)) | |
| 950 delegate_->DoPrerender(AutocompleteMatch()); | |
|
kmadhusu
2014/06/12 21:12:38
We should not pass an new AutocompleteMatch() here
sidharthms
2014/06/12 23:33:34
Moved to separate cl
| |
| 947 | 951 |
| 948 if (user_input_in_progress_ || !in_revert_) | 952 if (user_input_in_progress_ || !in_revert_) |
| 949 delegate_->OnInputStateChanged(); | 953 delegate_->OnInputStateChanged(); |
| 950 } | 954 } |
| 951 | 955 |
| 952 void OmniboxEditModel::SetCaretVisibility(bool visible) { | 956 void OmniboxEditModel::SetCaretVisibility(bool visible) { |
| 953 // Caret visibility only matters if the omnibox has focus. | 957 // Caret visibility only matters if the omnibox has focus. |
| 954 if (focus_state_ != OMNIBOX_FOCUS_NONE) { | 958 if (focus_state_ != OMNIBOX_FOCUS_NONE) { |
| 955 SetFocusState(visible ? OMNIBOX_FOCUS_VISIBLE : OMNIBOX_FOCUS_INVISIBLE, | 959 SetFocusState(visible ? OMNIBOX_FOCUS_VISIBLE : OMNIBOX_FOCUS_INVISIBLE, |
| 956 OMNIBOX_FOCUS_CHANGE_EXPLICIT); | 960 OMNIBOX_FOCUS_CHANGE_EXPLICIT); |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1467 // Update state and notify view if the omnibox has focus and the caret | 1471 // Update state and notify view if the omnibox has focus and the caret |
| 1468 // visibility changed. | 1472 // visibility changed. |
| 1469 const bool was_caret_visible = is_caret_visible(); | 1473 const bool was_caret_visible = is_caret_visible(); |
| 1470 focus_state_ = state; | 1474 focus_state_ = state; |
| 1471 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1475 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1472 is_caret_visible() != was_caret_visible) | 1476 is_caret_visible() != was_caret_visible) |
| 1473 view_->ApplyCaretVisibility(); | 1477 view_->ApplyCaretVisibility(); |
| 1474 | 1478 |
| 1475 delegate_->OnFocusChanged(focus_state_, reason); | 1479 delegate_->OnFocusChanged(focus_state_, reason); |
| 1476 } | 1480 } |
| OLD | NEW |