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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 void SearchTabHelper::OnUndoAllMostVisitedDeletions() { | 531 void SearchTabHelper::OnUndoAllMostVisitedDeletions() { |
532 if (instant_service_) | 532 if (instant_service_) |
533 instant_service_->UndoAllMostVisitedDeletions(); | 533 instant_service_->UndoAllMostVisitedDeletions(); |
534 } | 534 } |
535 | 535 |
536 void SearchTabHelper::OnLogEvent(NTPLoggingEventType event) { | 536 void SearchTabHelper::OnLogEvent(NTPLoggingEventType event) { |
537 NTPUserDataLogger::GetOrCreateFromWebContents( | 537 NTPUserDataLogger::GetOrCreateFromWebContents( |
538 web_contents())->LogEvent(event); | 538 web_contents())->LogEvent(event); |
539 } | 539 } |
540 | 540 |
541 void SearchTabHelper::OnLogImpression(int position, | 541 void SearchTabHelper::OnLogMostVisitedImpression( |
542 const base::string16& provider) { | 542 int position, const base::string16& provider) { |
543 NTPUserDataLogger::GetOrCreateFromWebContents( | 543 NTPUserDataLogger::GetOrCreateFromWebContents( |
544 web_contents())->LogImpression(position, provider); | 544 web_contents())->LogMostVisitedImpression(position, provider); |
| 545 } |
| 546 |
| 547 void SearchTabHelper::OnLogMostVisitedNavigation( |
| 548 int position, const base::string16& provider) { |
| 549 NTPUserDataLogger::GetOrCreateFromWebContents( |
| 550 web_contents())->LogMostVisitedNavigation(position, provider); |
545 } | 551 } |
546 | 552 |
547 void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { | 553 void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { |
548 OmniboxView* omnibox = GetOmniboxView(web_contents()); | 554 OmniboxView* omnibox = GetOmniboxView(web_contents()); |
549 if (!omnibox) | 555 if (!omnibox) |
550 return; | 556 return; |
551 | 557 |
552 // The first case is for right click to paste, where the text is retrieved | 558 // The first case is for right click to paste, where the text is retrieved |
553 // from the clipboard already sanitized. The second case is needed to handle | 559 // from the clipboard already sanitized. The second case is needed to handle |
554 // drag-and-drop value and it has to be sanitazed before setting it into the | 560 // drag-and-drop value and it has to be sanitazed before setting it into the |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // Don't push a history entry. | 636 // Don't push a history entry. |
631 load_params.should_replace_current_entry = true; | 637 load_params.should_replace_current_entry = true; |
632 web_contents_->GetController().LoadURLWithParams(load_params); | 638 web_contents_->GetController().LoadURLWithParams(load_params); |
633 } | 639 } |
634 | 640 |
635 bool SearchTabHelper::IsInputInProgress() const { | 641 bool SearchTabHelper::IsInputInProgress() const { |
636 OmniboxView* omnibox = GetOmniboxView(web_contents()); | 642 OmniboxView* omnibox = GetOmniboxView(web_contents()); |
637 return !model_.mode().is_ntp() && omnibox && | 643 return !model_.mode().is_ntp() && omnibox && |
638 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 644 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
639 } | 645 } |
OLD | NEW |