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

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

Issue 20043003: Omnibox Logging: Record Whether the User Was on a Search Results Page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 if (url == chrome::kChromeUINewTabURL) 1267 if (url == chrome::kChromeUINewTabURL)
1268 return metrics::OmniboxEventProto::NEW_TAB_PAGE; 1268 return metrics::OmniboxEventProto::NEW_TAB_PAGE;
1269 if (url == content::kAboutBlankURL) 1269 if (url == content::kAboutBlankURL)
1270 return metrics::OmniboxEventProto::BLANK; 1270 return metrics::OmniboxEventProto::BLANK;
1271 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) 1271 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage))
1272 return metrics::OmniboxEventProto::HOMEPAGE; 1272 return metrics::OmniboxEventProto::HOMEPAGE;
1273 if (view_->toolbar_model()->WouldReplaceSearchURLWithSearchTerms(true)) { 1273 if (view_->toolbar_model()->WouldReplaceSearchURLWithSearchTerms(true)) {
1274 return metrics:: 1274 return metrics::
1275 OmniboxEventProto::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT; 1275 OmniboxEventProto::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT;
1276 } 1276 }
1277 if (delegate_->IsSearchResultsPage()) {
1278 return metrics::
1279 OmniboxEventProto::SEARCH_RESULT_PAGE_NOT_DOING_SEARCH_TERM_REPLACEMENT;
1280 }
1277 return metrics::OmniboxEventProto::OTHER; 1281 return metrics::OmniboxEventProto::OTHER;
1278 } 1282 }
1279 1283
1280 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1284 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1281 const string16& text, 1285 const string16& text,
1282 AutocompleteMatch* match, 1286 AutocompleteMatch* match,
1283 GURL* alternate_nav_url) const { 1287 GURL* alternate_nav_url) const {
1284 DCHECK(match); 1288 DCHECK(match);
1285 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1289 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1286 false, false, match, alternate_nav_url); 1290 false, false, match, alternate_nav_url);
1287 } 1291 }
1288 1292
1289 void OmniboxEditModel::SetFocusState(OmniboxFocusState state, 1293 void OmniboxEditModel::SetFocusState(OmniboxFocusState state,
1290 OmniboxFocusChangeReason reason) { 1294 OmniboxFocusChangeReason reason) {
1291 if (state == focus_state_) 1295 if (state == focus_state_)
1292 return; 1296 return;
1293 1297
1294 InstantController* instant = GetInstantController(); 1298 InstantController* instant = GetInstantController();
1295 if (instant) 1299 if (instant)
1296 instant->OmniboxFocusChanged(state, reason, NULL); 1300 instant->OmniboxFocusChanged(state, reason, NULL);
1297 1301
1298 // Update state and notify view if the omnibox has focus and the caret 1302 // Update state and notify view if the omnibox has focus and the caret
1299 // visibility changed. 1303 // visibility changed.
1300 const bool was_caret_visible = is_caret_visible(); 1304 const bool was_caret_visible = is_caret_visible();
1301 focus_state_ = state; 1305 focus_state_ = state;
1302 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1306 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1303 is_caret_visible() != was_caret_visible) 1307 is_caret_visible() != was_caret_visible)
1304 view_->ApplyCaretVisibility(); 1308 view_->ApplyCaretVisibility();
1305 } 1309 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc ('k') | chrome/common/metrics/proto/omnibox_event.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698