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

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 1396143002: Emit correct NewTabPage.SuggestionsType metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fserb cr feedback Created 5 years, 2 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
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/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { 390 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) {
391 ipc_router_.SendThemeBackgroundInfo(theme_info); 391 ipc_router_.SendThemeBackgroundInfo(theme_info);
392 } 392 }
393 393
394 void SearchTabHelper::MostVisitedItemsChanged( 394 void SearchTabHelper::MostVisitedItemsChanged(
395 const std::vector<InstantMostVisitedItem>& items) { 395 const std::vector<InstantMostVisitedItem>& items) {
396 // When most visited change, the NTP usually reloads the tiles. This means 396 // When most visited change, the NTP usually reloads the tiles. This means
397 // our metrics get inconsistent. So we'd rather emit stats now. 397 // our metrics get inconsistent. So we'd rather emit stats now.
398 InstantTab::EmitNtpStatistics(web_contents_); 398 InstantTab::EmitNtpStatistics(web_contents_);
399 ipc_router_.SendMostVisitedItems(items); 399 ipc_router_.SendMostVisitedItems(items);
400 LogMostVisitedItemsSource(items);
401 }
402
403 void SearchTabHelper::LogMostVisitedItemsSource(
404 const std::vector<InstantMostVisitedItem>& items) {
405 for (auto item : items) {
406 NTPLoggingEventType event;
407 if (item.is_server_side_suggestion) {
408 event = NTP_SERVER_SIDE_SUGGESTION;
409 } else {
410 event = NTP_CLIENT_SIDE_SUGGESTION;
411 }
412 // Note that the ntp_user_data_logger.cc now only supports the scenario:
413 // all suggestions are provided by server OR
414 // all suggestions are provided by client.
415 this->OnLogEvent(event, base::TimeDelta());
beaudoin 2015/12/09 20:12:23 I'm not sure I understand the comment here. Do you
zmin 2015/12/09 20:55:33 Discussed with @beaudoin offline, will update the
416 }
400 } 417 }
401 418
402 void SearchTabHelper::OmniboxStartMarginChanged(int omnibox_start_margin) { 419 void SearchTabHelper::OmniboxStartMarginChanged(int omnibox_start_margin) {
403 ipc_router_.SetOmniboxStartMargin(omnibox_start_margin); 420 ipc_router_.SetOmniboxStartMargin(omnibox_start_margin);
404 } 421 }
405 422
406 void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) { 423 void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) {
407 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. 424 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
408 #if !defined(OS_ANDROID) 425 #if !defined(OS_ANDROID)
409 OmniboxView* omnibox = GetOmniboxView(); 426 OmniboxView* omnibox = GetOmniboxView();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 604
588 bool SearchTabHelper::IsInputInProgress() const { 605 bool SearchTabHelper::IsInputInProgress() const {
589 OmniboxView* omnibox = GetOmniboxView(); 606 OmniboxView* omnibox = GetOmniboxView();
590 return !model_.mode().is_ntp() && omnibox && 607 return !model_.mode().is_ntp() && omnibox &&
591 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; 608 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE;
592 } 609 }
593 610
594 OmniboxView* SearchTabHelper::GetOmniboxView() const { 611 OmniboxView* SearchTabHelper::GetOmniboxView() const {
595 return delegate_ ? delegate_->GetOmniboxView() : NULL; 612 return delegate_ ? delegate_->GetOmniboxView() : NULL;
596 } 613 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/browser/ui/search/search_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698