Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBranding in setting and extension pages #179
Conversation
|
There's an error when I try |
|
This looks like a lot of copying (grd and grdp files) so I think we should talk about other ways to do this. |
| $i18n{multidevicePageTitle} | ||
| </a> | ||
| </if> | ||
| +<if expr="_google_chrome"> |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
By quick glancing those grd/grdp files again, we don't need to replace bookmarks_strings.grdp.
|
|
I think this needs to happen build-time and write to |
| type="chrome_html" /> | ||
| <structure name="IDR_MD_EXTENSIONS_SIDEBAR_HTML" | ||
| file="sidebar.html" | ||
| + preprocess="true" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
yrliou
Jun 19, 2018
•
Author
Member
without preprocess=true, the <if expr> will not be parsed and was shown as <if expr=xxx> in the final HTML.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bbondy
Jun 20, 2018
Member
@yrliou can we pls do a substitution find and replace via the l10n scripts? I prefer not to patch grd files at all.
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 20, 2018
Collaborator
oh, is it possible to change the attributes using that method? That's great if so
This comment has been minimized.
This comment has been minimized.
bbondy
Jun 20, 2018
Member
Ya it's just find and replace, but we can find <structure name="IDR_MD_EXTENSIONS_SIDEBAR_HTML" and replace with <structure name="IDR_MD_EXTENSIONS_SIDEBAR_HTML" preprocess="true"
module.exports.rebaseBraveStringFilesOnChromiumL10nFiles = (path) =>
Object.entries({
[chromiumStringsPath]: braveStringsPath,
[chroimumSettingsPartPath]: braveSettingsPartPath,
[chromiumComponentsStringsPath]: braveComponentsStringsPath
}).forEach(([sourcePath, destPath]) =>
fs.writeFileSync(destPath,
fs.readFileSync(sourcePath, 'utf8')
.replace(/settings_chromium_strings.grdp/g, 'settings_brave_strings.grdp')
.replace(/The Chromium Authors/g, 'Brave Software Inc')
.replace(/Google Chrome/g, 'Brave')
.replace(/Chromium/g, 'Brave')
.replace(/Chrome/g, 'Brave')
.replace(/Google/g, 'Brave'), 'utf8'))
| $i18n{quickBrownFox} | ||
| </div> | ||
| </div> | ||
| +<if expr="_google_chrome"> |
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 19, 2018
Collaborator
doesn't this give access to things like allowing extensions in incognito mode? Why do we want to hide it?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
yrliou
Jun 20, 2018
Author
Member
Right now this extension is not supported yet, I'll open a follow up issue for handling this later.
This comment has been minimized.
This comment has been minimized.
| #include "base/strings/string_number_conversions.h" | ||
| #include "base/strings/utf_string_conversions.h" | ||
| +#if defined(BRAVE_CHROMIUM_BUILD) | ||
| +#include "brave/grit/brave_generated_resources.h" |
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 19, 2018
Collaborator
we can override chrome_generated_resources.h in chromium_src to include our resources and then re-include chrome
| }; | ||
| // </if> | ||
| + // <if expr="not _google_chrome"> | ||
| + pageVisibility = { |
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 19, 2018
•
Collaborator
I think it would be better to specifically override things here vs repeating the entire list:
pageVisibility. a11y = false for instance
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 19, 2018
Collaborator
or if we want our own completely independent list then maybe we should override IDR_SETTINGS_PAGE_VISIBILITY_JS ?
This comment has been minimized.
This comment has been minimized.
yrliou
Jun 21, 2018
Author
Member
pageVisibility would be undefined for non chrome os && not guest.
And sadly I couldn't only write the false values here because there are places using hidden=[[!pageVisibility.people]] which make undesired items to be hidden if the value was undefined.
I'll try overriding IDR_SETTINGS_PAGE_VISIBILITY_JS and see how it goes first thing tomorrow.
| <structure name="IDR_SETTINGS_APPEARANCE_FONTS_PAGE_HTML" | ||
| file="appearance_page/appearance_fonts_page.html" | ||
| type="chrome_html" | ||
| + preprocess="true" |
This comment has been minimized.
This comment has been minimized.
|
|
|
Oops I meant just to approve the last commit, let me cancel that approval. |
c79ee45
to
ae3455c
| else: | ||
| assert False, ('Unexpected tag name %s' % element.tag) | ||
|
|
||
| elements = lxml.etree.parse(grd_file_path).findall('.//part') | ||
| for element in elements: | ||
| grd_base_path = os.path.dirname(grd_file_path) | ||
| grd_part_filename = element.get('file') | ||
| if grd_part_filename == 'chromeos_strings.grdp': |
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 26, 2018
Collaborator
I don't think we care about anything for chromeos, or is this needed to avoid breaking something?
This comment has been minimized.
This comment has been minimized.
yrliou
Jun 26, 2018
Author
Member
this file is explicitly ignore here to avoid this script to try to process(read) this file, which we don't copy it at all into our src and caused read error.
| * 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/. */ | ||
|
|
||
| cr.define('settings', function() { |
This comment has been minimized.
This comment has been minimized.
bridiver
Jun 26, 2018
Collaborator
I think we should probably have a comment here explaining the reason why we used the proxy here vs just overriding individual settings. We don't want the next person who comes along to think that you can just override individual attributes like I assumed originally
This comment has been minimized.
This comment has been minimized.
Adds category to contribution completion function
Adds category to contribution completion function


yrliou commentedJun 19, 2018
•
edited
Parts of solving brave/brave-browser#12, this PR involves
<if expr="_google_chrome">guardsI tried to utilize hidden and dom-if conditions which were pre-defined by chrome to avoid patching, unfortunately, usually those properties are shared between different elements that we don't want to hide, so it turned out to be patching case by case for most elements. The reason adding guards instead of using css is because those entries would still show up in searching results, so I prefer to not have those elements in the first place than hiding them. If there's a better way to do this, please feel free to suggest.
In the future, when we have our own extension store, most of the patches can be deleted, and only patching for cloud printer and chrome's password manager link sections will be left since we might not have these features in the short term.
Submitter Checklist:
git rebase -ito squash commits (if needed).Test Plan:
Reviewer Checklist: