| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/translate/core/browser/translate_download_manager.h" | 5 #include "components/translate/core/browser/translate_download_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 language_list->RequestLanguageList(); | 41 language_list->RequestLanguageList(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 void TranslateDownloadManager::RequestLanguageList(PrefService* prefs) { | 45 void TranslateDownloadManager::RequestLanguageList(PrefService* prefs) { |
| 46 // We don't want to do this when translate is disabled. | 46 // We don't want to do this when translate is disabled. |
| 47 DCHECK(prefs != NULL); | 47 DCHECK(prefs != NULL); |
| 48 if (CommandLine::ForCurrentProcess()->HasSwitch( | 48 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 49 translate::switches::kDisableTranslate) || | 49 translate::switches::kDisableTranslate) || |
| 50 !prefs->GetBoolean(prefs::kEnableTranslate)) { | 50 !prefs->GetBoolean(prefs::kEnableTranslate)) { |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| 54 RequestLanguageList(); | 54 RequestLanguageList(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 void TranslateDownloadManager::GetSupportedLanguages( | 58 void TranslateDownloadManager::GetSupportedLanguages( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 void TranslateDownloadManager::SetTranslateScriptExpirationDelay(int delay_ms) { | 128 void TranslateDownloadManager::SetTranslateScriptExpirationDelay(int delay_ms) { |
| 129 if (script_.get() == NULL) { | 129 if (script_.get() == NULL) { |
| 130 NOTREACHED(); | 130 NOTREACHED(); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 script_->set_expiration_delay(delay_ms); | 133 script_->set_expiration_delay(delay_ms); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace translate | 136 } // namespace translate |
| OLD | NEW |