| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_manager.h" | 5 #include "chrome/browser/translate/translate_manager.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 GetLanguageCode(g_browser_process->GetApplicationLocale()); | 601 GetLanguageCode(g_browser_process->GetApplicationLocale()); |
| 602 if (IsSupportedLanguage(target_lang)) | 602 if (IsSupportedLanguage(target_lang)) |
| 603 return target_lang; | 603 return target_lang; |
| 604 return std::string(); | 604 return std::string(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 // static | 607 // static |
| 608 TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate( | 608 TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate( |
| 609 TabContents* tab) { | 609 TabContents* tab) { |
| 610 for (int i = 0; i < tab->infobar_delegate_count(); ++i) { | 610 for (int i = 0; i < tab->infobar_delegate_count(); ++i) { |
| 611 TranslateInfoBarDelegate* delegate = | 611 InfoBarDelegate* delegate = tab->GetInfoBarDelegateAt(i); |
| 612 tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 612 if (!delegate) { |
| 613 if (delegate) | 613 // Please let jcivelli know if you hit this and how you got to that point. |
| 614 return delegate; | 614 NOTREACHED(); |
| 615 continue; |
| 616 } |
| 617 TranslateInfoBarDelegate* translate_delegate = |
| 618 delegate->AsTranslateInfoBarDelegate(); |
| 619 if (translate_delegate) |
| 620 return translate_delegate; |
| 615 } | 621 } |
| 616 return NULL; | 622 return NULL; |
| 617 } | 623 } |
| OLD | NEW |