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 "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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 std::unique_ptr<OmniboxNavigationObserver> observer( | 658 std::unique_ptr<OmniboxNavigationObserver> observer( |
| 659 client_->CreateOmniboxNavigationObserver( | 659 client_->CreateOmniboxNavigationObserver( |
| 660 input_text, match, | 660 input_text, match, |
| 661 autocomplete_controller()->history_url_provider()->SuggestExactInput( | 661 autocomplete_controller()->history_url_provider()->SuggestExactInput( |
| 662 alternate_input, alternate_nav_url, false))); | 662 alternate_input, alternate_nav_url, false))); |
| 663 | 663 |
| 664 base::TimeDelta elapsed_time_since_last_change_to_default_match( | 664 base::TimeDelta elapsed_time_since_last_change_to_default_match( |
| 665 now - autocomplete_controller()->last_time_default_match_changed()); | 665 now - autocomplete_controller()->last_time_default_match_changed()); |
| 666 DCHECK(match.provider); | 666 DCHECK(match.provider); |
| 667 // These elapsed times don't really make sense for ZeroSuggest matches | 667 // These elapsed times don't really make sense for ZeroSuggest matches |
| 668 // (because the user does not modify the omnibox for ZeroSuggest), so for | 668 // (because the user does not modify the omnibox for ZeroSuggest), so for |
|
Mark P
2016/09/01 04:16:22
Instead of first clause and parenthetical remark,
mattreynolds
2016/09/01 17:15:02
Done.
| |
| 669 // those we set the elapsed times to something that will be ignored by | 669 // those we set the elapsed times to something that will be ignored by |
| 670 // metrics_log.cc. They also don't necessarily make sense if the omnibox | 670 // metrics_log.cc. They also don't necessarily make sense if the omnibox |
| 671 // dropdown is closed or the user used a paste-and-go action. (In most | 671 // dropdown is closed or the user used a paste-and-go action. (In most |
| 672 // cases when this happens, the user never modified the omnibox.) | 672 // cases when this happens, the user never modified the omnibox.) |
| 673 const bool popup_open = PopupIsOpen(); | 673 const bool popup_open = PopupIsOpen(); |
| 674 if ((match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST) || | 674 if (input_.from_omnibox_focus() || !popup_open || !pasted_text.empty()) { |
| 675 !popup_open || !pasted_text.empty()) { | |
| 676 const base::TimeDelta default_time_delta = | 675 const base::TimeDelta default_time_delta = |
| 677 base::TimeDelta::FromMilliseconds(-1); | 676 base::TimeDelta::FromMilliseconds(-1); |
| 678 elapsed_time_since_user_first_modified_omnibox = default_time_delta; | 677 elapsed_time_since_user_first_modified_omnibox = default_time_delta; |
| 679 elapsed_time_since_last_change_to_default_match = default_time_delta; | 678 elapsed_time_since_last_change_to_default_match = default_time_delta; |
| 680 } | 679 } |
| 681 // If the popup is closed or this is a paste-and-go action (meaning the | 680 // If the popup is closed or this is a paste-and-go action (meaning the |
| 682 // contents of the dropdown are ignored regardless), we record for logging | 681 // contents of the dropdown are ignored regardless), we record for logging |
| 683 // purposes a selected_index of 0 and a suggestion list as having a single | 682 // purposes a selected_index of 0 and a suggestion list as having a single |
| 684 // entry of the match used. | 683 // entry of the match used. |
| 685 const bool dropdown_ignored = !popup_open || !pasted_text.empty(); | 684 const bool dropdown_ignored = !popup_open || !pasted_text.empty(); |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1502 // Update state and notify view if the omnibox has focus and the caret | 1501 // Update state and notify view if the omnibox has focus and the caret |
| 1503 // visibility changed. | 1502 // visibility changed. |
| 1504 const bool was_caret_visible = is_caret_visible(); | 1503 const bool was_caret_visible = is_caret_visible(); |
| 1505 focus_state_ = state; | 1504 focus_state_ = state; |
| 1506 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1505 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1507 is_caret_visible() != was_caret_visible) | 1506 is_caret_visible() != was_caret_visible) |
| 1508 view_->ApplyCaretVisibility(); | 1507 view_->ApplyCaretVisibility(); |
| 1509 | 1508 |
| 1510 client_->OnFocusChanged(focus_state_, reason); | 1509 client_->OnFocusChanged(focus_state_, reason); |
| 1511 } | 1510 } |
| OLD | NEW |