Commit Graph
80 Commits
Author SHA1 Message Date
mkarolin 24bf5fd148 Fixes overriding WebUI default fonts.
Function in web_ui_util.cc is no longer used to get the
text_defaults_md.css resource for shared resources. Keep our override
for the function resouce because it's still used in several places.

Additionally, copy over our text_defaults_md.css via util.js so that
it's used when chromium GRD is auto generated.

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/ba11d6dc4a110c2c456eb453b445832847230b5e

commit ba11d6dc4a110c2c456eb453b445832847230b5e
Author: dpapad <dpapad@chromium.org>
Date:   Wed Feb 24 18:26:57 2021 +0000

    WebUI: Replace SharedResourcesDataSource with a regular WebUIDataSource.

    SharedResourcesDataSource was a custom class directly subclassing
    URLDataSource (and used for serving chrome://resources URLs). By doing
    so it included a lot of duplicated functionality for code that is
    already available in regular WebUIDataSourceImpl subclasses, for
    example

     - Registering resources
     - Registering loadTimeData strings
     - Calculating mime types based on a path's extension
     - Locating and serving WebUI files from pak files
     - Overriding specific CSP policies

    By using a regular WebUIDataSourceImpl a lot of duplicated code is
    deleted. Moreover, WebUIDataSourceImpl is a more mature class, that is
    heavily used across WebUI. For example this CL helped discover a bug
    where $i18n{...} string placeholders where incorrectly used in
    cr_components/ (fixed at r854879) because of CHECK()s that did not
    exist in SharedResourcesDataSource.

    In order to support chrome://resources/css/text_defaults.css $i18n{...}
    replacements, web_ui_url_loader_factory.cc has been modified to perform
    $i18n{...} replacements in CSS files too (previously only done for HTML
    files, and conditionally for JS files).

    Bug: 1179207
2021-03-23 14:55:44 -04:00
Mario Sanchez Prada c87977b5d2 Specify a resource_path attribute for Grit resources
This is mandatory now upstream, otherwise the build will fail.

Chromium change:
https://chromium.googlesource.com/chromium/src.git/+/aa0c216c0236a118e51e0e4f07c8ee48667c7004

commit aa0c216c0236a118e51e0e4f07c8ee48667c7004
Author: dpapad <dpapad@chromium.org>
Date:   Mon Feb 1 19:01:58 2021 +0000

    Grit: Force all generated files to specify a resource_path attribute.

     - Remove Grit logic to replace the gen folder with "@out_folder@"
       when generating GritResourceMap keys.
     - Instead add an assertion to ensure that generated files use
       |resource_path| to specify keys for the GritResourceMap.
       Note that the assertion is applied only in grd files that specify
       an output type of "resource_map_source".

    Also remove an alias in shared_resources_data_source.cc that was needed
    for android_clang_arm builds (see explanation at [1]). The workaround
    is no longer necessary as the files in question are added to grd files
    using generate_grd(), and they are leveraging |resource_path|, and not
    using the output folder location as GritResourceMap keys anymore.

    [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1020284#c45

    Fixed: 1171239
2021-03-23 14:55:07 -04:00
Terry Mancey efc1c1c1ea Fixes Brave ads appear underneath MacOS dock/menu bar and Windows taskbar 2021-03-10 07:44:19 +00:00
Terry Mancey fe95efe9fd Fixes Brave Ads crash when closing custom ad notification 2021-03-05 14:28:01 +00:00
mkarolin 1a9ffdab69 [Settings] fixes clicking 'Additional settings'.
Adds missing toolbar functions and removes no longer needed ones that we
removed from cr_toolbar.

Fixes brave/brave-browser#14065
2021-02-09 13:54:57 -05:00
bridiver fb3c0f5561 buildtools/checkdeps/checkdeps.py brave --extra-repos=brave runs succesfully 2021-02-06 13:34:00 -07:00
Terry Mancey 798b3ba1b5 Clang formatted Brave Ads and resolved linter issues 2021-02-06 10:11:20 +00:00
mkarolin 4fe94e11a3 Fixes formatting. 2021-02-04 23:52:49 -05:00
mkarolin 001962300f [WebUI] Fixes Settings left nav hidden state.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/0863a3b4baa1544826b7af95651723864e7679c9

commit 0863a3b4baa1544826b7af95651723864e7679c9
Author: John Lee <johntlee@chromium.org>
Date:   Tue Dec 15 19:18:36 2020 +0000

    Settings WebUI: Maintain focus on menus when changing screen size

    Fixed: 982173
2021-02-04 23:52:47 -05:00
mkarolin b1ac7b9a8c [WebUI] Adjusted rollup_plugin patch and our impl.
Chromium change:

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

commit b8cc59e15f318760e3992cd98cf5508b7796dd59
Author: rbpotter <rbpotter@chromium.org>
Date:   Tue Dec 22 01:33:14 2020 +0000

    optimize_webui: Support external_paths mapping argument

    - Refactor rollup plugin now that all chrome://resources files are
      read from the same folder to use a map and helper instead of
      duplicating logic for the Polymer and resources cases.
    - Add new external_paths argument to the rollup plugin, allowing URL
      prefixes to be mapped to directories.
    - Use this argument to pass the necessary mappings for resources and
      Polymer files to the plugin, instead of hardcoding the paths there
    - Allow the argument to also be extended by invokers, so that
      individual WebUIs can add their own mappings in addition to the
      defaults for chrome://resources and chrome://resources/polymer/v3_0.

    Bug: 1156829
2021-02-04 23:52:25 -05:00
ryanml 68a16f9fe6 Updating CW Icon in settings toolbar
Fixes brave/brave-browser#13770
2021-02-03 14:08:14 -07:00
Pete Miller a283a665b4 New Tab WebUI: dir=rtl via attribute
Targetable in css
2021-01-07 10:40:35 -08:00
mkarolin f6f6d30dc0 Formatting fixes. 2021-01-05 21:27:44 -05:00
mkarolin 0c2b58d195 [WebUI] Adjusted rollup override paths.
https://source.chromium.org/chromium/chromium/src/+/efc282784459e1ec69a524d901d8694cce5230c5

commit efc282784459e1ec69a524d901d8694cce5230c5
Author: rbpotter <rbpotter@chromium.org>
Date:   Tue Sep 1 04:37:15 2020 +0000

    Web UI: Add preprocessed resources and use in rollup

    Preprocess all shared JS module resources into:
    <root_gen_dir>/ui/webui/resources/webui_preprocessed

    and read all these resources from this directory when bundling with
    rollup.

    Bug: 1071641
2021-01-05 21:27:43 -05:00
mkarolin d2bf2c05dc ui/webui/resources/css/ resources grdp is now auto-generated.
Also, adjusted br_elements resource names to prevent collision with
cr_elements resource names.

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/456a8a60d47b523f9ff7b6c5d54ff051e7003963

commit 456a8a60d47b523f9ff7b6c5d54ff051e7003963
Author: dpapad <dpapad@chromium.org>
Date:   Thu Nov 12 06:42:27 2020 +0000

    WebUI: Auto-generate ui/webui/resources/css/ resources grdp file.

    Moving most IDR_WEBUI_CSS_* resources from webui_resources.grd to
    the auto-generated webui_generated_resources.grd.

    Resources that rely on flattenhtml=true are not affected, since
    |flattenhtml| is purposefully not supported by generate_grd().

    Bug: 1132403
2021-01-05 21:27:43 -05:00
mkarolin cd55dd8c67 Use views::PressedCallback instead of views::ButtonListener
Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/37cb433bb3d86231ee0c37cdd8a08f31ab35f172

commit 37cb433bb3d86231ee0c37cdd8a08f31ab35f172
Author: Peter Kasting <pkasting@chromium.org>
Date:   Thu Nov 5 23:22:51 2020 +0000

    Remove ButtonListener.

    Bug: 772945
2021-01-05 21:27:43 -05:00
mkarolin cf399406b6 Button::SetForcusForPlatform was removed.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/aa298022efdaaf3637faf741990ad311f5978cee

commit aa298022efdaaf3637faf741990ad311f5978cee
Author: Wei Li <weili@chromium.org>
Date:   Tue Oct 27 18:37:21 2020 +0000

    Remove SetFocusForPlatform() API

    SetFocusForPlatform() was used to override Button and its subclasses'
    focus behavior. Now the platform default focus behavior becomes Button's
    default setting. This API is no longer needed.

    Bug: 1001103
2020-12-08 15:26:53 -05:00
Terry Mancey ef8f8da9c7 Implement custom Brave Ad notifications 2020-11-21 21:26:36 +00:00
Mario Sanchez Prada 033fdeec00 Drop support for nonGeneratedFiles from brave_rollup_overrides.js
This made sense when Chromium's //c/b/resources/tools/rollup_plugin.js
considered that source JS files could come from both the sources and
the generated directories, but this is no longer the case as all those
JS files are under <root_gen_dir>/ui/webui/resources/webui_preprocessed
now, so we need to update Brave's code to adapt to this new scenario.

Chromium change:

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

commit efc282784459e1ec69a524d901d8694cce5230c5
Author: rbpotter <rbpotter@chromium.org>
Date:   Tue Sep 1 04:37:15 2020 +0000

    Web UI: Add preprocessed resources and use in rollup

    Preprocess all shared JS module resources into:
    <root_gen_dir>/ui/webui/resources/webui_preprocessed

    and read all these resources from this directory when bundling with
    rollup.

    Bug: 1071641
2020-10-28 13:59:42 -04:00
yan 8d8b4f1323 Remove non-locale uses of innerHTML
and add npm script to check for Trusted Type violations. locale strings
will be fixed in a separate PR.

fix https://github.com/brave/brave-browser/issues/11686
2020-09-16 10:13:13 -07:00
Pranjal Jumde 4317137ced Fix 3650: Enable google sign in for extensions 2020-08-19 09:10:20 -07:00
mkarolin 3a2358a735 Fixes WebUI rollup for brave resources.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/315b3141c41dbdddb3d8b168cf7867b74df11904

commit 315b3141c41dbdddb3d8b168cf7867b74df11904
Author: Tommy Steimel <steimel@chromium.org>
Date:   Wed Jun 17 21:22:32 2020 +0000

    Make cr_elements available in chrome-untrusted:// frames

     - This CL makes updates polymer.py to always produce scheme-relative
    URLs when converting HTML imports that contain "chrome://" to JS
    imports.

    - This also changes optimize_webui.py and rollup_plugin.js to handle
    scheme-relative URLs.

    This allows chrome-untrusted:// frames using Polymer 3 to use
    cr_elements/ without hitting failures due to absolute
    chrome://resources URLs inside cr_elements/ imports.

    Bug: 1051835, 866236
2020-08-06 17:32:04 -04:00
Pete Miller e90fa9feb2 NTP WebUI: take global fonts and css out of JS bundle
Already served from chrome://brave-resource/... which will benefit from async parsing and cross-page caching
2020-07-07 15:41:59 -07:00
Pete Miller f375718c68 History WebUI: adjust selector to match chromium change for overidden button style 2020-07-01 18:12:05 -04:00
Pete Miller b5da570f70 WebUI: polymer_overrides ensures template modifications happen when modifications are registered after component definition
we cannot control the order in which modules are executed
2020-07-01 18:12:05 -04:00
Pete Miller bb2d1ff5cc WebUI: convert to polymer 3 and es modules
- Move everything to es-modules rather than html imports. There are a number of ways these can be generated: completely manual or automatic via `polymer_modulizer` or `js_modulizer`. Template html can then optionally be 'included' in to the JS file via `html_to_js`.
- With a single patch in to a module requested by all webui pages (web_ui_listener_behavior.js), brave's polymer_overriding.js can inject any neccessary global template modifications.
2020-07-01 18:12:05 -04:00
mkarolin 900e91b91b source_is_generated -> enable_input_discovery_for_gn_analyze.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/6ade5dc4cb183b0f58cf9c1795fdfc6cba5e14bf

commit 6ade5dc4cb183b0f58cf9c1795fdfc6cba5e14bf
Author: Andrew Grieve <agrieve@chromium.org>
Date:   Tue Mar 17 20:52:02 2020 +0000

    Rename source_is_generated -> enable_input_discovery_for_gn_analyze

    And update docs for the setting.

    Bug: 1054892
2020-05-26 09:52:28 -04:00
ryanml 1ace3ab56d Adding Opt-in WebUI for Crypto Wallets 2020-05-13 16:53:51 -04:00
ryanml b2c55c98e4 Adding MIT license for crypto-icons font 2020-04-22 20:01:09 -07:00
ryanml 5c2efc2fff Front end cleanup, price and ticker fixes 2020-04-09 00:41:13 -07:00
mkarolin 8813742653 Settings UI: use relative path for autoimport of CrSearchFieldBehavior.
chrome://resources/cr_elements/ is now redirected so a relative path
needs to be used to get import from {} statement generated.

Chromium change:

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

commit 8afa59b8f3d39ca65c111e49b19475516f01c7a2
Author: Demetrios Papadopoulos <dpapad@chromium.org>
Date:   Thu Jan 23 22:39:02 2020 +0000

    WebUI: Port cr_components/certificate_manager to Polymer3.

     - Add polymer_modulizer() and js_modulizer() rules as necessary to
       generate a Polymer3 version of certificate-manager at build time.
     - Remove unnecessary settings.Router references from tests.
     - Auto-generate tests for the Polymer3 version (and update Settings
       WebUI data source as needed)
     - Add a missing assertion in js_modulizer.py that was discovered.

    The Polymer3 version will be used by follow up CLs to migrate
    chrome://certificate-manager and eventually chrome://settings

    Bug: 1042558
2020-03-19 16:51:45 -04:00
mkarolin 2577713c11 Polymer 3 fixes for history page. 2020-03-19 16:51:41 -04:00
mkarolin a34451d1f3 Moved br_toolbar's link stylesheet entries.
Moved them inside dom-module template. Otherwise they show up verbatum
in the generated JS.
2020-03-19 16:51:41 -04:00
bridiver 7765b694eb move braveResolveId out of rollup_plugins.js 2020-01-29 07:44:00 -05:00
mkarolin 0b687e858b Split shared_style_css from shared_vars_css.
They need different processing for polymer 3.
2020-01-29 07:43:57 -05:00
mkarolin 663f2fd034 Hookup Brave polymer v3 resources to the build.
Adds v3 GRDP with .m.js files.
Adds resources build dependency on modulize target.
Adds data source prefix alias to strip generated path.
2020-01-29 07:43:56 -05:00
Brian Clifton 503af8c6bc Update rollup plugin to resolve brave-resources
- Rollup plugin is used for polymer v3
- Needed to add `polymer_modulizer` calls in BUILD.gn for modules referenced
- Added dep to the main 3 places which need this done (bookmarks/downloads/history)
- Solved missing CrSearchFieldBehavior reference

Chromium change:

https://chromium.googlesource.com/chromium/src/+/5d96fd383c53023c8972b2af9e607a31e62e8112

commit 5d96fd383c53023c8972b2af9e607a31e62e8112
Author: rbpotter <rbpotter@chromium.org>
Date:   Fri Oct 25 01:56:27 2019 +0000

    WebUI: Update optimize_webui() to handle Polymer3

    Use rollup along with existing Polymer CSS build and Uglify tools
    to bundle Polymer 3 pages in optimized builds.

    This will be used by the extensions Web UI in a followup CL:
    https://chromium-review.googlesource.com/c/chromium/src/+/1817293

    Bug: 965770
2020-01-29 07:43:56 -05:00
mkarolin 222bb0e128 Added missing compress=gzip to webui resource. 2019-11-27 15:57:49 -05:00
Francois Marier e05221513b Move webui fonts to a third_party subdirectory (fixes brave/brave-browser#6881)
By moving third-party fonts to the standard directory pattern for
third-party code in Chromium, we don't have to teach the license
script about our extra path.
2019-11-18 14:29:32 -08:00
Francois Marier ece67f926c Reuse common licenses in copyright statements (fixes brave/brave-browser#6856) 2019-11-15 11:51:02 -08:00
Francois Marier 39979bc6f1 Add font licenses 2019-11-07 16:51:36 -08:00
Pete Miller def9186b65 WebUI: Update button styles for chromium webui 2019-10-14 16:20:41 -07:00
Pete Miller 30fe7bcf4e WebUI: Restrict button style override to buttons without style tag 2019-09-30 21:57:04 -07:00
Max Karolinskiy 2c15bd0923 Transition CSS from [dark] to @media.
* Use `@media (prefers-color-scheme: dark)` instead of `[dark]`.
* Turn on kWebUIDarkMode feature on all platforms - this feature now
  gates the above @media directive.

Chromium change:

https://chromium.googlesource.com/chromium/src/+/6e5a6179e616f62bb575b1cd5e1c078fd4a0bc47

commit 6e5a6179e616f62bb575b1cd5e1c078fd4a0bc47
Author: Dan Beam <dbeam@chromium.org>
Date:   Fri Jun 7 21:44:46 2019 +0000

    WebUI Dark Mode: update ui/webui to use @media queries

    This changes the implementation around how dark mode is queried in CSS.

    Bug: 965811

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

commit f0a7e117061208634ebf1cff20c4253db53f1b7a
Author: Dan Beam <dbeam@chromium.org>
Date:   Fri Jun 7 18:40:58 2019 +0000

    Make @media (prefers-color-scheme:) respect features::kWebUIDarkMode
    while on chrome:// URLs

    This allows us to use this mechanism in CSS:

      @media (prefers-color-scheme: dark) {
      }

    to vary styles for Chrome web UI in dark mode while also disabling via
    feature on certain platforms.

    This unblocks us from migrating to the @media query (from the existing
    [dark] attribute syntax) and later removing a bit of JS/C++ custom code
    in favor of simply using the web platform.

    R=futhark@chromium.org
    BUG=965811

https://bugs.chromium.org/p/chromium/issues/detail?id=965811
2019-09-05 21:22:20 -04:00
Max Karolinskiy 15f8069571 paper-button has been replaced with cr-button.
* Replaced all occurrances of paper-button with cr-button.
* Removed paper_button_style.css.
* Added cr-button template style overrides to polymer_overriding.
* Patched polymer.html to include polymer_overriding and removed
polymer_overriding from brave_settings_overrides.

Chromium change:

Removal of paper-button:
https://chromium.googlesource.com/chromium/src/+/03d1652fb3cecd58f02ce783da958901cc2c31db

commit 03d1652fb3cecd58f02ce783da958901cc2c31db
Author: Esmael El-Moslimany <aee@chromium.org>
Date:   Wed Jul 10 21:58:43 2019 +0000

    WebUI: remove paper-button from third_party/polymer

    Bug: 967793

Bug link with other commits:
https://bugs.chromium.org/p/chromium/issues/detail?id=967793
2019-09-05 21:22:19 -04:00
Pete Miller c6ec88a0dd WebUI: Turn off search feature via html "hidden" attribute instead of polymer dom-if template
Fix https://github.com/brave/brave-browser/issues/5330

This fixes the issue with the downloads page due to a timing issue with the download item list rendering. That list uses iron-list via downloads/manager.html. The list will not render if the list component's element does not have either a width or a height (via flex, explicit css, or otherwise). In the course of the page load, there is specific timing where the page has width *just* before the items that are provided to the iron-list are rendered. This timing could definitely be improved upstream.

The download page asks the toolbar whether the search field is clear or not (so that the download page knew to render the entire list of downloads, or one filtered to the search term).

Somehow having an extra polymer template to ensure had rendered before our toolbar would return the correct value for this caused this timing to be off, and so when the iron-list was first rendered it did not do anything because there was no width or height to the element. At any time later, forcing the iron-list to re-evaluate it's rendering ability by resizing the window (since it subscribes directly to this event), or running `downloadsList.fire('iron-resize')` directly, would caus the list to render successfully.

Interestingly, there is an attempt in the upstream code to force firing of this event to prevent this issue, but it actually happens too early, or rather it does not listen to all the properties that could cause this issue: https://cs.chromium.org/chromium/src/chrome/browser/resources/downloads/manager.js?rcl=044ab765751f0d98b0758a6de98265797ee67793&l=122
2019-08-19 19:51:12 -07:00
ryanml c6ebf2fbd7 Merge pull request #2991 from brave/fix-5337
Fixes search icon overlap with Crypto Wallets menu item
2019-08-14 14:19:13 -07:00
ryanml a2c995b963 Fixes brave/brave-browser#5666, crypto wallets link present in builds 2019-08-14 13:51:26 -07:00
ryanml fa2f6b616a Fixes brave/brave-browser#5383 - removes wallet menu item in official builds 2019-07-24 21:02:52 -07:00
ryanml 04d9e13206 Fixes brave/brave-browser#5337, removes search icon overlap with wallet link 2019-07-23 18:23:19 -07:00