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

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

Issue 1185703007: Disable translate when there is no API key (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 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 | components/translate/core/browser/translate_browser_metrics.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/translate_service.h" 5 #include "chrome/browser/translate/translate_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 translate::TranslateDownloadManager::GetInstance(); 57 translate::TranslateDownloadManager::GetInstance();
58 if (cleanup_pending_fetcher) { 58 if (cleanup_pending_fetcher) {
59 download_manager->Shutdown(); 59 download_manager->Shutdown();
60 } else { 60 } else {
61 // This path is only used by browser tests. 61 // This path is only used by browser tests.
62 download_manager->set_request_context(NULL); 62 download_manager->set_request_context(NULL);
63 } 63 }
64 } 64 }
65 65
66 // static 66 // static
67 void TranslateService::InitializeForTesting() { 67 void TranslateService::InitializeForTesting() {
Takashi Toyoshima 2015/07/14 12:06:22 This function is not called for browser tests. So
68 if (!g_translate_service) { 68 if (!g_translate_service) {
69 TranslateService::Initialize(); 69 TranslateService::Initialize();
70 translate::TranslateManager::SetIgnoreMissingKeyForTesting(true);
70 } else { 71 } else {
71 translate::TranslateDownloadManager::GetInstance()->ResetForTesting(); 72 translate::TranslateDownloadManager::GetInstance()->ResetForTesting();
72 g_translate_service->OnResourceRequestsAllowed(); 73 g_translate_service->OnResourceRequestsAllowed();
73 } 74 }
74 } 75 }
75 76
76 // static 77 // static
77 void TranslateService::ShutdownForTesting() { 78 void TranslateService::ShutdownForTesting() {
78 translate::TranslateDownloadManager::GetInstance()->Shutdown(); 79 translate::TranslateDownloadManager::GetInstance()->Shutdown();
79 } 80 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // - an FTP page (as FTP pages tend to have long lists of filenames that may 123 // - an FTP page (as FTP pages tend to have long lists of filenames that may
123 // confuse the CLD) 124 // confuse the CLD)
124 return !url.is_empty() && !url.SchemeIs(content::kChromeUIScheme) && 125 return !url.is_empty() && !url.SchemeIs(content::kChromeUIScheme) &&
125 !url.SchemeIs(content::kChromeDevToolsScheme) && 126 !url.SchemeIs(content::kChromeDevToolsScheme) &&
126 #if defined(OS_CHROMEOS) 127 #if defined(OS_CHROMEOS)
127 !(url.SchemeIs(extensions::kExtensionScheme) && 128 !(url.SchemeIs(extensions::kExtensionScheme) &&
128 url.DomainIs(file_manager::kFileManagerAppId)) && 129 url.DomainIs(file_manager::kFileManagerAppId)) &&
129 #endif 130 #endif
130 !url.SchemeIs(url::kFtpScheme); 131 !url.SchemeIs(url::kFtpScheme);
131 } 132 }
OLDNEW
« no previous file with comments | « no previous file | components/translate/core/browser/translate_browser_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698