| 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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 base::string16 OmniboxEditModel::DisplayTextFromUserText( | 1277 base::string16 OmniboxEditModel::DisplayTextFromUserText( |
| 1278 const base::string16& text) const { | 1278 const base::string16& text) const { |
| 1279 return KeywordIsSelected() ? | 1279 return KeywordIsSelected() ? |
| 1280 KeywordProvider::SplitReplacementStringFromInput(text, false) : text; | 1280 KeywordProvider::SplitReplacementStringFromInput(text, false) : text; |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 base::string16 OmniboxEditModel::UserTextFromDisplayText( | 1283 base::string16 OmniboxEditModel::UserTextFromDisplayText( |
| 1284 const base::string16& text) const { | 1284 const base::string16& text) const { |
| 1285 return KeywordIsSelected() ? (keyword_ + char16(' ') + text) : text; | 1285 return KeywordIsSelected() ? (keyword_ + base::char16(' ') + text) : text; |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match, | 1288 void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match, |
| 1289 GURL* alternate_nav_url) const { | 1289 GURL* alternate_nav_url) const { |
| 1290 DCHECK(match != NULL); | 1290 DCHECK(match != NULL); |
| 1291 | 1291 |
| 1292 if (controller_->GetToolbarModel()->WouldPerformSearchTermReplacement( | 1292 if (controller_->GetToolbarModel()->WouldPerformSearchTermReplacement( |
| 1293 false)) { | 1293 false)) { |
| 1294 // Any time the user hits enter on the unchanged omnibox, we should reload. | 1294 // Any time the user hits enter on the unchanged omnibox, we should reload. |
| 1295 // When we're not extracting search terms, AcceptInput() will take care of | 1295 // When we're not extracting search terms, AcceptInput() will take care of |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 instant->OmniboxFocusChanged(state, reason, NULL); | 1441 instant->OmniboxFocusChanged(state, reason, NULL); |
| 1442 | 1442 |
| 1443 // Update state and notify view if the omnibox has focus and the caret | 1443 // Update state and notify view if the omnibox has focus and the caret |
| 1444 // visibility changed. | 1444 // visibility changed. |
| 1445 const bool was_caret_visible = is_caret_visible(); | 1445 const bool was_caret_visible = is_caret_visible(); |
| 1446 focus_state_ = state; | 1446 focus_state_ = state; |
| 1447 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1447 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1448 is_caret_visible() != was_caret_visible) | 1448 is_caret_visible() != was_caret_visible) |
| 1449 view_->ApplyCaretVisibility(); | 1449 view_->ApplyCaretVisibility(); |
| 1450 } | 1450 } |
| OLD | NEW |