| 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 "components/omnibox/browser/omnibox_edit_model.h" | 5 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 ClassifyStringForPasteAndGo(text, &match, nullptr); | 556 ClassifyStringForPasteAndGo(text, &match, nullptr); |
| 557 return AutocompleteMatch::IsSearchType(match.type); | 557 return AutocompleteMatch::IsSearchType(match.type); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void OmniboxEditModel::AcceptInput(WindowOpenDisposition disposition, | 560 void OmniboxEditModel::AcceptInput(WindowOpenDisposition disposition, |
| 561 bool for_drop) { | 561 bool for_drop) { |
| 562 // Get the URL and transition type for the selected entry. | 562 // Get the URL and transition type for the selected entry. |
| 563 GURL alternate_nav_url; | 563 GURL alternate_nav_url; |
| 564 AutocompleteMatch match = CurrentMatch(&alternate_nav_url); | 564 AutocompleteMatch match = CurrentMatch(&alternate_nav_url); |
| 565 | 565 |
| 566 // If CTRL is down it means the user wants to append ".com" to the text he | 566 // If CTRL is down it means the user wants to append ".com" to the text they |
| 567 // typed. If we can successfully generate a URL_WHAT_YOU_TYPED match doing | 567 // typed. If we can successfully generate a URL_WHAT_YOU_TYPED match doing |
| 568 // that, then we use this. These matches are marked as generated by the | 568 // that, then we use this. These matches are marked as generated by the |
| 569 // HistoryURLProvider so we only generate them if this provider is present. | 569 // HistoryURLProvider so we only generate them if this provider is present. |
| 570 if (control_key_state_ == DOWN_WITHOUT_CHANGE && !is_keyword_selected() && | 570 if (control_key_state_ == DOWN_WITHOUT_CHANGE && !is_keyword_selected() && |
| 571 autocomplete_controller()->history_url_provider()) { | 571 autocomplete_controller()->history_url_provider()) { |
| 572 // Generate a new AutocompleteInput, copying the latest one but using "com" | 572 // Generate a new AutocompleteInput, copying the latest one but using "com" |
| 573 // as the desired TLD. Then use this autocomplete input to generate a | 573 // as the desired TLD. Then use this autocomplete input to generate a |
| 574 // URL_WHAT_YOU_TYPED AutocompleteMatch. Note that using the most recent | 574 // URL_WHAT_YOU_TYPED AutocompleteMatch. Note that using the most recent |
| 575 // input instead of the currently visible text means we'll ignore any | 575 // input instead of the currently visible text means we'll ignore any |
| 576 // visible inline autocompletion: if a user types "foo" and is autocompleted | 576 // visible inline autocompletion: if a user types "foo" and is autocompleted |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 // Update state and notify view if the omnibox has focus and the caret | 1527 // Update state and notify view if the omnibox has focus and the caret |
| 1528 // visibility changed. | 1528 // visibility changed. |
| 1529 const bool was_caret_visible = is_caret_visible(); | 1529 const bool was_caret_visible = is_caret_visible(); |
| 1530 focus_state_ = state; | 1530 focus_state_ = state; |
| 1531 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1531 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1532 is_caret_visible() != was_caret_visible) | 1532 is_caret_visible() != was_caret_visible) |
| 1533 view_->ApplyCaretVisibility(); | 1533 view_->ApplyCaretVisibility(); |
| 1534 | 1534 |
| 1535 client_->OnFocusChanged(focus_state_, reason); | 1535 client_->OnFocusChanged(focus_state_, reason); |
| 1536 } | 1536 } |
| OLD | NEW |