-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branding 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"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're turning off accessibility settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this change? I'm not sure what this is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without preprocess=true, the <if expr>
will not be parsed and was shown as <if expr=xxx>
in the final HTML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yrliou can we pls do a substitution find and replace via the l10n scripts? I prefer not to patch grd files at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, is it possible to change the attributes using that method? That's great if so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this give access to things like allowing extensions in incognito mode? Why do we want to hide it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to also support that extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now this extension is not supported yet, I'll open a follow up issue for handling this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up issue created in brave/brave-browser#415
#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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to specifically override things here vs repeating the entire list:
pageVisibility. a11y = false
for instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or if we want our own completely independent list then maybe we should override IDR_SETTINGS_PAGE_VISIBILITY_JS ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Oops I meant just to approve the last commit, let me cancel that approval. |
accidental thought it was just the last commit.
c79ee45
to
ae3455c
Compare
…resource.h without patching
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': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we care about anything for chromeos, or is this needed to avoid breaking something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments are added in 6b43657
Adds category to contribution completion function
Adds category to contribution completion function
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 -i
to squash commits (if needed).Test Plan:
Reviewer Checklist: