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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 if (instant_service_) | 461 if (instant_service_) |
462 instant_service_->UndoMostVisitedDeletion(url); | 462 instant_service_->UndoMostVisitedDeletion(url); |
463 } | 463 } |
464 | 464 |
465 void SearchTabHelper::OnUndoAllMostVisitedDeletions() { | 465 void SearchTabHelper::OnUndoAllMostVisitedDeletions() { |
466 if (instant_service_) | 466 if (instant_service_) |
467 instant_service_->UndoAllMostVisitedDeletions(); | 467 instant_service_->UndoAllMostVisitedDeletions(); |
468 } | 468 } |
469 | 469 |
470 void SearchTabHelper::OnLogEvent(NTPLoggingEventType event) { | 470 void SearchTabHelper::OnLogEvent(NTPLoggingEventType event) { |
| 471 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. |
| 472 #if !defined(OS_ANDROID) |
471 NTPUserDataLogger::GetOrCreateFromWebContents( | 473 NTPUserDataLogger::GetOrCreateFromWebContents( |
472 web_contents())->LogEvent(event); | 474 web_contents())->LogEvent(event); |
| 475 #endif |
473 } | 476 } |
474 | 477 |
475 void SearchTabHelper::OnLogMostVisitedImpression( | 478 void SearchTabHelper::OnLogMostVisitedImpression( |
476 int position, const base::string16& provider) { | 479 int position, const base::string16& provider) { |
| 480 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. |
| 481 #if !defined(OS_ANDROID) |
477 NTPUserDataLogger::GetOrCreateFromWebContents( | 482 NTPUserDataLogger::GetOrCreateFromWebContents( |
478 web_contents())->LogMostVisitedImpression(position, provider); | 483 web_contents())->LogMostVisitedImpression(position, provider); |
| 484 #endif |
479 } | 485 } |
480 | 486 |
481 void SearchTabHelper::OnLogMostVisitedNavigation( | 487 void SearchTabHelper::OnLogMostVisitedNavigation( |
482 int position, const base::string16& provider) { | 488 int position, const base::string16& provider) { |
| 489 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. |
| 490 #if !defined(OS_ANDROID) |
483 NTPUserDataLogger::GetOrCreateFromWebContents( | 491 NTPUserDataLogger::GetOrCreateFromWebContents( |
484 web_contents())->LogMostVisitedNavigation(position, provider); | 492 web_contents())->LogMostVisitedNavigation(position, provider); |
| 493 #endif |
485 } | 494 } |
486 | 495 |
487 void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { | 496 void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { |
488 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. | 497 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. |
489 #if !defined(OS_ANDROID) | 498 #if !defined(OS_ANDROID) |
490 OmniboxView* omnibox = GetOmniboxView(); | 499 OmniboxView* omnibox = GetOmniboxView(); |
491 if (!omnibox) | 500 if (!omnibox) |
492 return; | 501 return; |
493 // The first case is for right click to paste, where the text is retrieved | 502 // The first case is for right click to paste, where the text is retrieved |
494 // from the clipboard already sanitized. The second case is needed to handle | 503 // from the clipboard already sanitized. The second case is needed to handle |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 585 |
577 bool SearchTabHelper::IsInputInProgress() const { | 586 bool SearchTabHelper::IsInputInProgress() const { |
578 OmniboxView* omnibox = GetOmniboxView(); | 587 OmniboxView* omnibox = GetOmniboxView(); |
579 return !model_.mode().is_ntp() && omnibox && | 588 return !model_.mode().is_ntp() && omnibox && |
580 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 589 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
581 } | 590 } |
582 | 591 |
583 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 592 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
584 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 593 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
585 } | 594 } |
OLD | NEW |