-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2542 from brave/disable_translate_in_release
Disable in-page translation in release channel
- Loading branch information
Showing
15 changed files
with
98 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import("//build/buildflag_header.gni") | ||
import("//brave/browser/translate/buildflags/buildflags.gni") | ||
|
||
buildflag_header("buildflags") { | ||
header = "buildflags.h" | ||
flags = [ | ||
"ENABLE_BRAVE_TRANSLATE=$enable_brave_translate", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import("//brave/build/config.gni") | ||
import("//build/config/features.gni") | ||
|
||
declare_args() { | ||
enable_brave_translate = !is_release_channel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
chromium_src/chrome/browser/translate/translate_service.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/translate/buildflags/buildflags.h" | ||
|
||
namespace { | ||
bool IsBraveTranslateEnabled() { | ||
#if BUILDFLAG(ENABLE_BRAVE_TRANSLATE) | ||
return true; | ||
#endif | ||
return false; | ||
} | ||
} // namespace | ||
|
||
#include "../../../../../../chrome/browser/translate/translate_service.cc" // NOLINT |
13 changes: 13 additions & 0 deletions
13
patches/chrome-browser-translate-translate_service.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/chrome/browser/translate/translate_service.cc b/chrome/browser/translate/translate_service.cc | ||
index 06eacc6c808221f905aea64e33dd64a3e373bb62..22e589b8729d7f197aeac2b1c9a230b9344d24b0 100644 | ||
--- a/chrome/browser/translate/translate_service.cc | ||
+++ b/chrome/browser/translate/translate_service.cc | ||
@@ -136,7 +136,7 @@ bool TranslateService::IsTranslatableURL(const GURL& url) { | ||
// - Chrome OS file manager extension | ||
// - an FTP page (as FTP pages tend to have long lists of filenames that may | ||
// confuse the CLD) | ||
- return !url.is_empty() && !url.SchemeIs(content::kChromeUIScheme) && | ||
+ return IsBraveTranslateEnabled() && !url.is_empty() && !url.SchemeIs(content::kChromeUIScheme) && | ||
!url.SchemeIs(content::kChromeDevToolsScheme) && | ||
#if defined(OS_CHROMEOS) | ||
!(url.SchemeIs(extensions::kExtensionScheme) && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters