Commit Graph
24 Commits
Author SHA1 Message Date
Mario Sanchez Prada bbf5fd3fe9 Remove deprecated DISALLOW_ macros from Brave-specific code
Macros such as DISALLOW_COPY_AND_ASSIGN() are deprecated since r711900
per style arbitration [1]. This commit replaces the macros with deleted
constructors and methods, which is preferred by the Google C++ Style
Guide [2][3].

Also remove unneeded "base/macros.h" #includes when possible.

This CL is created semi-mechanically with remove_disallow and
remove_base_macros [4].

[1]: https://groups.google.com/a/chromium.org/g/cxx/c/qwH2hxaEjac/m/TUKq6eqfCwAJ
[2]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
[3]: https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types
[4]: https://pkg.go.dev/go.timothygu.me/tools/cr/cmd

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/d002a3bee7ae75780b604d17df19291a3dd303fb

commit d002a3bee7ae75780b604d17df19291a3dd303fb
Author: Peter Boström <pbos@chromium.org>
Date:   Fri Nov 5 17:17:19 2021 +0000

    Remove DISALLOW_ macros from base/macros.h

    This removes DISALLOW_COPY(), DISALLOW_ASSIGN() and
    DISALLOW_COPY_AND_ASSIGN() from base/macros.h. PRESUBMITs are also
    updated to no longer check for these macros.

    IWYU removal is left as a separate change just in case this needs to be
    reverted.

    Bug: 1010217
2022-01-24 15:33:37 -05:00
Mario Sanchez Prada 23b2cbee7e Adapt to removal of ListValue::AppendStrings()
Chromium change:

https://chromium.googlesource.com/chromium/src/+/c126d64cab6443252034b1bd4b52e47ed1c50bbb

commit c126d64cab6443252034b1bd4b52e47ed1c50bbb
Author: Anastasiia N <anastasiian@chromium.org>
Date:   Wed Jun 2 14:11:49 2021 +0000

    CodeHealth: Remove ListValue::AppendStrings()

    Bug: 1187103
2021-08-18 10:43:09 -04:00
Mario Sanchez Prada d3f2fc269f Pass newly-added parameter to Profile::GetPrimaryOTRProfile()
We need to pass true to preserve the previous behaviour now.

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/94e457276df130575423e518181ece753734d6b9

commit 94e457276df130575423e518181ece753734d6b9
Author: Ramin Halavati <rhalavati@chromium.org>
Date:   Tue Apr 13 12:27:51 2021 +0000

    Remove default value of Profile::GetOffTheRecordProfile()

    Removes the default value of the newly added |create_if_needed|
    aregument of Profile::GetOffTheRecordProfile() and updates all use cases
    with adding the new argument.

    This CL does not change any behavior.

    AX-Relnotes: n/a.
    Bug: 1191315
2021-06-29 16:34:58 -04:00
Mario Sanchez Prada 5c5e061230 Override newly added method to RenderViewContextMenuProxy
A new RemoveSeparatorBeforeMenuItem() pure virtual method has been
added, so we need to override it from BraveMockRenderViewContextMenu.

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/3ac3f99cb82b34690d800a4dfdbefe2630060e39

commit 3ac3f99cb82b34690d800a4dfdbefe2630060e39
Author: Bruce Long <brlong@microsoft.com>
Date:   Wed Mar 17 19:41:33 2021 +0000

    Windows Spellcheck: Renderer process can hang retrieving suggestions

    If there are a large number of misspellings in editable content (try
    some 2000 characters of Lorem Ipsum) and you right click on a
    misspelled word to bring up the context menu with suggested
    corrections, the renderer process will stop responding if Windows
    platform spellchecking is being used.

    The main issue is that if suggestions have not already been retrieved
    and cached, a synchronous IPC is made from the renderer process to the
    browser process, which will not return until GetPerLanguageSuggestions
    completes. If the platform spellchecker is still busy performing a text
    check on all of the content, this can be a long wait.

    A reason that the full text check may take a long time is that
    suggestions are being retrieved for all misspelled words, even though
    the user may never invoke the context menu to view them.

    The fix is to postpone the retrieval of platform spellchecker
    suggestions until SpellingMenuObserver::InitMenu is called on the
    browser process side. This is done asynchronously following the same
    pattern already used for the remote enhanced spellcheck service.
    Placeholder menu items are added to the context menu, with one of them
    presenting an animation while the retrieval is underway. The callback
    when the retrieval completes updates the menu items with a combination
    of suggestions from Hunspell (still retrieved on the renderer side)
    and the platform.

    Other fixes:
    1) The renderer side method ContextMenuController::ShowContextMenu was
       retrieving suggestions even for words not marked as misspelled,
       passing an empty string even for Hunspell.
    2) When the platform spellchecker performs a full text check in method
       RequestTextCheckForAllLanguages, it was retrieving suggestions
       as well. Now suggestions are only retrieved on demand. Since there
       is some perf trade off between pre-caching suggestions and
       retrieving them when the context menu is invoked, this part of the
       fix is placed behind a feature flag:
       WinRetrieveSuggestionsOnlyOnDemand (on by default)

    Bug: 1150610
2021-05-05 12:24:41 +02:00
Mario Sanchez Prada 79af4bc963 Replace all usage of base::string16 with std::u16string
The "base/strings/string16.h" file does no longer exist and we need
to remove all remaining usages of that type with the one from the
C++ standard library instead, like Chromium upstream already did.

Also replaces no longer needed ASCIIToUTF16 and UTF8ToUTF16 calls used
with constant strings with `u` string literals.

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/7e1e44476bb361e95dc252d8428324a3feb89ecd

commit 7e1e44476bb361e95dc252d8428324a3feb89ecd
Author: Jan Wilken Dörrie <jdoerrie@chromium.org>
Date:   Sun Mar 14 19:37:05 2021 +0000

    [LSC] Remove base/strings/string16.h

    This change removes base/strings/string16.h and remaining references to
    it from the code base.

    Bug: 1184339
2021-05-05 12:03:20 +02:00
Gyuyoung Kim b0ebf11e7a Fix deps in //brave/tests
Remove unnecessary includes header files and
add missing dependencies to the proper targets.

Additionally, this PR copies TranslateManagerTest from
upstream code to TranslateManagerUnittest in order to
avoid touching the upstream code. Then, this PR renames
the file to brave_translate_manager_unittest.cc.

Resolves brave/brave-browser#10613.
2020-10-29 19:23:40 +09:00
Mario Sanchez Prada f07cca22fd Replace param-less GetOffTheRecordProfile() with GetPrimaryOTRProfile()
Chromium change:

https://chromium.googlesource.com/chromium/src/+/b06b34efeb4d6648d9b014c7cf8bf5e73284b69c

commit b06b34efeb4d6648d9b014c7cf8bf5e73284b69c
Author: Ramin Halavati <rhalavati@chromium.org>
Date:   Thu Sep 3 12:01:34 2020 +0000

    Remove defaults from Profile::[Get/Has]OffTheRecordProfile().

    The default values for OffTheRecord profile functions are removed and
    all remaining use cases are replaced with [Get/Has]PrimaryOTRProfile.

    The cases that need further update later are marked with TODO.

    This CL does NOT change any behavior.

    Bug: 1033903
2020-10-28 14:00:05 -04:00
mkarolin d464dc67d4 Lint fix. 2020-09-11 14:45:34 -04:00
Mario Sanchez Prada 17dac626c2 Adapt BraveMockRenderViewContextMenu to use ui::ImageModel
It used to rely on gfx::ImageSkia, but that has changed upstream.

Also, remove the instances of AddSubMenuWith[StringIdAnd]Icon() that
relied on gfx::VectorIcon, no longer used upstream either.

Chromium change:

https://chromium.googlesource.com/chromium/src/+/347b70900793a9a2361b717053be1ba223b15a98

commit 8c5491040715619cf8aa97671d0a44f9f4fdd0c5
Author: Richard Knoll <knollr@chromium.org>
Date:   Tue Aug 25 17:24:07 2020 +0000

    Fix icon size for Sharing context menu entries

    Before crrev.com/c/2232978 the icon size was hardcoded in MenuItemView,
    but that CL changed it to respect the incoming vector icon size. We
    can't modify the vector source so we need to set a size when using it.
    This also cleans up the duplicated *WithIcon methods and unifies them to
    a single one taking a ui::ImageModel instead.

    Bug: 1109643
    Change-Id: Ib78f683ffee672668c79397122a0e3f5725f58f4
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2369181
    Reviewed-by: Avi Drissman <avi@chromium.org>
    Reviewed-by: Peter Kasting <pkasting@chromium.org>
    Commit-Queue: Richard Knoll <knollr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#801441}
2020-09-11 14:45:34 -04:00
Pranjal Jumde a39b63087a Add missing deps 2020-07-20 09:58:02 -07:00
Pranjal Jumde 9c2501854e Fix 9365: Add gn check to npm scripts 2020-07-20 09:58:02 -07:00
mkarolin 35e73f73f7 [Browser Tests] IWYU browser_test.h.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/919ce657e4e37dfa13758f1eb8fe0e9ef7ab1b20

commit 919ce657e4e37dfa13758f1eb8fe0e9ef7ab1b20
Author: Peter Kasting <pkasting@chromium.org>
Date:   Thu May 7 10:22:36 2020 +0000

    Add missing #includes of browser_test.h.

    This is a step towards doing full IWYU of browser_test.h, which will
    have other benefits.

    Completely mechanical and already R+ed as part of r765923.

    Bug: none
2020-07-01 18:12:03 -04:00
mkarolin daff413b41 Lint fixes 2020-05-26 10:02:29 -04:00
mkarolin 18e2373d55 [Browser Tests] ContextMenuParams moved.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/8c4446dcf4ef6d9d58bb7f578f2946eb1638ddb8

commit 8c4446dcf4ef6d9d58bb7f578f2946eb1638ddb8
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date:   Wed Mar 11 22:16:42 2020 +0000

    Splitting context_menu_params.h into separate browser VS common parts.

    This CL takes //content/public/common/context_menu_params.h and splits
    it into:

    1. //content/public/common/*untrustworthy*_context_menu_params.h
       which contains:
       - UntrustworthyContextMenuParams
       - CustomContextMenuContext (type of a field under
         UntrustworthyContextMenuParams)

    2. //content/public/*browser*/context_menu_params.h
       which contains:
       - ContextMenuParams

    Bug: 534561
2020-05-26 09:52:30 -04:00
mkarolin 423edc1235 Updated mock RenderViewContextMenu with missing API methods.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/0d23b8d4b1e67392c80f8add8da47d14a22cac0c

commit 0d23b8d4b1e67392c80f8add8da47d14a22cac0c
Author: Evan Stade <estade@chromium.org>
Date:   Wed Aug 14 17:13:41 2019 +0000

    Add the ability to use a VectorIcon in MenuModel.

    The color and size of the vector icon is controlled by the view, and is
    not a property of the model.

    This CL adds plumbing to RenderViewContextMenuModel, ui::MenuModel, and
    views::MenuItemView, and updates the click-to-call context menu to use
    the new abilities. The click-to-call menu icon is downsized from 20 to
    16, which matches other context menu icons.

    Just enough of the APIs are updated for purposes of the click to call
    menu. More can be added as needed for other menus and icons.

    Bug: 989353
2019-10-10 02:53:24 -04:00
Max Karolinskiy 2c6f5da57e Browser Test: added missing overrides to BraveMockRenderViewContextMenu.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/d6b794c59f423ead8b1f2633c7fd879710aa1382

commit d6b794c59f423ead8b1f2633c7fd879710aa1382
Author: Himanshu Jaju <himanshujaju@chromium.org>
Date:   Tue Jul 16 19:31:46 2019 +0000

    Context menu for click to call
    Add tel scheme to list of schemes in url

    Screenshot for multiple devices: https://storage.cloud.google.com/chromium-translation-screenshots/d3ea7c88529dd93e5f403fa57d5df3bfadf8936a

    Screenshot for single device: https://storage.cloud.google.com/chromium-translation-screenshots/bc5be9872a3e0a2c30bbb9a80ac370cafa339988

    Bug: 972060
2019-09-05 21:22:24 -04:00
bridiver e3917f6315 add support for building android-apk
required for https://github.com/brave/brave-browser/issues/2117
2019-05-08 12:35:11 -07:00
Max Karolinskiy 8114d82b30 Revert "Merge pull request #2088 from brave/revert-c74-with-deps"
Reland C74 on master.

This reverts commit f6cfa13c73, reversing
changes made to 6143676339.
2019-04-01 17:46:01 -04:00
Brian Clifton 66e6c951d4 Revert Chromium 74
(originally implemented with https://github.com/brave/brave-core/pull/2013)

Fixes https://github.com/brave/brave-browser/issues/3898
2019-03-26 18:35:47 -07:00
Max Karolinskiy 39945c8e5e Lint fixes. 2019-03-19 16:10:05 -04:00
Max Karolinskiy bbb090aa74 Browser tests fix: kAcceptLanguages pref moved to a different header.
Chromium change:

commit 572755bab76f7d4aa697fffebbdcb03ac92a44cd
Author: Alexandre Frechette <frechette@chromium.org>
Date:   Wed Feb 13 22:30:20 2019 +0000

    Moving the core language prefs (kAcceptLanguages and kPreferredLanguages) to components/language.

    Bug: 902354, 872096
2019-03-19 16:10:02 -04:00
Brian R. Bondy 1c7c198857 Lint fix 2019-02-12 00:41:31 -05:00
Brian R. Bondy 7252734a68 C73 changes for brave_browser_tests 2019-02-11 21:28:40 -05:00
Max Karolinskiy c82efbcebb Hide RenderViewContextMenu::AddSpellCheckServiceItem method with
one in BraveRenderViewContextMenu that does not add Ask Brave menu item.

Fixes brave/brave-browser#1623

Also, overrides SpellingMenuObserver to remove a possible dangling menu
separator. Adds browser tests for spelling menu and spelling options
submenu that check that the "Ask Brave for suggestions" menu item is not
present.
2018-10-29 16:43:14 -07:00