| 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/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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 352 |
| 353 void TranslateInfoBarDelegate::InfoBarDismissed() { | 353 void TranslateInfoBarDelegate::InfoBarDismissed() { |
| 354 if (type_ != BEFORE_TRANSLATE) | 354 if (type_ != BEFORE_TRANSLATE) |
| 355 return; | 355 return; |
| 356 | 356 |
| 357 // The user closed the infobar without clicking the translate button. | 357 // The user closed the infobar without clicking the translate button. |
| 358 TranslationDeclined(); | 358 TranslationDeclined(); |
| 359 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslateCloseInfobar", 1); | 359 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslateCloseInfobar", 1); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void TranslateInfoBarDelegate::InfoBarClosed() { | |
| 363 delete this; | |
| 364 } | |
| 365 | |
| 366 gfx::Image* TranslateInfoBarDelegate::GetIcon() const { | 362 gfx::Image* TranslateInfoBarDelegate::GetIcon() const { |
| 367 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 363 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 368 IDR_INFOBAR_TRANSLATE); | 364 IDR_INFOBAR_TRANSLATE); |
| 369 } | 365 } |
| 370 | 366 |
| 371 InfoBarDelegate::Type TranslateInfoBarDelegate::GetInfoBarType() const { | 367 InfoBarDelegate::Type TranslateInfoBarDelegate::GetInfoBarType() const { |
| 372 return PAGE_ACTION_TYPE; | 368 return PAGE_ACTION_TYPE; |
| 373 } | 369 } |
| 374 | 370 |
| 375 TranslateInfoBarDelegate* | 371 TranslateInfoBarDelegate* |
| 376 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 372 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 377 return this; | 373 return this; |
| 378 } | 374 } |
| 379 | 375 |
| 380 std::string TranslateInfoBarDelegate::GetPageHost() { | 376 std::string TranslateInfoBarDelegate::GetPageHost() { |
| 381 NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); | 377 NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); |
| 382 return entry ? entry->url().HostNoBrackets() : std::string(); | 378 return entry ? entry->url().HostNoBrackets() : std::string(); |
| 383 } | 379 } |
| OLD | NEW |