| 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_manager.h" | 5 #include "chrome/browser/translate/translate_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 const int kTranslateScriptExpirationDelayMS = 24 * 60 * 60 * 1000; // 1 day. | 134 const int kTranslateScriptExpirationDelayMS = 24 * 60 * 60 * 1000; // 1 day. |
| 135 | 135 |
| 136 } // namespace | 136 } // namespace |
| 137 | 137 |
| 138 // This must be kept in sync with the &cb= value in the kLanguageListFetchURL. | 138 // This must be kept in sync with the &cb= value in the kLanguageListFetchURL. |
| 139 const char* const TranslateManager::kLanguageListCallbackName = "sl("; | 139 const char* const TranslateManager::kLanguageListCallbackName = "sl("; |
| 140 const char* const TranslateManager::kTargetLanguagesKey = "tl"; | 140 const char* const TranslateManager::kTargetLanguagesKey = "tl"; |
| 141 | 141 |
| 142 // static | 142 // static |
| 143 base::LazyInstance<std::set<std::string> > | 143 base::LazyInstance<std::set<std::string> > |
| 144 TranslateManager::supported_languages_(base::LINKER_INITIALIZED); | 144 TranslateManager::supported_languages_ = LAZY_INSTANCE_INITIALIZER; |
| 145 | 145 |
| 146 TranslateManager::~TranslateManager() { | 146 TranslateManager::~TranslateManager() { |
| 147 weak_method_factory_.InvalidateWeakPtrs(); | 147 weak_method_factory_.InvalidateWeakPtrs(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // static | 150 // static |
| 151 TranslateManager* TranslateManager::GetInstance() { | 151 TranslateManager* TranslateManager::GetInstance() { |
| 152 return Singleton<TranslateManager>::get(); | 152 return Singleton<TranslateManager>::get(); |
| 153 } | 153 } |
| 154 | 154 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); | 828 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); |
| 829 | 829 |
| 830 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 830 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
| 831 TranslateInfoBarDelegate* delegate = | 831 TranslateInfoBarDelegate* delegate = |
| 832 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 832 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
| 833 if (delegate) | 833 if (delegate) |
| 834 return delegate; | 834 return delegate; |
| 835 } | 835 } |
| 836 return NULL; | 836 return NULL; |
| 837 } | 837 } |
| OLD | NEW |