| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 string16 GoogleURLTrackerInfoBarDelegate::GetLinkText() const { | 68 string16 GoogleURLTrackerInfoBarDelegate::GetLinkText() const { |
| 69 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 69 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool GoogleURLTrackerInfoBarDelegate::LinkClicked( | 72 bool GoogleURLTrackerInfoBarDelegate::LinkClicked( |
| 73 WindowOpenDisposition disposition) { | 73 WindowOpenDisposition disposition) { |
| 74 owner()->tab_contents()->OpenURL(google_util::AppendGoogleLocaleParam(GURL( | 74 owner()->tab_contents()->OpenURL(google_util::AppendGoogleLocaleParam(GURL( |
| 75 "https://www.google.com/support/chrome/bin/answer.py?answer=1618699")), | 75 "https://www.google.com/support/chrome/bin/answer.py?answer=1618699")), |
| 76 GURL(), (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 76 GURL(), (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 77 PageTransition::LINK); | 77 content::PAGE_TRANSITION_LINK); |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 GoogleURLTrackerInfoBarDelegate::~GoogleURLTrackerInfoBarDelegate() { | 81 GoogleURLTrackerInfoBarDelegate::~GoogleURLTrackerInfoBarDelegate() { |
| 82 google_url_tracker_->InfoBarClosed(); | 82 google_url_tracker_->InfoBarClosed(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 string16 GoogleURLTrackerInfoBarDelegate::GetMessageText() const { | 85 string16 GoogleURLTrackerInfoBarDelegate::GetMessageText() const { |
| 86 return l10n_util::GetStringFUTF16(IDS_GOOGLE_URL_TRACKER_INFOBAR_MESSAGE, | 86 return l10n_util::GetStringFUTF16(IDS_GOOGLE_URL_TRACKER_INFOBAR_MESSAGE, |
| 87 GetHost(true), GetHost(false)); | 87 GetHost(true), GetHost(false)); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 void GoogleURLTracker::RedoSearch() { | 301 void GoogleURLTracker::RedoSearch() { |
| 302 // Re-do the user's search on the new domain. | 302 // Re-do the user's search on the new domain. |
| 303 DCHECK(controller_); | 303 DCHECK(controller_); |
| 304 url_canon::Replacements<char> replacements; | 304 url_canon::Replacements<char> replacements; |
| 305 replacements.SetHost(google_url_.host().data(), | 305 replacements.SetHost(google_url_.host().data(), |
| 306 url_parse::Component(0, google_url_.host().length())); | 306 url_parse::Component(0, google_url_.host().length())); |
| 307 GURL new_search_url(search_url_.ReplaceComponents(replacements)); | 307 GURL new_search_url(search_url_.ReplaceComponents(replacements)); |
| 308 if (new_search_url.is_valid()) | 308 if (new_search_url.is_valid()) |
| 309 controller_->tab_contents()->OpenURL(new_search_url, GURL(), CURRENT_TAB, | 309 controller_->tab_contents()->OpenURL(new_search_url, GURL(), CURRENT_TAB, |
| 310 PageTransition::GENERATED); | 310 content::PAGE_TRANSITION_GENERATED); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void GoogleURLTracker::Observe(int type, | 313 void GoogleURLTracker::Observe(int type, |
| 314 const NotificationSource& source, | 314 const NotificationSource& source, |
| 315 const NotificationDetails& details) { | 315 const NotificationDetails& details) { |
| 316 switch (type) { | 316 switch (type) { |
| 317 case content::NOTIFICATION_NAV_ENTRY_PENDING: { | 317 case content::NOTIFICATION_NAV_ENTRY_PENDING: { |
| 318 NavigationController* controller = | 318 NavigationController* controller = |
| 319 Source<NavigationController>(source).ptr(); | 319 Source<NavigationController>(source).ptr(); |
| 320 OnNavigationPending(source, controller->pending_entry()->url()); | 320 OnNavigationPending(source, controller->pending_entry()->url()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 // |tab_contents| can be NULL during tests. | 383 // |tab_contents| can be NULL during tests. |
| 384 InfoBarTabHelper* infobar_helper = NULL; | 384 InfoBarTabHelper* infobar_helper = NULL; |
| 385 if (tab_contents) { | 385 if (tab_contents) { |
| 386 TabContentsWrapper* wrapper = | 386 TabContentsWrapper* wrapper = |
| 387 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 387 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 388 infobar_helper = wrapper->infobar_tab_helper(); | 388 infobar_helper = wrapper->infobar_tab_helper(); |
| 389 } | 389 } |
| 390 infobar_ = (*infobar_creator_)(infobar_helper, this, fetched_google_url_); | 390 infobar_ = (*infobar_creator_)(infobar_helper, this, fetched_google_url_); |
| 391 } | 391 } |
| OLD | NEW |