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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 // If we know the destination is being opened in the current tab, | 776 // If we know the destination is being opened in the current tab, |
777 // we can easily get the tab ID. (If it's being opened in a new | 777 // we can easily get the tab ID. (If it's being opened in a new |
778 // tab, we don't know the tab ID yet.) | 778 // tab, we don't know the tab ID yet.) |
779 log.tab_id = delegate_->GetSessionID().id(); | 779 log.tab_id = delegate_->GetSessionID().id(); |
780 } | 780 } |
781 autocomplete_controller()->AddProvidersInfo(&log.providers_info); | 781 autocomplete_controller()->AddProvidersInfo(&log.providers_info); |
782 content::NotificationService::current()->Notify( | 782 content::NotificationService::current()->Notify( |
783 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 783 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
784 content::Source<Profile>(profile_), | 784 content::Source<Profile>(profile_), |
785 content::Details<OmniboxLog>(&log)); | 785 content::Details<OmniboxLog>(&log)); |
786 HISTOGRAM_ENUMERATION("Omnibox.EventCount", 1, 2); | 786 LOCAL_HISTOGRAM_BOOLEAN("Omnibox.EventCount", true); |
787 DCHECK(!last_omnibox_focus_.is_null()) | 787 DCHECK(!last_omnibox_focus_.is_null()) |
788 << "An omnibox focus should have occurred before opening a match."; | 788 << "An omnibox focus should have occurred before opening a match."; |
789 UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_); | 789 UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_); |
790 | 790 |
791 TemplateURLService* service = | 791 TemplateURLService* service = |
792 TemplateURLServiceFactory::GetForProfile(profile_); | 792 TemplateURLServiceFactory::GetForProfile(profile_); |
793 TemplateURL* template_url = match.GetTemplateURL(service, false); | 793 TemplateURL* template_url = match.GetTemplateURL(service, false); |
794 if (template_url) { | 794 if (template_url) { |
795 if (match.transition == content::PAGE_TRANSITION_KEYWORD) { | 795 if (match.transition == content::PAGE_TRANSITION_KEYWORD) { |
796 // The user is using a non-substituting keyword or is explicitly in | 796 // The user is using a non-substituting keyword or is explicitly in |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 // Update state and notify view if the omnibox has focus and the caret | 1475 // Update state and notify view if the omnibox has focus and the caret |
1476 // visibility changed. | 1476 // visibility changed. |
1477 const bool was_caret_visible = is_caret_visible(); | 1477 const bool was_caret_visible = is_caret_visible(); |
1478 focus_state_ = state; | 1478 focus_state_ = state; |
1479 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1479 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1480 is_caret_visible() != was_caret_visible) | 1480 is_caret_visible() != was_caret_visible) |
1481 view_->ApplyCaretVisibility(); | 1481 view_->ApplyCaretVisibility(); |
1482 | 1482 |
1483 delegate_->OnFocusChanged(focus_state_, reason); | 1483 delegate_->OnFocusChanged(focus_state_, reason); |
1484 } | 1484 } |
OLD | NEW |