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

set shields interface views as a global default in settings #2973

Merged
merged 4 commits into from
Aug 2, 2019

Conversation

cezaraugusto
Copy link
Contributor

@cezaraugusto cezaraugusto commented Jul 22, 2019

close brave/brave-browser#4784

Screen Shot 2019-07-29 at 16 57 31

Submitter Checklist:

Test Plan:

Settings --> Shields

  1. Go to brave://settings/shields

  2. Select Simple View

  3. Go to a website

  4. Open Shields
    --> Expected: Chceck shields view is Simple

  5. Go to brave://settings/shields again

  6. Select Advanced View

  7. Go to a website

  8. Open shields
    --> Expected: Chceck shields view is Advanced (larger)

Shields --> Settings

  1. Clean profile

  2. Go to a website

  3. Open shields
    --> Expected: Shields opens in Simple view (clean profile defaults to "simple")

  4. Toggle option to "Advanced view" inside shields popup

  5. Visit brave://settings/shields in another window or tab
    --> Expected: "Default view" has 'Advanced view' selected

  6. Visit website again

  7. Open Shields

  8. Click 'Simple View' inside shields popup

  9. Switch back to Settings tab / window
    --> Expected: "Default view" has 'Simple view' selected

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.

@cezaraugusto cezaraugusto force-pushed the ca-4784 branch 3 times, most recently from 53ce545 to 3b52ba4 Compare July 29, 2019 21:15
@cezaraugusto cezaraugusto marked this pull request as ready for review July 29, 2019 21:22
@cezaraugusto cezaraugusto requested a review from bridiver as a code owner July 29, 2019 21:22
@simonhong
Copy link
Member

IMO, using webui message seems more proper than extension api for this. WDYT? cc: @petemill

@petemill
Copy link
Member

@simonhong This is using the existing chrome.braveShields extensions API as this is to enable the set / get in the extension browserAction popup. The settings page itself uses the regular settingsPrivate API (via the prefs attribute). Unless I'm mistaken, we don't or can't use WebUIMessageHandler in an extension.

petemill
petemill previously approved these changes Jul 30, 2019
petemill
petemill previously approved these changes Jul 30, 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.

👍 🤜 🤛 💯 Pushed a successful rebase on master. Ran through some manual tests and I updated the PR description with more detailed test case of what I ran through (observing both settings page and shields popup reflects the setting value). Settings page addition looks great 🎨.

Let's see what CI has to say...

@simonhong
Copy link
Member

simonhong commented Jul 30, 2019

@petemill Oops, I thought above capture image is part of settings page :)
I see. we want to set it from shields panel and settings page. If so, shields extension api is right choice :)

common/pref_names.cc Outdated Show resolved Hide resolved
@petemill
Copy link
Member

petemill commented Jul 31, 2019

I pushed a change to use the chrome.settingsPrivate API and to make the Preference name more descriptive and shields-specific. @cezaraugusto @bridiver please re-review with these changes: 62420d4...f97caaf

@petemill petemill force-pushed the ca-4784 branch 2 times, most recently from 2025e6c to bded845 Compare July 31, 2019 22:31
"whitelist": [
"63ED55E43214C211F82122ED56407FF1A807F2A3", // Media Router Dev
"226CF815E39A363090A1E547D53063472B8279FA" // Media Router Release
+ , "A321D47A2B4CA86898167A55CA8B2E02385EA7CD" // Brave Shields
Copy link
Member

@petemill petemill Jul 31, 2019

Choose a reason for hiding this comment

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

@bridiver there's a few ways to approach this:

  1. Keep this .patch of _permission_features.json
  2. Overwrite the settingsPrivate entry in _api_features.json using the same technique we're doing for other APIs. Disadvantage: requires duplicating security-focused chromium code and is a risk IMO.
  3. Overwrite _permission_features.json in the same way we overwrite _api_features.json. Comes with same risk as 2)?.
  4. Invent a new way to inject additions to the JSON of _api_features.json or _permission_features.json without overwriting the chromium source.

(Preferrably as a follow-up to unblock @cezaraugusto 's feature in this PR).

Copy link
Collaborator

Choose a reason for hiding this comment

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

see brave/common/extensions/api/_api_features.json

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, this is permissions, but easy to copy it

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is pretty trivial change so I think we should fix before merging

Copy link
Member

Choose a reason for hiding this comment

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

@bridiver added _api_permissions.json, please review

@petemill
Copy link
Member

petemill commented Aug 1, 2019

Fixed the unit tests by mocking chrome.settingsPrivate here: https://github.com/brave/brave-core/pull/2973/files#diff-af22ed52c8ebf2799010b2d6e01b7107R113

@cezaraugusto
Copy link
Contributor Author

@bridiver @petemill seems all feedback was addressed. do we need anything else to finish up this PR?

common/pref_names.cc Outdated Show resolved Hide resolved
petemill
petemill previously approved these changes Aug 1, 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.

LGTM - CI looks like it had passed apart from a lint warning, which I pushed a fix for

@cezaraugusto cezaraugusto merged commit 2b9340b into master Aug 2, 2019
@cezaraugusto cezaraugusto deleted the ca-4784 branch August 2, 2019 14:12
@kjozwiak
Copy link
Member

kjozwiak commented Aug 2, 2019

Please make sure that the PR's and associated issues are moved into milestones once completed 👍

@kjozwiak kjozwiak added this to the 0.70.x - Nightly milestone Aug 2, 2019
@bsclifton
Copy link
Member

@cezaraugusto does this need to go to 0.69.x also? I tried to cherry-pick, but ran into some merge conflicts in components/definitions/chromel.d.ts. If merge is safe there, I can create an uplift for you. Let me know! 😄

bsclifton pushed a commit that referenced this pull request Aug 15, 2019
set shields interface views as a global default in settings
@bsclifton
Copy link
Member

@cezaraugusto created #3187 - can you help me make sure this looks good? 😄

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.

Shields: Add Default view option in settings for simple and advanced views
7 participants