| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager.h" | 5 #include "chrome/browser/translate/translate_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bool TranslateManager::IsTranslatableURL(const GURL& url) { | 91 bool TranslateManager::IsTranslatableURL(const GURL& url) { |
| 92 // A URLs is translatable unless it is one of the following: | 92 // A URLs is translatable unless it is one of the following: |
| 93 // - empty (can happen for popups created with window.open("")) | 93 // - empty (can happen for popups created with window.open("")) |
| 94 // - an internal URL (chrome:// and others) | 94 // - an internal URL (chrome:// and others) |
| 95 // - the devtools (which is considered UI) | 95 // - the devtools (which is considered UI) |
| 96 // - Chrome OS file manager extension | 96 // - Chrome OS file manager extension |
| 97 // - an FTP page (as FTP pages tend to have long lists of filenames that may | 97 // - an FTP page (as FTP pages tend to have long lists of filenames that may |
| 98 // confuse the CLD) | 98 // confuse the CLD) |
| 99 return !url.is_empty() && | 99 return !url.is_empty() && |
| 100 !url.SchemeIs(content::kChromeUIScheme) && | 100 !url.SchemeIs(content::kChromeUIScheme) && |
| 101 !url.SchemeIs(chrome::kChromeDevToolsScheme) && | 101 !url.SchemeIs(content::kChromeDevToolsScheme) && |
| 102 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
| 103 !(url.SchemeIs(extensions::kExtensionScheme) && | 103 !(url.SchemeIs(extensions::kExtensionScheme) && |
| 104 url.DomainIs(file_manager::kFileManagerAppId)) && | 104 url.DomainIs(file_manager::kFileManagerAppId)) && |
| 105 #endif | 105 #endif |
| 106 !url.SchemeIs(content::kFtpScheme); | 106 !url.SchemeIs(content::kFtpScheme); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void TranslateManager::Observe(int type, | 109 void TranslateManager::Observe(int type, |
| 110 const content::NotificationSource& source, | 110 const content::NotificationSource& source, |
| 111 const content::NotificationDetails& details) { | 111 const content::NotificationDetails& details) { |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 &auto_target_lang)) { | 622 &auto_target_lang)) { |
| 623 // We need to confirm that the saved target language is still supported. | 623 // We need to confirm that the saved target language is still supported. |
| 624 // Also, GetLanguageCode will take care of removing country code if any. | 624 // Also, GetLanguageCode will take care of removing country code if any. |
| 625 auto_target_lang = | 625 auto_target_lang = |
| 626 TranslateDownloadManager::GetLanguageCode(auto_target_lang); | 626 TranslateDownloadManager::GetLanguageCode(auto_target_lang); |
| 627 if (TranslateDownloadManager::IsSupportedLanguage(auto_target_lang)) | 627 if (TranslateDownloadManager::IsSupportedLanguage(auto_target_lang)) |
| 628 return auto_target_lang; | 628 return auto_target_lang; |
| 629 } | 629 } |
| 630 return std::string(); | 630 return std::string(); |
| 631 } | 631 } |
| OLD | NEW |