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

Side by Side Diff: chrome/browser/translate/chrome_translate_client.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: Renamed prefs names 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
« no previous file with comments | « no previous file | components/translate/core/browser/translate_prefs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (error_type != TranslateErrors::NONE) 168 if (error_type != TranslateErrors::NONE)
169 step = translate::TRANSLATE_STEP_TRANSLATE_ERROR; 169 step = translate::TRANSLATE_STEP_TRANSLATE_ERROR;
170 170
171 if (TranslateService::IsTranslateBubbleEnabled()) { 171 if (TranslateService::IsTranslateBubbleEnabled()) {
172 // Bubble UI. 172 // Bubble UI.
173 if (step == translate::TRANSLATE_STEP_BEFORE_TRANSLATE) { 173 if (step == translate::TRANSLATE_STEP_BEFORE_TRANSLATE) {
174 // TODO(droger): Move this logic out of UI code. 174 // TODO(droger): Move this logic out of UI code.
175 GetLanguageState().SetTranslateEnabled(true); 175 GetLanguageState().SetTranslateEnabled(true);
176 if (!GetLanguageState().HasLanguageChanged()) 176 if (!GetLanguageState().HasLanguageChanged())
177 return; 177 return;
178
179 if (!triggered_from_menu) {
180 if (web_contents()->GetBrowserContext()->IsOffTheRecord())
181 return;
182 if (GetTranslatePrefs()->IsTooOftenDenied())
183 return;
184 }
178 } 185 }
179 ShowBubble(step, error_type); 186 ShowBubble(step, error_type);
180 return; 187 return;
181 } 188 }
182 189
183 // Infobar UI. 190 // Infobar UI.
184 TranslateInfoBarDelegate::Create( 191 TranslateInfoBarDelegate::Create(
185 step != translate::TRANSLATE_STEP_BEFORE_TRANSLATE, 192 step != translate::TRANSLATE_STEP_BEFORE_TRANSLATE,
186 translate_manager_->GetWeakPtr(), 193 translate_manager_->GetWeakPtr(),
187 InfoBarService::FromWebContents(web_contents()), 194 InfoBarService::FromWebContents(web_contents()),
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 if (GetLanguageState().InTranslateNavigation()) 565 if (GetLanguageState().InTranslateNavigation())
559 return; 566 return;
560 } 567 }
561 568
562 TranslateBubbleFactory::Show( 569 TranslateBubbleFactory::Show(
563 browser->window(), web_contents(), step, error_type); 570 browser->window(), web_contents(), step, error_type);
564 #else 571 #else
565 NOTREACHED(); 572 NOTREACHED();
566 #endif 573 #endif
567 } 574 }
OLDNEW
« no previous file with comments | « no previous file | components/translate/core/browser/translate_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698