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

Use brave theme type as a system dark mode on Windows #2352

Merged
merged 1 commit into from
May 10, 2019

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented May 1, 2019

Aligning base UI theme(ex, context menu) with brave theme was not
implemented on Windows because Windows doesn't support per-application
theme. Whereas, MacOS support it. So, when user set dark or light, it is
set as a application theme.
To solve this on Windows, NativeThemeWin::SystemDarkModeEnabled() checks
whether dark mode enabling is overridden or not.
Overridden value is set by client(BraveThemeService).

Fix brave/brave-browser#4056
Fix brave/brave-browser#4272
Fix brave/brave-browser#3804

Submitter Checklist:

Test Plan:

  1. Start browser on Win10 and open settings page
  2. Set brave theme to light or dark
  3. Change os theme to dark or light and check settings page theme is not changed.
  4. Set brave theme to Same as Windows
  5. Change os theme to dark or light and check settings page theme is changed

Other manual tests are described in related issues.

yarn test brave_browser_tests --filter=BraveThemeServiceTest.SystemThemeChangeTest

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

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@simonhong simonhong added this to the 0.66.x - Nightly milestone May 1, 2019
@simonhong simonhong self-assigned this May 1, 2019
@simonhong simonhong force-pushed the align_brave_theme_with_native_theme_on_windows branch 3 times, most recently from 1623b95 to e5c820b Compare May 2, 2019 01:21
@simonhong simonhong marked this pull request as ready for review May 2, 2019 01:21
@simonhong
Copy link
Member Author

security test is failed on Builder.

@simonhong simonhong force-pushed the align_brave_theme_with_native_theme_on_windows branch from e5c820b to bf60812 Compare May 6, 2019 02:50
@simonhong
Copy link
Member Author

Kindly ping..

petemill
petemill previously approved these changes May 9, 2019
Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

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

Works really nicely 🎨

@petemill
Copy link
Member

petemill commented May 9, 2019

Before merging, re-running PR builder due to previous time-out failure...

@petemill petemill dismissed their stale review May 9, 2019 01:42

PR builder not passed yet

@simonhong
Copy link
Member Author

@petemill Yup, will rebase again! thanks for review

@simonhong simonhong force-pushed the align_brave_theme_with_native_theme_on_windows branch from bf60812 to 96bca73 Compare May 9, 2019 01:45
@petemill
Copy link
Member

petemill commented May 9, 2019

@simonhong most recent failure is possibly:

19:07:52  
19:07:52  python C:\jenkins\workspace\eme_with_native_theme_on_windows\scripts\lint.py --project_root=C:\jenkins\workspace\eme_with_native_theme_on_windows\src --base_branch=origin/master
19:07:54  Done processing browser\themes\brave_theme_service.cc
19:07:54  
19:07:54  browser\themes\brave_theme_service.h:6:  #ifndef header guard has wrong style, please use: JENKINS_WORKSPACE_EME_WITH_NATIVE_THEME_ON_WINDOWS_SRC_BRAVE_BROWSER_THEMES_BRAVE_THEME_SERVICE_H_  
19:07:54  [build/header_guard] [5]
19:07:54  
19:07:54  browser\themes\brave_theme_service.h:88:  #endif line should be "#endif  // JENKINS_WORKSPACE_EME_WITH_NATIVE_THEME_ON_WINDOWS_SRC_BRAVE_BROWSER_THEMES_BRAVE_THEME_SERVICE_H_"  
19:07:54  [build/header_guard] [5]
19:07:54  

@simonhong
Copy link
Member Author

@simonhong most recent failure is possibly:

19:07:52  
19:07:52  python C:\jenkins\workspace\eme_with_native_theme_on_windows\scripts\lint.py --project_root=C:\jenkins\workspace\eme_with_native_theme_on_windows\src --base_branch=origin/master
19:07:54  Done processing browser\themes\brave_theme_service.cc
19:07:54  
19:07:54  browser\themes\brave_theme_service.h:6:  #ifndef header guard has wrong style, please use: JENKINS_WORKSPACE_EME_WITH_NATIVE_THEME_ON_WINDOWS_SRC_BRAVE_BROWSER_THEMES_BRAVE_THEME_SERVICE_H_  
19:07:54  [build/header_guard] [5]
19:07:54  
19:07:54  browser\themes\brave_theme_service.h:88:  #endif line should be "#endif  // JENKINS_WORKSPACE_EME_WITH_NATIVE_THEME_ON_WINDOWS_SRC_BRAVE_BROWSER_THEMES_BRAVE_THEME_SERVICE_H_"  
19:07:54  [build/header_guard] [5]
19:07:54  

@petemill Hmm, no lint error on local.. Lint gave invalid suggestion. seems lint bug..

@simonhong simonhong force-pushed the align_brave_theme_with_native_theme_on_windows branch from 96bca73 to 064abe7 Compare May 9, 2019 20:25
Aligning base UI theme(ex, context menu) with brave theme was not
implemented on Windows because Windows doesn't support per-application
theme. Whereas, MacOS support it. So, when user set dark or light, it is
set as a application theme.
To solve this on Windows, NativeThemeWin::SystemDarkModeEnabled() checks
whether dark mode enabling is overridden or not.
Overridden value is set by client(BraveThemeService).
@simonhong simonhong force-pushed the align_brave_theme_with_native_theme_on_windows branch from 064abe7 to 2c1bc58 Compare May 9, 2019 23:10
@simonhong simonhong requested a review from petemill May 10, 2019 02:17
Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

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

Exciting!

@petemill petemill merged commit 147edc7 into master May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants