| 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 "chrome/browser/translate/translate_service.h" | 5 #include "chrome/browser/translate/translate_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/translate/translate_manager.h" | 9 #include "chrome/browser/translate/translate_manager.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 TranslateService::~TranslateService() {} | 22 TranslateService::~TranslateService() {} |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 void TranslateService::Initialize() { | 25 void TranslateService::Initialize() { |
| 26 if (g_translate_service) | 26 if (g_translate_service) |
| 27 return; | 27 return; |
| 28 | 28 |
| 29 g_translate_service = new TranslateService; | 29 g_translate_service = new TranslateService; |
| 30 // Initialize the allowed state for resource requests. | 30 // Initialize the allowed state for resource requests. |
| 31 g_translate_service->OnResourceRequestsAllowed(); | 31 g_translate_service->OnResourceRequestsAllowed(); |
| 32 // Create the TranslateManager singleton. | |
| 33 TranslateManager::GetInstance(); | |
| 34 TranslateDownloadManager* download_manager = | 32 TranslateDownloadManager* download_manager = |
| 35 TranslateDownloadManager::GetInstance(); | 33 TranslateDownloadManager::GetInstance(); |
| 36 download_manager->set_request_context( | 34 download_manager->set_request_context( |
| 37 g_browser_process->system_request_context()); | 35 g_browser_process->system_request_context()); |
| 38 download_manager->set_application_locale( | 36 download_manager->set_application_locale( |
| 39 g_browser_process->GetApplicationLocale()); | 37 g_browser_process->GetApplicationLocale()); |
| 40 } | 38 } |
| 41 | 39 |
| 42 // static | 40 // static |
| 43 void TranslateService::Shutdown(bool cleanup_pending_fetcher) { | 41 void TranslateService::Shutdown(bool cleanup_pending_fetcher) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // The bubble UX is not implemented on the non-Aura platforms. | 74 // The bubble UX is not implemented on the non-Aura platforms. |
| 77 return false; | 75 return false; |
| 78 #endif | 76 #endif |
| 79 } | 77 } |
| 80 | 78 |
| 81 // static | 79 // static |
| 82 void TranslateService::SetUseInfobar(bool value) { | 80 void TranslateService::SetUseInfobar(bool value) { |
| 83 Initialize(); | 81 Initialize(); |
| 84 g_translate_service->use_infobar_ = value; | 82 g_translate_service->use_infobar_ = value; |
| 85 } | 83 } |
| OLD | NEW |