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

Fixed brave scheme url is changed to chrome scheme url when copying from omnibox #4512

Merged
merged 3 commits into from
Feb 12, 2020

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Feb 5, 2020

fix brave/brave-browser#1973

Submitter Checklist:

Test Plan:

npm run test brave_browser_tests -- --filter=BraveOmniboxViewViewsTest*

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 1.6.x - Nightly milestone Feb 5, 2020
@simonhong simonhong self-assigned this Feb 5, 2020
@simonhong simonhong marked this pull request as ready for review February 5, 2020 05:57
@simonhong simonhong requested a review from bridiver as a code owner February 5, 2020 05:57
@simonhong simonhong requested review from darkdh and jumde February 5, 2020 05:57
@simonhong
Copy link
Member Author

Kindly ping to owner :) @bridiver


if (ShouldAdjust(original_selected_text, selected_text)) {
BraveLocationBarModelDelegate::FormattedStringFromURL(url, &selected_text);
ReplaceChromeSchemeToBrave(&url);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this logic exists in too many places and needs to be consolidated into some kind of utility function

Copy link
Member Author

Choose a reason for hiding this comment

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

Most other places are converting from brave to chrome scheme.
but we need to convert from chrome to brave.


namespace {
// Copied from omnibox_view_views.cc
constexpr base::Feature kOmniboxCanCopyHyperlinksToClipboard{
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we copying this? It's completely pointless because we'd have to track upstream changes anyway which is a problem

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.


void BraveOmniboxViewViews::OnAfterCutOrCopy(
ui::ClipboardBuffer clipboard_buffer) {
ui::Clipboard* cb = ui::Clipboard::GetForCurrentThread();
Copy link
Collaborator

Choose a reason for hiding this comment

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

we shouldn't be copying this entire method. We only need different behavior the specific case of a chrome:// url

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.

ui::ScopedClipboardWriter scoped_clipboard_writer(clipboard_buffer);
scoped_clipboard_writer.WriteText(selected_text);

if (write_url &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

this feature flag is a problem as per comment above

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 fix_1973 branch 2 times, most recently from ad624a0 to c765318 Compare February 12, 2020 01:56
@simonhong simonhong merged commit 6b31902 into master Feb 12, 2020
@simonhong simonhong deleted the fix_1973 branch February 12, 2020 06:31
@bbondy bbondy removed this from the 1.6.x - Beta milestone Mar 10, 2020
@bbondy bbondy added this to the 1.7.x - Dev milestone Mar 10, 2020
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.

Copying brave:// results in pasting chrome://
4 participants