Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 21395002: [InstantExtended] Fixing how PageLoadSRP is emitted. Previously it was emitted only for Instant sea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: this time actually fixing merge error correctly Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 const GURL destination_url = autocomplete_controller()-> 721 const GURL destination_url = autocomplete_controller()->
722 GetDestinationURL(match, query_formulation_time); 722 GetDestinationURL(match, query_formulation_time);
723 723
724 RecordPercentageMatchHistogram( 724 RecordPercentageMatchHistogram(
725 permanent_text_, current_text, 725 permanent_text_, current_text,
726 view_->toolbar_model()->WouldReplaceSearchURLWithSearchTerms(false), 726 view_->toolbar_model()->WouldReplaceSearchURLWithSearchTerms(false),
727 match.transition); 727 match.transition);
728 728
729 // Track whether the destination URL sends us to a search results page 729 // Track whether the destination URL sends us to a search results page
730 // using the default search provider. 730 // using the default search provider.
731 TemplateURL* default_provider = 731 if (TemplateURLServiceFactory::GetForProfile(profile_)->
732 TemplateURLServiceFactory::GetForProfile(profile_)-> 732 IsSearchResultsPageFromDefaultSearchProvider(destination_url)) {
733 GetDefaultSearchProvider();
734 if (default_provider && default_provider->IsSearchURL(destination_url))
735 content::RecordAction( 733 content::RecordAction(
736 UserMetricsAction("OmniboxDestinationURLIsSearchOnDSP")); 734 UserMetricsAction("OmniboxDestinationURLIsSearchOnDSP"));
735 }
737 736
738 // This calls RevertAll again. 737 // This calls RevertAll again.
739 base::AutoReset<bool> tmp(&in_revert_, true); 738 base::AutoReset<bool> tmp(&in_revert_, true);
740 controller_->OnAutocompleteAccept(destination_url, disposition, 739 controller_->OnAutocompleteAccept(destination_url, disposition,
741 match.transition, alternate_nav_url); 740 match.transition, alternate_nav_url);
742 } 741 }
743 742
744 if (match.starred) 743 if (match.starred)
745 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); 744 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX);
746 } 745 }
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 const std::string& url = gurl.spec(); 1286 const std::string& url = gurl.spec();
1288 if (url == chrome::kChromeUINewTabURL) 1287 if (url == chrome::kChromeUINewTabURL)
1289 return AutocompleteInput::NEW_TAB_PAGE; 1288 return AutocompleteInput::NEW_TAB_PAGE;
1290 if (url == content::kAboutBlankURL) 1289 if (url == content::kAboutBlankURL)
1291 return AutocompleteInput::BLANK; 1290 return AutocompleteInput::BLANK;
1292 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) 1291 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage))
1293 return AutocompleteInput::HOMEPAGE; 1292 return AutocompleteInput::HOMEPAGE;
1294 if (view_->toolbar_model()->WouldReplaceSearchURLWithSearchTerms(true)) { 1293 if (view_->toolbar_model()->WouldReplaceSearchURLWithSearchTerms(true)) {
1295 return AutocompleteInput::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT; 1294 return AutocompleteInput::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT;
1296 } 1295 }
1296 if (delegate_->IsSearchResultsPage()) {
1297 return AutocompleteInput::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT;
1298 }
1297 return AutocompleteInput::OTHER; 1299 return AutocompleteInput::OTHER;
1298 } 1300 }
1299 1301
1300 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1302 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1301 const string16& text, 1303 const string16& text,
1302 AutocompleteMatch* match, 1304 AutocompleteMatch* match,
1303 GURL* alternate_nav_url) const { 1305 GURL* alternate_nav_url) const {
1304 DCHECK(match); 1306 DCHECK(match);
1305 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1307 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1306 false, false, match, alternate_nav_url); 1308 false, false, match, alternate_nav_url);
1307 } 1309 }
1308 1310
1309 void OmniboxEditModel::SetFocusState(OmniboxFocusState state, 1311 void OmniboxEditModel::SetFocusState(OmniboxFocusState state,
1310 OmniboxFocusChangeReason reason) { 1312 OmniboxFocusChangeReason reason) {
1311 if (state == focus_state_) 1313 if (state == focus_state_)
1312 return; 1314 return;
1313 1315
1314 InstantController* instant = GetInstantController(); 1316 InstantController* instant = GetInstantController();
1315 if (instant) 1317 if (instant)
1316 instant->OmniboxFocusChanged(state, reason, NULL); 1318 instant->OmniboxFocusChanged(state, reason, NULL);
1317 1319
1318 // Update state and notify view if the omnibox has focus and the caret 1320 // Update state and notify view if the omnibox has focus and the caret
1319 // visibility changed. 1321 // visibility changed.
1320 const bool was_caret_visible = is_caret_visible(); 1322 const bool was_caret_visible = is_caret_visible();
1321 focus_state_ = state; 1323 focus_state_ = state;
1322 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1324 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1323 is_caret_visible() != was_caret_visible) 1325 is_caret_visible() != was_caret_visible)
1324 view_->ApplyCaretVisibility(); 1326 view_->ApplyCaretVisibility();
1325 } 1327 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc ('k') | chrome/browser/ui/uma_browsing_activity_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698