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/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { | 382 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { |
383 ipc_router_.SendThemeBackgroundInfo(theme_info); | 383 ipc_router_.SendThemeBackgroundInfo(theme_info); |
384 } | 384 } |
385 | 385 |
386 void SearchTabHelper::MostVisitedItemsChanged( | 386 void SearchTabHelper::MostVisitedItemsChanged( |
387 const std::vector<InstantMostVisitedItem>& items) { | 387 const std::vector<InstantMostVisitedItem>& items) { |
388 // When most visited change, the NTP usually reloads the tiles. This means | 388 // When most visited change, the NTP usually reloads the tiles. This means |
389 // our metrics get inconsistent. So we'd rather emit stats now. | 389 // our metrics get inconsistent. So we'd rather emit stats now. |
390 InstantTab::EmitNtpStatistics(web_contents_); | 390 InstantTab::MostVisitedItemsChanged(web_contents_); |
391 ipc_router_.SendMostVisitedItems(items); | 391 ipc_router_.SendMostVisitedItems(items); |
392 LogMostVisitedItemsSource(items); | 392 LogMostVisitedItemsSource(items); |
393 } | 393 } |
394 | 394 |
395 void SearchTabHelper::LogMostVisitedItemsSource( | 395 void SearchTabHelper::LogMostVisitedItemsSource( |
396 const std::vector<InstantMostVisitedItem>& items) { | 396 const std::vector<InstantMostVisitedItem>& items) { |
397 for (auto item : items) { | 397 for (auto item : items) { |
398 NTPLoggingEventType event; | 398 NTPLoggingEventType event; |
399 if (item.is_server_side_suggestion) { | 399 if (item.is_server_side_suggestion) { |
400 event = NTP_SERVER_SIDE_SUGGESTION; | 400 event = NTP_SERVER_SIDE_SUGGESTION; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 bool SearchTabHelper::IsInputInProgress() const { | 582 bool SearchTabHelper::IsInputInProgress() const { |
583 OmniboxView* omnibox = GetOmniboxView(); | 583 OmniboxView* omnibox = GetOmniboxView(); |
584 return !model_.mode().is_ntp() && omnibox && | 584 return !model_.mode().is_ntp() && omnibox && |
585 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 585 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
586 } | 586 } |
587 | 587 |
588 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 588 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
589 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 589 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
590 } | 590 } |
OLD | NEW |