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

Side by Side Diff: components/translate/core/browser/translate_ui_delegate.cc

Issue 345743002: Translate: Hide the bubble if the user denies translating 2 times within 24 hours (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky's review Created 6 years, 6 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 unified diff | Download patch
OLDNEW
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_ui_delegate.h" 5 #include "components/translate/core/browser/translate_ui_delegate.h"
6 6
7 #include "base/i18n/string_compare.h" 7 #include "base/i18n/string_compare.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "components/translate/core/browser/language_state.h" 9 #include "components/translate/core/browser/language_state.h"
10 #include "components/translate/core/browser/translate_client.h" 10 #include "components/translate/core/browser/translate_client.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (translate_manager_) { 173 if (translate_manager_) {
174 translate_manager_->RevertTranslation(); 174 translate_manager_->RevertTranslation();
175 UMA_HISTOGRAM_BOOLEAN(kRevertTranslation, true); 175 UMA_HISTOGRAM_BOOLEAN(kRevertTranslation, true);
176 } 176 }
177 } 177 }
178 178
179 void TranslateUIDelegate::TranslationDeclined(bool explicitly_closed) { 179 void TranslateUIDelegate::TranslationDeclined(bool explicitly_closed) {
180 if (!translate_driver_->IsOffTheRecord()) { 180 if (!translate_driver_->IsOffTheRecord()) {
181 prefs_->ResetTranslationAcceptedCount(GetOriginalLanguageCode()); 181 prefs_->ResetTranslationAcceptedCount(GetOriginalLanguageCode());
182 prefs_->IncrementTranslationDeniedCount(GetOriginalLanguageCode()); 182 prefs_->IncrementTranslationDeniedCount(GetOriginalLanguageCode());
183 prefs_->UpdateBubbleLastClosedTime();
droger 2014/06/20 12:09:29 Nit: While we are at it, we should also change the
hajimehoshi 2014/06/24 06:17:54 Done.
183 } 184 }
184 185
185 // Remember that the user declined the translation so as to prevent showing a 186 // Remember that the user declined the translation so as to prevent showing a
186 // translate infobar for that page again. (TranslateManager initiates 187 // translate infobar for that page again. (TranslateManager initiates
187 // translations when getting a LANGUAGE_DETERMINED from the page, which 188 // translations when getting a LANGUAGE_DETERMINED from the page, which
188 // happens when a load stops. That could happen multiple times, including 189 // happens when a load stops. That could happen multiple times, including
189 // after the user already declined the translation.) 190 // after the user already declined the translation.)
190 if (translate_manager_) { 191 if (translate_manager_) {
191 translate_manager_->GetLanguageState().set_translation_declined(true); 192 translate_manager_->GetLanguageState().set_translation_declined(true);
192 UMA_HISTOGRAM_BOOLEAN(kDeclineTranslate, true); 193 UMA_HISTOGRAM_BOOLEAN(kDeclineTranslate, true);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 prefs_->RemoveLanguagePairFromWhitelist(original_lang, target_lang); 250 prefs_->RemoveLanguagePairFromWhitelist(original_lang, target_lang);
250 251
251 UMA_HISTOGRAM_BOOLEAN(kAlwaysTranslateLang, true); 252 UMA_HISTOGRAM_BOOLEAN(kAlwaysTranslateLang, true);
252 } 253 }
253 254
254 std::string TranslateUIDelegate::GetPageHost() { 255 std::string TranslateUIDelegate::GetPageHost() {
255 if (!translate_driver_->HasCurrentPage()) 256 if (!translate_driver_->HasCurrentPage())
256 return std::string(); 257 return std::string();
257 return translate_driver_->GetActiveURL().HostNoBrackets(); 258 return translate_driver_->GetActiveURL().HostNoBrackets();
258 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698