Skip to content
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

Add brave theme option to settings page #361

Merged
merged 3 commits into from
Sep 3, 2018
Merged

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Aug 26, 2018

Close brave/brave-browser#789

screen shot 2018-08-29 at 17 51 06

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Needed or QA/No-QA-Needed) to include the closed issue in milestone

Test Plan:

Open settings page and check theme is changed when brave color option changes.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

@simonhong simonhong self-assigned this Aug 26, 2018
@simonhong simonhong changed the title Add brave theme option to settings page [WIP] Add brave theme option to settings page Aug 26, 2018
@simonhong
Copy link
Member Author

@bbondy @bridiver I marked as WIP for avoiding patching files of html/js files.
Can you advice for this?

index c75464dc66ecedd8dbfac47b0dbdb4b6c68fd969..fd62faf174909c5c385277c08bb782bd4127d442 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js
@@ -45,6 +45,17 @@ cr.define('settings', function() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we're using this at all if we have our own webui?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brave_appearance_browser_proxy.js is introduced.

</template>
</select>
</div>
+<if expr="not _google_chrome">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with this. Maybe it makes more sense to keep this separate from chrome webstore theme prefs? If we want to keep it under the same heading, seems like we should be able to use the templating engine to insert an html snippet here without patching the whole thing in?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like {{brave_theme_settings}} that contains all of this? Not sure if that is possible or not

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings-brave-apperance-page module is only added.

],
},

+ // <if expr="not _google_chrome">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can include another js file here to do this. Talk to @yrliou because she did something similar

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example here 45c8a93

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brave_appearance_page.js is introduced.

@simonhong
Copy link
Member Author

One more thing is remained to remove WIP.
Below entries should be added to settings_resources.grd.

<structure name="IDR_SETTINGS_BRAVE_APPEARANCE_BROWSER_PROXY_HTML" file="brave_appearance_page/brave_appearance_browser_proxy.html" type="chrome_html" />
<structure name="IDR_SETTINGS_BRAVE_APPEARANCE_BROWSER_PROXY_JS" file="brave_appearance_page/brave_appearance_browser_proxy.js" type="chrome_html" preprocess="true" />
<structure name="IDR_SETTINGS_BRAVE_APPEARANCE_PAGE_HTML" file="brave_appearance_page/brave_appearance_page.html" type="chrome_html" preprocess="true" allowexternalscript="true" />
<structure name="IDR_SETTINGS_BRAVE_APPEARANCE_PAGE_JS" file="brave_appearance_page/brave_appearance_page.js" type="chrome_html" preprocess="true" />

@bbondy , can you advice howto add above items to settings_resources.grd?
I saw the comment that this file is automatically generated.

@yrliou
Copy link
Member

yrliou commented Aug 28, 2018

@simonhong See script/chromium-rebase-l10n.py for adding entries, you can see brave_page_visibility.js as an example.

@petemill
Copy link
Member

This option is still present when the user has installed a theme extension? The intention is for this toggle to still be present as there are some UI elements that are non-extension-themeable so we will still want the option for those items.

</template>
</select>
</div>
+ <settings-brave-appearance-page></settings-brave-appearance-page>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we put this at the top of the appearance section? So that it is next to the extension theme item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@simonhong
Copy link
Member Author

simonhong commented Aug 28, 2018

@petemill Yes, our theme option is always effective regardless of user theme extension is installed or not.
When user theme extension is installed, our theme properties only overrides colors that user theme doesn't override because we only overrided ThemeService::GetDefaultColor().

@@ -138,6 +138,10 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
<message name="IDS_BLOCKED_AUTOPLAY_NO_ACTION" desc="Radio button choice to continue blocking a site from autoplay media, displayed in bubble when a page tries to autoplay media.">
Continue blocking autoplay
</message>
<!-- Appearance -->
<message name="IDS_SETTINGS_APPEARANCE_SETTINGS_BRAVE_THEMES" desc="The label for brave theme change setting options">
Brave Themes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a talk to the design team, please change this string value to Brave colors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@simonhong simonhong force-pushed the brave_theme_option branch 2 times, most recently from 90a1f33 to c2fd3fc Compare August 29, 2018 02:11
@simonhong simonhong changed the title [WIP] Add brave theme option to settings page Add brave theme option to settings page Aug 29, 2018
@simonhong
Copy link
Member Author

Removed wip label. I think this is ready to review again!

@simonhong
Copy link
Member Author

Kindly ping

With this module, we can simply our apperance options to settings page.
With this, four web resources are added for brave theme options.
* brave_appearance_browser_proxy.html
* brave_appearance_browser_proxy.js
* brave_appearance_page.html
* brave_appearance_page.js
Copy link
Member

@bbondy bbondy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bbondy bbondy merged commit 50fd710 into master Sep 3, 2018
@simonhong simonhong deleted the brave_theme_option branch September 4, 2018 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to switch between Dark / Light mode
5 participants