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

Rewards extension in brave bar #431

Merged
merged 2 commits into from
Sep 13, 2018
Merged

Conversation

mkarolin
Copy link
Collaborator

@mkarolin mkarolin commented Sep 11, 2018

Fixes brave/brave-browser#669

Adds a placeholder for Rewards extension (the real extension code is to be implemented separately).
Places the extension into resource pack and provides necessary wiring to load the extension from resources. The loading of extension is predicated on BRAVE_REWARDS_ENABLED flag due to pending port of anonize.
Removes the Rewards extension button from main extensions area (ToolbarActionsBar / BrowserActionsContainer) and places it into BraveActionsBar in the omnibox.
Rewards extension button inherits behavior of BraveActionsBar buttons: disabled context menu, no drag&drop of buttons within the bar.
Renames ShieldsActionViewController to BraveActionViewController as the controller is now used for both Shields and Rewards action views. Due to renaming patches/chrome-browser-ui-extensions-extension_action_view_controller.h.patch had to be updated with the new name.

This PR should not be merged because it contains placeholder UI for Rewards extension.

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:

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

@mkarolin mkarolin changed the title WIP: Rewards extension in brave bar Rewards extension in brave bar Sep 11, 2018
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.

This all looks and works great to me. I'm going to get an updated icon to put in as the vertical alignment is off. Even though it's a placeholder, I think this PR can own the look on the toolbar and then brave/brave-browser#920 can own the content area.

In the meantime we should ask @yrliou to review, who just completed similar work on an extension.

@mkarolin
Copy link
Collaborator Author

@petemill, thanks, I was going to ping Ross about the icons. If you are going to get them, should we add all sizes like we do for the shields extension (vendor/brave-extension/app/assets/img)? Please, let me know if you want me to follow up.

Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

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

Extension resources packing and loading looks good to me, a few small comments left, nothing major.

@@ -35,6 +37,15 @@ void BraveComponentLoader::AddDefaultComponentExtensions(
Add(IDR_BRAVE_EXTENSON, brave_extension_path);
}

#if BUILDFLAG(BRAVE_REWARDS_ENABLED) && !defined(OFFICIAL_BUILD)
if (!command_line.HasSwitch(switches::kDisableBraveRewardsExtension)) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we have corresponding changes in brave-browser for adding this command line switch?

@@ -35,6 +37,15 @@ void BraveComponentLoader::AddDefaultComponentExtensions(
Add(IDR_BRAVE_EXTENSON, brave_extension_path);
}

#if BUILDFLAG(BRAVE_REWARDS_ENABLED) && !defined(OFFICIAL_BUILD)
Copy link
Member

Choose a reason for hiding this comment

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

Could we have a note here that !defined(OFFICIAL_BUILD) should be removed when we have some actual UI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will add a comment

@@ -22,4 +22,7 @@
"includes": [36500],
},
# brave webtorrent 37500
"brave/components/brave_rewards/resources.grd": {
"includes": [37600],
Copy link
Member

Choose a reason for hiding this comment

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

As discussed offline, let's do 38000 here, thanks!

// Don't show the Brave and Rewards 'extensions' in the ToolbarActions
// extensions area. They will instead be shown in the BraveActions area.
if (extension->id() == brave_extension_id ||
extension->id() == brave_rewards_extension_id) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: align with previous line?

"browser_action": {
"default_popup": "extension/popup.html",
"default_icon": "extension/img/BAT_icon_placeholder_32.png"
},
Copy link
Member

Choose a reason for hiding this comment

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

extensions should have CSP defined, tho probably fine since it's still just a stub right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, my assumption is that whomever implements the actual extension will add the appropriate CSP.

mkarolin added a commit to brave/brave-browser that referenced this pull request Sep 12, 2018
    Fixes #1103

    Related: brave/brave-core#431

    You can do this with:

    ```
    npm run start -- --disable_brave_rewards_extension
    ```

    or

    ```
    yarn start --disable_brave_rewards_extension
    ```
@petemill
Copy link
Member

@mkarolin here's some updated icons for the extension if we want to get that in here before it's merged https://www.dropbox.com/s/370cc0dtowvh45p/brave-payments-extension-icon.zip?dl=0

Additionally, it would be great to squash some of these commits so that anything fixed or any changes in response to reviews are squashed in to the commit that the change originated in.

@mkarolin mkarolin force-pushed the maxk-rewards-extension-in-brave-bar branch from e2a1a43 to e4149ec Compare September 13, 2018 13:28
@mkarolin
Copy link
Collaborator Author

Updated with actual extension icons. Squashed code review commits.

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.

Really nice - works perfectly! 🎉

@petemill petemill merged commit e8468ee into master Sep 13, 2018
@petemill petemill deleted the maxk-rewards-extension-in-brave-bar branch September 13, 2018 16:40
petemill added a commit that referenced this pull request Sep 13, 2018
@petemill
Copy link
Member

0.55.x 45cc8b3

@bbondy
Copy link
Member

bbondy commented Sep 14, 2018

added merged/0.55.x label

petemill pushed a commit that referenced this pull request Jul 27, 2020
Revert "add toggle for enable_distro_version_check"
petemill pushed a commit that referenced this pull request Jul 27, 2020
    Fixes #1103

    Related: #431

    You can do this with:

    ```
    npm run start -- --disable_brave_rewards_extension
    ```

    or

    ```
    yarn start --disable_brave_rewards_extension
    ```
petemill pushed a commit that referenced this pull request Jul 28, 2020
Revert "add toggle for enable_distro_version_check"
petemill pushed a commit that referenced this pull request Jul 28, 2020
    Fixes #1103

    Related: #431

    You can do this with:

    ```
    npm run start -- --disable_brave_rewards_extension
    ```

    or

    ```
    yarn start --disable_brave_rewards_extension
    ```
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.

Brave Rewards button
4 participants