| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" | 30 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/browser/prerender/prerender_field_trial.h" | 32 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 33 #include "chrome/browser/prerender/prerender_manager.h" | 33 #include "chrome/browser/prerender/prerender_manager.h" |
| 34 #include "chrome/browser/prerender/prerender_manager_factory.h" | 34 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 35 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| 36 #include "chrome/browser/search_engines/template_url.h" | 36 #include "chrome/browser/search_engines/template_url.h" |
| 37 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 37 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 38 #include "chrome/browser/search_engines/template_url_service.h" | 38 #include "chrome/browser/search_engines/template_url_service.h" |
| 39 #include "chrome/browser/search_engines/template_url_service_factory.h" | 39 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 40 #include "chrome/browser/sessions/restore_tab_helper.h" | 40 #include "chrome/browser/sessions/session_tab_helper.h" |
| 41 #include "chrome/browser/ui/browser_list.h" | 41 #include "chrome/browser/ui/browser_list.h" |
| 42 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 42 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 43 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 43 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 44 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" | 44 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" |
| 45 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 45 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 46 #include "chrome/browser/ui/search/search_tab_helper.h" | 46 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 47 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 47 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 48 #include "chrome/common/chrome_notification_types.h" | 48 #include "chrome/common/chrome_notification_types.h" |
| 49 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
| 50 #include "chrome/common/pref_names.h" | 50 #include "chrome/common/pref_names.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 "not set correctly and other things may be wrong."; | 531 "not set correctly and other things may be wrong."; |
| 532 if (index != OmniboxPopupModel::kNoMatch) | 532 if (index != OmniboxPopupModel::kNoMatch) |
| 533 log.selected_index = index; | 533 log.selected_index = index; |
| 534 else if (!has_temporary_text_) | 534 else if (!has_temporary_text_) |
| 535 log.inline_autocompleted_length = inline_autocomplete_text_.length(); | 535 log.inline_autocompleted_length = inline_autocomplete_text_.length(); |
| 536 if (disposition == CURRENT_TAB) { | 536 if (disposition == CURRENT_TAB) { |
| 537 // If we know the destination is being opened in the current tab, | 537 // If we know the destination is being opened in the current tab, |
| 538 // we can easily get the tab ID. (If it's being opened in a new | 538 // we can easily get the tab ID. (If it's being opened in a new |
| 539 // tab, we don't know the tab ID yet.) | 539 // tab, we don't know the tab ID yet.) |
| 540 log.tab_id = controller_->GetTabContents()-> | 540 log.tab_id = controller_->GetTabContents()-> |
| 541 restore_tab_helper()->session_id().id(); | 541 session_tab_helper()->session_id().id(); |
| 542 } | 542 } |
| 543 autocomplete_controller_->AddProvidersInfo(&log.providers_info); | 543 autocomplete_controller_->AddProvidersInfo(&log.providers_info); |
| 544 content::NotificationService::current()->Notify( | 544 content::NotificationService::current()->Notify( |
| 545 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 545 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 546 content::Source<Profile>(profile_), | 546 content::Source<Profile>(profile_), |
| 547 content::Details<AutocompleteLog>(&log)); | 547 content::Details<AutocompleteLog>(&log)); |
| 548 HISTOGRAM_ENUMERATION("Omnibox.EventCount", 1, 2); | 548 HISTOGRAM_ENUMERATION("Omnibox.EventCount", 1, 2); |
| 549 } | 549 } |
| 550 | 550 |
| 551 TemplateURL* template_url = match.GetTemplateURL(profile_); | 551 TemplateURL* template_url = match.GetTemplateURL(profile_); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1209 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
| 1210 const string16& text, | 1210 const string16& text, |
| 1211 AutocompleteMatch* match, | 1211 AutocompleteMatch* match, |
| 1212 GURL* alternate_nav_url) const { | 1212 GURL* alternate_nav_url) const { |
| 1213 DCHECK(match); | 1213 DCHECK(match); |
| 1214 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1214 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
| 1215 string16(), false, false, match, alternate_nav_url); | 1215 string16(), false, false, match, alternate_nav_url); |
| 1216 } | 1216 } |
| OLD | NEW |