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

Side by Side Diff: chrome/browser/translate/chrome_translate_client.cc

Issue 2116653003: [Translate] Honors "IsTooOftenDenied" policy in incognito bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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/path_service.h" 10 #include "base/path_service.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (step == translate::TRANSLATE_STEP_BEFORE_TRANSLATE) { 169 if (step == translate::TRANSLATE_STEP_BEFORE_TRANSLATE) {
170 // TODO(droger): Move this logic out of UI code. 170 // TODO(droger): Move this logic out of UI code.
171 GetLanguageState().SetTranslateEnabled(true); 171 GetLanguageState().SetTranslateEnabled(true);
172 // In the new UI, continue offering translation after the user navigates to 172 // In the new UI, continue offering translation after the user navigates to
173 // another page. 173 // another page.
174 if (!base::FeatureList::IsEnabled(translate::kTranslateUI2016Q2) && 174 if (!base::FeatureList::IsEnabled(translate::kTranslateUI2016Q2) &&
175 !GetLanguageState().HasLanguageChanged()) { 175 !GetLanguageState().HasLanguageChanged()) {
176 return; 176 return;
177 } 177 }
178 178
179 if (!triggered_from_menu) { 179 if (!triggered_from_menu &&
180 if (web_contents()->GetBrowserContext()->IsOffTheRecord()) 180 GetTranslatePrefs()->IsTooOftenDenied(source_language))
181 return; 181 return;
182 if (GetTranslatePrefs()->IsTooOftenDenied(source_language))
183 return;
184 }
185 } 182 }
186 ShowBubble(step, error_type); 183 ShowBubble(step, error_type);
187 } 184 }
188 185
189 translate::TranslateDriver* ChromeTranslateClient::GetTranslateDriver() { 186 translate::TranslateDriver* ChromeTranslateClient::GetTranslateDriver() {
190 return &translate_driver_; 187 return &translate_driver_;
191 } 188 }
192 189
193 PrefService* ChromeTranslateClient::GetPrefs() { 190 PrefService* ChromeTranslateClient::GetPrefs() {
194 DCHECK(web_contents()); 191 DCHECK(web_contents());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 if (GetLanguageState().InTranslateNavigation()) 306 if (GetLanguageState().InTranslateNavigation())
310 return; 307 return;
311 } 308 }
312 309
313 TranslateBubbleFactory::Show(browser->window(), web_contents(), step, 310 TranslateBubbleFactory::Show(browser->window(), web_contents(), step,
314 error_type); 311 error_type);
315 #else 312 #else
316 NOTREACHED(); 313 NOTREACHED();
317 #endif 314 #endif
318 } 315 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698