-
Notifications
You must be signed in to change notification settings - Fork 901
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 #7304 from brave/tor-extensions-support
Add extensions support for Tor OTR profile
- Loading branch information
Showing
15 changed files
with
186 additions
and
52 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
39 changes: 39 additions & 0 deletions
39
browser/resources/extensions/brave_overrides/extensions_detail_view.js
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,39 @@ | ||
// Copyright (c) 2020 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/. | ||
|
||
import {RegisterPolymerTemplateModifications, RegisterPolymerComponentBehaviors} from 'chrome://brave-resources/polymer_overriding.js' | ||
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js' | ||
|
||
RegisterPolymerTemplateModifications({ | ||
'extensions-detail-view': (templateContent) => { | ||
let optionsTemplate = | ||
templateContent.querySelector('template[is="dom-if"][if*="shouldShowOptionsSection_"]') | ||
if (!optionsTemplate) { | ||
console.error('[Brave Extensions Overrides] Could not find optionsTemplate') | ||
return | ||
} | ||
let incognitoTemplate = | ||
optionsTemplate.content.querySelector('template[is="dom-if"][if*="shouldShowIncognitoOption_"]') | ||
if (!incognitoTemplate) { | ||
console.error('[Brave Extensions Overrides] Could not find incognitoTemplate') | ||
return | ||
} | ||
let incognitoWarningDiv = incognitoTemplate.content.querySelector('.section-content') | ||
if (!incognitoWarningDiv) { | ||
console.error('[Brave Extensions Overrides] Could not find incognitoWarningDiv') | ||
return | ||
} | ||
incognitoWarningDiv.innerText = I18nBehavior.i18n('privateInfoWarning') | ||
const spanningWarningSpan = document.createElement('span') | ||
spanningWarningSpan.setAttribute('class', 'section-content') | ||
spanningWarningSpan.setAttribute('hidden', '[[data.isSplitMode]]') | ||
spanningWarningSpan.innerText = ' ' + I18nBehavior.i18n('spanningInfoWarning') | ||
const privateAndTorWarningSpan = document.createElement('span') | ||
privateAndTorWarningSpan.setAttribute('class', 'section-content') | ||
privateAndTorWarningSpan.innerText = ' ' + I18nBehavior.i18n('privateAndTorInfoWarning') | ||
incognitoWarningDiv.appendChild(spanningWarningSpan) | ||
incognitoWarningDiv.appendChild(privateAndTorWarningSpan) | ||
} | ||
}) |
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 @@ | ||
// Copyright (c) 2020 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/. | ||
|
||
import './extensions_detail_view.js' |
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
11 changes: 11 additions & 0 deletions
11
chromium_src/chrome/browser/extensions/api/developer_private/extension_info_generator.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,11 @@ | ||
/* Copyright (c) 2020 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 "extensions/common/manifest_handlers/incognito_info.h" | ||
|
||
#define BRAVE_CREATE_EXTENSION_INFO_HELPER \ | ||
info->is_split_mode = IncognitoInfo::IsSplitMode(&extension); | ||
#include "../../../../../../../chrome/browser/extensions/api/developer_private/extension_info_generator.cc" | ||
#undef BRAVE_CREATE_EXTENSION_INFO_HELPER |
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 was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
patches/chrome-browser-extensions-api-developer_private-extension_info_generator.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,12 @@ | ||
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc | ||
index 1fb464bfae78ce8dc622f0edd5792665ca5af7f1..cd900ccc6f8571ec0f52ca58b14f1fa75d7b2be5 100644 | ||
--- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc | ||
+++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc | ||
@@ -606,6 +606,7 @@ void ExtensionInfoGenerator::CreateExtensionInfoHelper( | ||
info->incognito_access.is_enabled = util::CanBeIncognitoEnabled(&extension); | ||
info->incognito_access.is_active = | ||
util::IsIncognitoEnabled(extension.id(), browser_context_); | ||
+ BRAVE_CREATE_EXTENSION_INFO_HELPER | ||
|
||
// Install warnings, but only if unpacked, the error console isn't enabled | ||
// (otherwise it shows these), and we're in developer mode (normal users don't |
12 changes: 12 additions & 0 deletions
12
patches/chrome-browser-resources-extensions-extensions.js.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,12 @@ | ||
diff --git a/chrome/browser/resources/extensions/extensions.js b/chrome/browser/resources/extensions/extensions.js | ||
index 5836804c9e488bb23869d05881bd55cd7ccd9f52..928974d8d5dc367276527ae521b26fc3bb7cb226 100644 | ||
--- a/chrome/browser/resources/extensions/extensions.js | ||
+++ b/chrome/browser/resources/extensions/extensions.js | ||
@@ -2,6 +2,7 @@ | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
+import './brave_overrides/index.js'; | ||
import './manager.js'; | ||
|
||
export {getToastManager} from 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.m.js'; |
12 changes: 12 additions & 0 deletions
12
patches/chrome-common-extensions-api-developer_private.idl.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,12 @@ | ||
diff --git a/chrome/common/extensions/api/developer_private.idl b/chrome/common/extensions/api/developer_private.idl | ||
index 5b425b0cbb7da4335619acc7743f26050ca472a1..5254b875452702e18c3caaded8841b78cd08c62d 100644 | ||
--- a/chrome/common/extensions/api/developer_private.idl | ||
+++ b/chrome/common/extensions/api/developer_private.idl | ||
@@ -231,6 +231,7 @@ namespace developerPrivate { | ||
DOMString iconUrl; | ||
DOMString id; | ||
AccessModifier incognitoAccess; | ||
+ boolean isSplitMode; | ||
DOMString[] installWarnings; | ||
DOMString? launchUrl; | ||
Location location; |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
{ | ||
"name": "Trivial Test Extension", | ||
"version": "1.0", | ||
"manifest_version": 2, | ||
"description": "A minimal extension for testing purposes.", | ||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjzv7dI7Ygyh67VHE1DdidudpYf8PFfv8iucWvzO+3xpF/Dm5xNo7aQhPNiEaNfHwJQ7lsp4gc+C+4bbaVewBFspTruoSJhZc5uEfqxwovJwN+v1/SUFXTXQmQBv6gs0qZB4gBbl4caNQBlqrFwAMNisnu1V6UROna8rOJQ90D7Nv7TCwoVPKBfVshpFjdDOTeBg4iLctO3S/06QYqaTDrwVceSyHkVkvzBY6tc6mnYX0RZu78J9iL8bdqwfllOhs69cqoHHgrLdI6JdOyiuh6pBP6vxMlzSKWJ3YTNjaQTPwfOYaLMuzdl0v+YdzafIzV9zwe4Xiskk+5JNGt8b2rQIDAQAB" | ||
} |
8 changes: 8 additions & 0 deletions
8
test/data/extensions/trivial_extension_incognito_not_allowed/manifest.json
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,8 @@ | ||
{ | ||
"name": "Trivial Test Extension Not Allow Incognito", | ||
"version": "1.0", | ||
"manifest_version": 2, | ||
"description": "A minimal extension for testing purposes.", | ||
"incognito": "not_allowed", | ||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjzv7dI7Ygyh67VHE1DdidudpYf8PFfv8iucWvzO+3xpF/Dm5xNo7aQhPNiEaNfHwJQ7lsp4gc+C+4bbaVewBFspTruoSJhZc5uEfqxwovJwN+v1/SUFXTXQmQBv6gs0qZB4gBbl4caNQBlqrFwAMNisnu1V6UROna8rOJQ90D7Nv7TCwoVPKBfVshpFjdDOTeBg4iLctO3S/06QYqaTDrwVceSyHkVkvzBY6tc6mnYX0RZu78J9iL8bdqwfllOhs69cqoHHgrLdI6JdOyiuh6pBP6vxMlzSKWJ3YTNjaQTPwfOYaLMuzdl0v+YdzafIzV9zwe4Xiskk+5JNGt8b2rQIDAQAB" | ||
} |
This file was deleted.
Oops, something went wrong.