| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 80 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool GoogleURLTrackerInfoBarDelegate::LinkClicked( | 83 bool GoogleURLTrackerInfoBarDelegate::LinkClicked( |
| 84 WindowOpenDisposition disposition) { | 84 WindowOpenDisposition disposition) { |
| 85 content::OpenURLParams params(google_util::AppendGoogleLocaleParam(GURL( | 85 content::OpenURLParams params(google_util::AppendGoogleLocaleParam(GURL( |
| 86 "https://www.google.com/support/chrome/bin/answer.py?answer=1618699")), | 86 "https://www.google.com/support/chrome/bin/answer.py?answer=1618699")), |
| 87 content::Referrer(), | 87 content::Referrer(), |
| 88 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 88 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 89 content::PAGE_TRANSITION_LINK, false); | 89 content::PAGE_TRANSITION_LINK, false); |
| 90 owner()->web_contents()->OpenURL(params); | 90 owner()->GetWebContents()->OpenURL(params); |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool GoogleURLTrackerInfoBarDelegate::ShouldExpireInternal( | 94 bool GoogleURLTrackerInfoBarDelegate::ShouldExpireInternal( |
| 95 const content::LoadCommittedDetails& details) const { | 95 const content::LoadCommittedDetails& details) const { |
| 96 int unique_id = details.entry->GetUniqueID(); | 96 int unique_id = details.entry->GetUniqueID(); |
| 97 return (unique_id != contents_unique_id()) && (unique_id != pending_id_); | 97 return (unique_id != contents_unique_id()) && (unique_id != pending_id_); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void GoogleURLTrackerInfoBarDelegate::SetGoogleURL(const GURL& new_google_url) { | 100 void GoogleURLTrackerInfoBarDelegate::SetGoogleURL(const GURL& new_google_url) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (redo_search) { | 141 if (redo_search) { |
| 142 // Re-do the user's search on the new domain. | 142 // Re-do the user's search on the new domain. |
| 143 DCHECK(search_url_.is_valid()); | 143 DCHECK(search_url_.is_valid()); |
| 144 url_canon::Replacements<char> replacements; | 144 url_canon::Replacements<char> replacements; |
| 145 const std::string& host(new_google_url_.host()); | 145 const std::string& host(new_google_url_.host()); |
| 146 replacements.SetHost(host.data(), url_parse::Component(0, host.length())); | 146 replacements.SetHost(host.data(), url_parse::Component(0, host.length())); |
| 147 GURL new_search_url(search_url_.ReplaceComponents(replacements)); | 147 GURL new_search_url(search_url_.ReplaceComponents(replacements)); |
| 148 if (new_search_url.is_valid()) { | 148 if (new_search_url.is_valid()) { |
| 149 content::OpenURLParams params(new_search_url, content::Referrer(), | 149 content::OpenURLParams params(new_search_url, content::Referrer(), |
| 150 CURRENT_TAB, content::PAGE_TRANSITION_GENERATED, false); | 150 CURRENT_TAB, content::PAGE_TRANSITION_GENERATED, false); |
| 151 owner()->web_contents()->OpenURL(params); | 151 owner()->GetWebContents()->OpenURL(params); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 owner()->RemoveInfoBar(this); | 155 owner()->RemoveInfoBar(this); |
| 156 } | 156 } |
| 157 | 157 |
| 158 GoogleURLTrackerInfoBarDelegate::~GoogleURLTrackerInfoBarDelegate() { | 158 GoogleURLTrackerInfoBarDelegate::~GoogleURLTrackerInfoBarDelegate() { |
| 159 if (google_url_tracker_) | 159 if (google_url_tracker_) |
| 160 google_url_tracker_->InfoBarClosed(map_key_); | 160 google_url_tracker_->InfoBarClosed(map_key_); |
| 161 } | 161 } |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 const bool registered_for_tab_contents_destroyed = | 629 const bool registered_for_tab_contents_destroyed = |
| 630 registrar_.IsRegistered(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, | 630 registrar_.IsRegistered(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
| 631 map_entry.tab_contents_source); | 631 map_entry.tab_contents_source); |
| 632 DCHECK_NE(registered_for_tab_contents_destroyed, | 632 DCHECK_NE(registered_for_tab_contents_destroyed, |
| 633 map_entry.infobar->showing()); | 633 map_entry.infobar->showing()); |
| 634 if (registered_for_tab_contents_destroyed) { | 634 if (registered_for_tab_contents_destroyed) { |
| 635 registrar_.Remove(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, | 635 registrar_.Remove(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
| 636 map_entry.tab_contents_source); | 636 map_entry.tab_contents_source); |
| 637 } | 637 } |
| 638 } | 638 } |
| OLD | NEW |