| 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/translate/translate_infobar_delegate.h" | 5 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/i18n/string_compare.h" | 9 #include "base/i18n/string_compare.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 void TranslateInfoBarDelegate::InfoBarDismissed() { | 363 void TranslateInfoBarDelegate::InfoBarDismissed() { |
| 364 if (infobar_type_ != BEFORE_TRANSLATE) | 364 if (infobar_type_ != BEFORE_TRANSLATE) |
| 365 return; | 365 return; |
| 366 | 366 |
| 367 // The user closed the infobar without clicking the translate button. | 367 // The user closed the infobar without clicking the translate button. |
| 368 TranslationDeclined(); | 368 TranslationDeclined(); |
| 369 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslateCloseInfobar", 1); | 369 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslateCloseInfobar", 1); |
| 370 } | 370 } |
| 371 | 371 |
| 372 gfx::Image* TranslateInfoBarDelegate::GetIcon() const { | 372 int TranslateInfoBarDelegate::GetIconID() const { |
| 373 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 373 return IDR_INFOBAR_TRANSLATE; |
| 374 IDR_INFOBAR_TRANSLATE); | |
| 375 } | 374 } |
| 376 | 375 |
| 377 InfoBarDelegate::Type TranslateInfoBarDelegate::GetInfoBarType() const { | 376 InfoBarDelegate::Type TranslateInfoBarDelegate::GetInfoBarType() const { |
| 378 return PAGE_ACTION_TYPE; | 377 return PAGE_ACTION_TYPE; |
| 379 } | 378 } |
| 380 | 379 |
| 381 TranslateInfoBarDelegate* | 380 TranslateInfoBarDelegate* |
| 382 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 381 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 383 return this; | 382 return this; |
| 384 } | 383 } |
| 385 | 384 |
| 386 std::string TranslateInfoBarDelegate::GetPageHost() { | 385 std::string TranslateInfoBarDelegate::GetPageHost() { |
| 387 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); | 386 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); |
| 388 return entry ? entry->GetURL().HostNoBrackets() : std::string(); | 387 return entry ? entry->GetURL().HostNoBrackets() : std::string(); |
| 389 } | 388 } |
| OLD | NEW |