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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 DCHECK(!last_omnibox_focus_.is_null()) | 707 DCHECK(!last_omnibox_focus_.is_null()) |
708 << "An omnibox focus should have occurred before opening a match."; | 708 << "An omnibox focus should have occurred before opening a match."; |
709 UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_); | 709 UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_); |
710 } | 710 } |
711 | 711 |
712 TemplateURL* template_url = match.GetTemplateURL(profile_, false); | 712 TemplateURL* template_url = match.GetTemplateURL(profile_, false); |
713 if (template_url) { | 713 if (template_url) { |
714 if (match.transition == content::PAGE_TRANSITION_KEYWORD) { | 714 if (match.transition == content::PAGE_TRANSITION_KEYWORD) { |
715 // The user is using a non-substituting keyword or is explicitly in | 715 // The user is using a non-substituting keyword or is explicitly in |
716 // keyword mode. | 716 // keyword mode. |
717 const AutocompleteMatch& match = (index == OmniboxPopupModel::kNoMatch) ? | |
718 CurrentMatch(NULL) : result().match_at(index); | |
719 | 717 |
720 // Don't increment usage count for extension keywords. | 718 // Don't increment usage count for extension keywords. |
721 if (delegate_->ProcessExtensionKeyword(template_url, match, | 719 if (delegate_->ProcessExtensionKeyword(template_url, match, |
722 disposition)) { | 720 disposition)) { |
723 observer->OnSuccessfulNavigation(); | 721 observer->OnSuccessfulNavigation(); |
724 if (disposition != NEW_BACKGROUND_TAB) | 722 if (disposition != NEW_BACKGROUND_TAB) |
725 view_->RevertAll(); | 723 view_->RevertAll(); |
726 return; | 724 return; |
727 } | 725 } |
728 | 726 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 instant->OmniboxFocusChanged(state, reason, NULL); | 1383 instant->OmniboxFocusChanged(state, reason, NULL); |
1386 | 1384 |
1387 // Update state and notify view if the omnibox has focus and the caret | 1385 // Update state and notify view if the omnibox has focus and the caret |
1388 // visibility changed. | 1386 // visibility changed. |
1389 const bool was_caret_visible = is_caret_visible(); | 1387 const bool was_caret_visible = is_caret_visible(); |
1390 focus_state_ = state; | 1388 focus_state_ = state; |
1391 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1389 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1392 is_caret_visible() != was_caret_visible) | 1390 is_caret_visible() != was_caret_visible) |
1393 view_->ApplyCaretVisibility(); | 1391 view_->ApplyCaretVisibility(); |
1394 } | 1392 } |
OLD | NEW |