Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: chrome/browser/translate/chrome_translate_client.cc

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and merge Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/chrome_translate_client.cc
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc
index 9356f448190ebb6efe00e04fbf7d5a4baa9ad1e2..d04cc34588305fa9137040a4a55729c7da9de536 100644
--- a/chrome/browser/translate/chrome_translate_client.cc
+++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -24,6 +24,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/infobars/core/infobar.h"
+#include "components/translate/content/browser/browser_cld_data_provider_factory.h"
#include "components/translate/content/common/cld_data_source.h"
#include "components/translate/content/common/translate_messages.h"
#include "components/translate/core/browser/language_state.h"
@@ -60,12 +61,13 @@ ChromeTranslateClient::ChromeTranslateClient(content::WebContents* web_contents)
translate_manager_(
new translate::TranslateManager(this, prefs::kAcceptLanguages)),
cld_data_provider_(
- translate::CreateBrowserCldDataProviderFor(web_contents)) {
+ translate::BrowserCldDataProviderFactory::Get()->NewProvider(
+ web_contents)) {
translate_driver_.AddObserver(this);
translate_driver_.set_translate_manager(translate_manager_.get());
// Customization: for the standalone data source, we configure the path to
// CLD data immediately on startup.
- if (translate::CldDataSource::ShouldUseStandaloneDataFile() &&
+ if (translate::CldDataSource::Get()->ShouldUseStandaloneDataFile() &&
!g_cld_file_path_initialized_) {
VLOG(1) << "Initializing CLD file path for the first time.";
base::FilePath path;
@@ -76,7 +78,7 @@ ChromeTranslateClient::ChromeTranslateClient(content::WebContents* web_contents)
g_cld_file_path_initialized_ = true;
path = path.Append(kCldDataFileName);
VLOG(1) << "Setting CLD data file path: " << path.value();
- translate::SetCldDataFilePath(path);
+ translate::CldDataSource::Get()->SetCldDataFilePath(path);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698