| 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/chrome_translate_client.h" | 5 #include "chrome/browser/translate/chrome_translate_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 translate_manager_( | 60 translate_manager_( |
| 61 new translate::TranslateManager(this, prefs::kAcceptLanguages)), | 61 new translate::TranslateManager(this, prefs::kAcceptLanguages)), |
| 62 cld_data_provider_( | 62 cld_data_provider_( |
| 63 translate::CreateBrowserCldDataProviderFor(web_contents)) { | 63 translate::CreateBrowserCldDataProviderFor(web_contents)) { |
| 64 translate_driver_.AddObserver(this); | 64 translate_driver_.AddObserver(this); |
| 65 translate_driver_.set_translate_manager(translate_manager_.get()); | 65 translate_driver_.set_translate_manager(translate_manager_.get()); |
| 66 // Customization: for the standalone data source, we configure the path to | 66 // Customization: for the standalone data source, we configure the path to |
| 67 // CLD data immediately on startup. | 67 // CLD data immediately on startup. |
| 68 if (translate::CldDataSource::ShouldUseStandaloneDataFile() && | 68 if (translate::CldDataSource::ShouldUseStandaloneDataFile() && |
| 69 !g_cld_file_path_initialized_) { | 69 !g_cld_file_path_initialized_) { |
| 70 VLOG(1) << "Initializing CLD file path for the first time."; | 70 DVLOG(1) << "Initializing CLD file path for the first time."; |
| 71 base::FilePath path; | 71 base::FilePath path; |
| 72 if (!PathService::Get(chrome::DIR_USER_DATA, &path)) { | 72 if (!PathService::Get(chrome::DIR_USER_DATA, &path)) { |
| 73 // Chrome isn't properly installed | 73 // Chrome isn't properly installed |
| 74 LOG(WARNING) << "Unable to locate user data directory"; | 74 LOG(WARNING) << "Unable to locate user data directory"; |
| 75 } else { | 75 } else { |
| 76 g_cld_file_path_initialized_ = true; | 76 g_cld_file_path_initialized_ = true; |
| 77 path = path.Append(kCldDataFileName); | 77 path = path.Append(kCldDataFileName); |
| 78 VLOG(1) << "Setting CLD data file path: " << path.value(); | 78 DVLOG(1) << "Setting CLD data file path: " << path.value(); |
| 79 translate::SetCldDataFilePath(path); | 79 translate::SetCldDataFilePath(path); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 ChromeTranslateClient::~ChromeTranslateClient() { | 84 ChromeTranslateClient::~ChromeTranslateClient() { |
| 85 translate_driver_.RemoveObserver(this); | 85 translate_driver_.RemoveObserver(this); |
| 86 } | 86 } |
| 87 | 87 |
| 88 translate::LanguageState& ChromeTranslateClient::GetLanguageState() { | 88 translate::LanguageState& ChromeTranslateClient::GetLanguageState() { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 if (GetLanguageState().InTranslateNavigation()) | 337 if (GetLanguageState().InTranslateNavigation()) |
| 338 return; | 338 return; |
| 339 } | 339 } |
| 340 | 340 |
| 341 TranslateBubbleFactory::Show( | 341 TranslateBubbleFactory::Show( |
| 342 browser->window(), web_contents(), step, error_type); | 342 browser->window(), web_contents(), step, error_type); |
| 343 #else | 343 #else |
| 344 NOTREACHED(); | 344 NOTREACHED(); |
| 345 #endif | 345 #endif |
| 346 } | 346 } |
| OLD | NEW |