| 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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 match.transition = content::PAGE_TRANSITION_RELOAD; | 681 match.transition = content::PAGE_TRANSITION_RELOAD; |
| 681 } else if (for_drop || ((paste_state_ != NONE) && | 682 } else if (for_drop || ((paste_state_ != NONE) && |
| 682 match.is_history_what_you_typed_match)) { | 683 match.is_history_what_you_typed_match)) { |
| 683 // When the user pasted in a URL and hit enter, score it like a link click | 684 // When the user pasted in a URL and hit enter, score it like a link click |
| 684 // rather than a normal typed URL, so it doesn't get inline autocompleted | 685 // rather than a normal typed URL, so it doesn't get inline autocompleted |
| 685 // as aggressively later. | 686 // as aggressively later. |
| 686 match.transition = content::PAGE_TRANSITION_LINK; | 687 match.transition = content::PAGE_TRANSITION_LINK; |
| 687 } | 688 } |
| 688 | 689 |
| 689 const TemplateURL* template_url = match.GetTemplateURL(profile_, false); | 690 const TemplateURL* template_url = match.GetTemplateURL(profile_, false); |
| 690 if (template_url && template_url->url_ref().HasGoogleBaseURLs()) | 691 if (template_url && template_url->url_ref().HasGoogleBaseURLs()) { |
| 691 GoogleURLTracker::GoogleURLSearchCommitted(profile_); | 692 GoogleURLTracker* tracker = |
| 693 GoogleURLTrackerFactory::GetForProfile(profile_); |
| 694 if (tracker) |
| 695 tracker->GoogleURLSearchCommitted(); |
| 696 } |
| 692 | 697 |
| 693 DCHECK(popup_model()); | 698 DCHECK(popup_model()); |
| 694 view_->OpenMatch(match, disposition, alternate_nav_url, base::string16(), | 699 view_->OpenMatch(match, disposition, alternate_nav_url, base::string16(), |
| 695 popup_model()->selected_line()); | 700 popup_model()->selected_line()); |
| 696 } | 701 } |
| 697 | 702 |
| 698 void OmniboxEditModel::OpenMatch(AutocompleteMatch match, | 703 void OmniboxEditModel::OpenMatch(AutocompleteMatch match, |
| 699 WindowOpenDisposition disposition, | 704 WindowOpenDisposition disposition, |
| 700 const GURL& alternate_nav_url, | 705 const GURL& alternate_nav_url, |
| 701 const base::string16& pasted_text, | 706 const base::string16& pasted_text, |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 // Update state and notify view if the omnibox has focus and the caret | 1465 // Update state and notify view if the omnibox has focus and the caret |
| 1461 // visibility changed. | 1466 // visibility changed. |
| 1462 const bool was_caret_visible = is_caret_visible(); | 1467 const bool was_caret_visible = is_caret_visible(); |
| 1463 focus_state_ = state; | 1468 focus_state_ = state; |
| 1464 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1469 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1465 is_caret_visible() != was_caret_visible) | 1470 is_caret_visible() != was_caret_visible) |
| 1466 view_->ApplyCaretVisibility(); | 1471 view_->ApplyCaretVisibility(); |
| 1467 | 1472 |
| 1468 delegate_->OnFocusChanged(focus_state_, reason); | 1473 delegate_->OnFocusChanged(focus_state_, reason); |
| 1469 } | 1474 } |
| OLD | NEW |