| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::OnLogImpression(int position, |
| 542 const base::string16& provider) { | 542 const base::string16& provider) { |
| 543 NTPUserDataLogger::GetOrCreateFromWebContents( | 543 NTPUserDataLogger::GetOrCreateFromWebContents( |
| 544 web_contents())->LogImpression(position, provider); | 544 web_contents())->LogImpression(position, provider); |
| 545 } | 545 } |
| 546 | 546 |
| 547 void SearchTabHelper::OnLogNavigation(int position, |
| 548 const base::string16& provider) { |
| 549 NTPUserDataLogger::GetOrCreateFromWebContents( |
| 550 web_contents())->LogNavigation(position, provider); |
| 551 } |
| 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 |
| 555 // omnibox. | 561 // omnibox. |
| 556 base::string16 text_to_paste = text.empty() ? omnibox->GetClipboardText() : | 562 base::string16 text_to_paste = text.empty() ? omnibox->GetClipboardText() : |
| (...skipping 73 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 |