| 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 <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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 DCHECK(!url.is_empty()); | 471 DCHECK(!url.is_empty()); |
| 472 if (instant_service_) | 472 if (instant_service_) |
| 473 instant_service_->UndoMostVisitedDeletion(url); | 473 instant_service_->UndoMostVisitedDeletion(url); |
| 474 } | 474 } |
| 475 | 475 |
| 476 void SearchTabHelper::OnUndoAllMostVisitedDeletions() { | 476 void SearchTabHelper::OnUndoAllMostVisitedDeletions() { |
| 477 if (instant_service_) | 477 if (instant_service_) |
| 478 instant_service_->UndoAllMostVisitedDeletions(); | 478 instant_service_->UndoAllMostVisitedDeletions(); |
| 479 } | 479 } |
| 480 | 480 |
| 481 void SearchTabHelper::OnLogEvent(NTPLoggingEventType event) { | 481 void SearchTabHelper::OnLogEvent(NTPLoggingEventType event, |
| 482 base::TimeDelta time) { |
| 482 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. | 483 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. |
| 483 #if !defined(OS_ANDROID) | 484 #if !defined(OS_ANDROID) |
| 484 NTPUserDataLogger::GetOrCreateFromWebContents( | 485 NTPUserDataLogger::GetOrCreateFromWebContents(web_contents()) |
| 485 web_contents())->LogEvent(event); | 486 ->LogEvent(event, time); |
| 486 #endif | 487 #endif |
| 487 } | 488 } |
| 488 | 489 |
| 489 void SearchTabHelper::OnLogMostVisitedImpression( | 490 void SearchTabHelper::OnLogMostVisitedImpression( |
| 490 int position, const base::string16& provider) { | 491 int position, const base::string16& provider) { |
| 491 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. | 492 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. |
| 492 #if !defined(OS_ANDROID) | 493 #if !defined(OS_ANDROID) |
| 493 NTPUserDataLogger::GetOrCreateFromWebContents( | 494 NTPUserDataLogger::GetOrCreateFromWebContents( |
| 494 web_contents())->LogMostVisitedImpression(position, provider); | 495 web_contents())->LogMostVisitedImpression(position, provider); |
| 495 #endif | 496 #endif |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 591 |
| 591 bool SearchTabHelper::IsInputInProgress() const { | 592 bool SearchTabHelper::IsInputInProgress() const { |
| 592 OmniboxView* omnibox = GetOmniboxView(); | 593 OmniboxView* omnibox = GetOmniboxView(); |
| 593 return !model_.mode().is_ntp() && omnibox && | 594 return !model_.mode().is_ntp() && omnibox && |
| 594 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 595 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 595 } | 596 } |
| 596 | 597 |
| 597 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 598 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 598 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 599 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 599 } | 600 } |
| OLD | NEW |