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

Unified Diff: components/translate/core/browser/translate_manager.cc

Issue 2819793002: Translate: do not show the context menu entry when the feature is disabled (Closed)
Patch Set: some more include path changes for ios/android Created 3 years, 8 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: components/translate/core/browser/translate_manager.cc
diff --git a/components/translate/core/browser/translate_manager.cc b/components/translate/core/browser/translate_manager.cc
index b3ffa387b749bd9144289b3229544935bccdaaba..ed9d73548dd99f7cfb8149ba7201446aa4eb22ea 100644
--- a/components/translate/core/browser/translate_manager.cc
+++ b/components/translate/core/browser/translate_manager.cc
@@ -34,7 +34,6 @@
#include "components/translate/core/browser/translate_url_util.h"
#include "components/translate/core/common/language_detection_details.h"
#include "components/translate/core/common/translate_constants.h"
-#include "components/translate/core/common/translate_pref_names.h"
#include "components/translate/core/common/translate_switches.h"
#include "components/translate/core/common/translate_util.h"
#include "components/variations/variations_associated_data.h"
@@ -177,8 +176,10 @@ void TranslateManager::InitiateTranslation(const std::string& page_lang) {
return;
}
- PrefService* prefs = translate_client_->GetPrefs();
- if (!prefs->GetBoolean(prefs::kEnableTranslate)) {
+ std::unique_ptr<TranslatePrefs> translate_prefs(
+ translate_client_->GetTranslatePrefs());
+
+ if (!translate_prefs->IsEnabled()) {
TranslateBrowserMetrics::ReportInitiationStatus(
TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_PREFS);
RecordTranslateEvent(metrics::TranslateEventProto::DISABLED_BY_PREF);
@@ -214,9 +215,6 @@ void TranslateManager::InitiateTranslation(const std::string& page_lang) {
return;
}
- std::unique_ptr<TranslatePrefs> translate_prefs(
- translate_client_->GetTranslatePrefs());
-
std::string target_lang = GetTargetLanguage(translate_prefs.get());
std::string language_code =
TranslateDownloadManager::GetLanguageCode(page_lang);

Powered by Google App Engine
This is Rietveld 408576698