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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/autocomplete/extension_app_provider.h" | 21 #include "chrome/browser/autocomplete/extension_app_provider.h" |
22 #include "chrome/browser/autocomplete/history_url_provider.h" | 22 #include "chrome/browser/autocomplete/history_url_provider.h" |
23 #include "chrome/browser/autocomplete/keyword_provider.h" | 23 #include "chrome/browser/autocomplete/keyword_provider.h" |
24 #include "chrome/browser/autocomplete/search_provider.h" | 24 #include "chrome/browser/autocomplete/search_provider.h" |
25 #include "chrome/browser/bookmarks/bookmark_stats.h" | 25 #include "chrome/browser/bookmarks/bookmark_stats.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/command_updater.h" | 27 #include "chrome/browser/command_updater.h" |
28 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 28 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
29 #include "chrome/browser/favicon/favicon_tab_helper.h" | 29 #include "chrome/browser/favicon/favicon_tab_helper.h" |
30 #include "chrome/browser/google/google_url_tracker.h" | 30 #include "chrome/browser/google/google_url_tracker.h" |
| 31 #include "chrome/browser/google/google_url_tracker_factory.h" |
31 #include "chrome/browser/net/predictor.h" | 32 #include "chrome/browser/net/predictor.h" |
32 #include "chrome/browser/omnibox/omnibox_log.h" | 33 #include "chrome/browser/omnibox/omnibox_log.h" |
33 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 34 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
34 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" | 35 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" |
35 #include "chrome/browser/prerender/prerender_field_trial.h" | 36 #include "chrome/browser/prerender/prerender_field_trial.h" |
36 #include "chrome/browser/prerender/prerender_manager.h" | 37 #include "chrome/browser/prerender/prerender_manager.h" |
37 #include "chrome/browser/prerender/prerender_manager_factory.h" | 38 #include "chrome/browser/prerender/prerender_manager_factory.h" |
38 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
39 #include "chrome/browser/search/search.h" | 40 #include "chrome/browser/search/search.h" |
40 #include "chrome/browser/search_engines/template_url.h" | 41 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 match.transition = content::PAGE_TRANSITION_RELOAD; | 682 match.transition = content::PAGE_TRANSITION_RELOAD; |
682 } else if (for_drop || ((paste_state_ != NONE) && | 683 } else if (for_drop || ((paste_state_ != NONE) && |
683 match.is_history_what_you_typed_match)) { | 684 match.is_history_what_you_typed_match)) { |
684 // When the user pasted in a URL and hit enter, score it like a link click | 685 // When the user pasted in a URL and hit enter, score it like a link click |
685 // rather than a normal typed URL, so it doesn't get inline autocompleted | 686 // rather than a normal typed URL, so it doesn't get inline autocompleted |
686 // as aggressively later. | 687 // as aggressively later. |
687 match.transition = content::PAGE_TRANSITION_LINK; | 688 match.transition = content::PAGE_TRANSITION_LINK; |
688 } | 689 } |
689 | 690 |
690 const TemplateURL* template_url = match.GetTemplateURL(profile_, false); | 691 const TemplateURL* template_url = match.GetTemplateURL(profile_, false); |
691 if (template_url && template_url->url_ref().HasGoogleBaseURLs()) | 692 if (template_url && template_url->url_ref().HasGoogleBaseURLs()) { |
692 GoogleURLTracker::GoogleURLSearchCommitted(profile_); | 693 GoogleURLTracker* tracker = |
| 694 GoogleURLTrackerFactory::GetForProfile(profile_); |
| 695 if (tracker) |
| 696 tracker->SearchCommitted(); |
| 697 } |
693 | 698 |
694 DCHECK(popup_model()); | 699 DCHECK(popup_model()); |
695 view_->OpenMatch(match, disposition, alternate_nav_url, base::string16(), | 700 view_->OpenMatch(match, disposition, alternate_nav_url, base::string16(), |
696 popup_model()->selected_line()); | 701 popup_model()->selected_line()); |
697 } | 702 } |
698 | 703 |
699 void OmniboxEditModel::OpenMatch(AutocompleteMatch match, | 704 void OmniboxEditModel::OpenMatch(AutocompleteMatch match, |
700 WindowOpenDisposition disposition, | 705 WindowOpenDisposition disposition, |
701 const GURL& alternate_nav_url, | 706 const GURL& alternate_nav_url, |
702 const base::string16& pasted_text, | 707 const base::string16& pasted_text, |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 // Update state and notify view if the omnibox has focus and the caret | 1466 // Update state and notify view if the omnibox has focus and the caret |
1462 // visibility changed. | 1467 // visibility changed. |
1463 const bool was_caret_visible = is_caret_visible(); | 1468 const bool was_caret_visible = is_caret_visible(); |
1464 focus_state_ = state; | 1469 focus_state_ = state; |
1465 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1470 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1466 is_caret_visible() != was_caret_visible) | 1471 is_caret_visible() != was_caret_visible) |
1467 view_->ApplyCaretVisibility(); | 1472 view_->ApplyCaretVisibility(); |
1468 | 1473 |
1469 delegate_->OnFocusChanged(focus_state_, reason); | 1474 delegate_->OnFocusChanged(focus_state_, reason); |
1470 } | 1475 } |
OLD | NEW |