| 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_infobar_delegate.h" | 5 #include "chrome/browser/google/google_url_tracker_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/api/infobars/infobar_service.h" | 7 #include "chrome/browser/api/infobars/infobar_service.h" |
| 8 #include "chrome/browser/google/google_url_tracker.h" | 8 #include "chrome/browser/google/google_url_tracker.h" |
| 9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
| 10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool GoogleURLTrackerInfoBarDelegate::ShouldExpireInternal( | 54 bool GoogleURLTrackerInfoBarDelegate::ShouldExpireInternal( |
| 55 const content::LoadCommittedDetails& details) const { | 55 const content::LoadCommittedDetails& details) const { |
| 56 int unique_id = details.entry->GetUniqueID(); | 56 int unique_id = details.entry->GetUniqueID(); |
| 57 return (unique_id != contents_unique_id()) && (unique_id != pending_id_); | 57 return (unique_id != contents_unique_id()) && (unique_id != pending_id_); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void GoogleURLTrackerInfoBarDelegate::Update(const GURL& search_url) { | 60 void GoogleURLTrackerInfoBarDelegate::Update(const GURL& search_url) { |
| 61 StoreActiveEntryUniqueID(owner()); | 61 StoreActiveEntryUniqueID(); |
| 62 search_url_ = search_url; | 62 search_url_ = search_url; |
| 63 pending_id_ = 0; | 63 pending_id_ = 0; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void GoogleURLTrackerInfoBarDelegate::Close(bool redo_search) { | 66 void GoogleURLTrackerInfoBarDelegate::Close(bool redo_search) { |
| 67 if (redo_search) { | 67 if (redo_search) { |
| 68 // Re-do the user's search on the new domain. | 68 // Re-do the user's search on the new domain. |
| 69 DCHECK(search_url_.is_valid()); | 69 DCHECK(search_url_.is_valid()); |
| 70 url_canon::Replacements<char> replacements; | 70 url_canon::Replacements<char> replacements; |
| 71 const std::string& host(google_url_tracker_->fetched_google_url().host()); | 71 const std::string& host(google_url_tracker_->fetched_google_url().host()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 InfoBarButton button) const { | 95 InfoBarButton button) const { |
| 96 if (button == BUTTON_OK) { | 96 if (button == BUTTON_OK) { |
| 97 return l10n_util::GetStringFUTF16( | 97 return l10n_util::GetStringFUTF16( |
| 98 IDS_GOOGLE_URL_TRACKER_INFOBAR_SWITCH, | 98 IDS_GOOGLE_URL_TRACKER_INFOBAR_SWITCH, |
| 99 net::StripWWWFromHost(google_url_tracker_->fetched_google_url())); | 99 net::StripWWWFromHost(google_url_tracker_->fetched_google_url())); |
| 100 } | 100 } |
| 101 return l10n_util::GetStringFUTF16( | 101 return l10n_util::GetStringFUTF16( |
| 102 IDS_GOOGLE_URL_TRACKER_INFOBAR_DONT_SWITCH, | 102 IDS_GOOGLE_URL_TRACKER_INFOBAR_DONT_SWITCH, |
| 103 net::StripWWWFromHost(google_url_tracker_->google_url())); | 103 net::StripWWWFromHost(google_url_tracker_->google_url())); |
| 104 } | 104 } |
| OLD | NEW |