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

Show default browser dialog instead of infobar #7716

Merged
merged 3 commits into from
Feb 2, 2021

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Jan 27, 2021

fix brave/brave-browser#12203

Screen Shot 2021-01-29 at 1 55 34 AM

Screen Shot 2021-01-29 at 1 56 08 AM

Submitter Checklist:

  • There is a ticket for my issue.
  • Used Github auto-closing keywords in the commit message.
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed).
  • Requested a security/privacy review as needed.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  1. Launch browser with any profile (clean or existing both are fine)
  2. Repeat launch and check default browser dialog is launched 2nd, 3rd, 4th, 8th and 20th launching
  3. Set as default
  4. Launch browser and check dialog is not launched anymore
  5. Set another browser as a default browser
  6. Repeat launch and check default browser dialog is launched 2nd, 3rd, 4th, 8th and 20th launching

Note If active tab is welcome page, dialog is not visible even if it's 2nd, 3rd, 4th, 8th or 20th launching.

@simonhong simonhong self-assigned this Jan 27, 2021
@simonhong simonhong force-pushed the default_browser_dialog branch 6 times, most recently from 2298e28 to 6e5d73c Compare January 28, 2021 13:28
@simonhong simonhong changed the title WIP: Show default browser dialog instead of infobar Show default browser dialog instead of infobar Jan 28, 2021
@simonhong simonhong marked this pull request as ready for review January 28, 2021 13:58
@simonhong simonhong requested a review from a team as a code owner January 28, 2021 13:58
@simonhong simonhong force-pushed the default_browser_dialog branch from 6e5d73c to 525b234 Compare January 28, 2021 13:59
@simonhong
Copy link
Member Author

@rebron @karenkliu Can you check above test scenario?

@simonhong simonhong force-pushed the default_browser_dialog branch 2 times, most recently from c700f3b to bbe22ee Compare January 28, 2021 16:59
Copy link

@karenkliu karenkliu left a comment

Choose a reason for hiding this comment

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

Looks great!

@simonhong simonhong force-pushed the default_browser_dialog branch from bbe22ee to 878366c Compare January 29, 2021 00:31
Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

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

chromium_src changes ++

@simonhong simonhong force-pushed the default_browser_dialog branch 3 times, most recently from 585ad58 to f79544f Compare February 1, 2021 02:08
@simonhong simonhong requested a review from iefremov February 1, 2021 02:09
#include <utility>

#include "base/bind.h"
#include "base/logging.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

is it needed? pls double-check for unused headers

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

class Label;
} // namespace views

class BraveDefaultBrowserDialogView : public views::DialogDelegateView {
Copy link
Contributor

Choose a reason for hiding this comment

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

since recently, I'm pretty paranoid re accessibility properties of views :) It looks good here, but maybe you also could double-check

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's fine because this dialog doesn't introduce new view class.
and did test many times with virtual keyboard on. :)


PrefService* prefs = profile->GetPrefs();
// Reset preferences if kResetCheckDefaultBrowser is true.
if (prefs->GetBoolean(prefs::kResetCheckDefaultBrowser)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

That's interesting how this is initialized

#if defined(OS_WIN)
  reset_check_default = base::win::GetVersion() >= base::win::Version::WIN10;
#endif
  registry->RegisterBooleanPref(prefs::kResetCheckDefaultBrowser,
                                reset_check_default);

not sure whether we need this behavior

Copy link
Member Author

Choose a reason for hiding this comment

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

This would be helpful when win version is updated and default browser setting is changed.
Then, we want to make Brave as a default again.

Browser will launch window modal dialog at 2nd, 3rd, 4th, 8th and 20th
launching if browser is not a default.

If browser is changed from default to non-default, browser will launch
dialog again with same frequency.

fix brave/brave-browser#12203
@simonhong simonhong force-pushed the default_browser_dialog branch from 20ac4f9 to bdac367 Compare February 1, 2021 23:22
@simonhong
Copy link
Member Author

AdBlockServiceTest.CosmeticFilteringProtect1p was failed only on Windows CI but it's unrelated with this PR.

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.

'Set browser as default' dialog on 2nd and nth launch
4 participants