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

Add strings for NavigationBar on relevant WebUI data sources directly #2384

Merged
merged 1 commit into from
May 13, 2019

Conversation

petemill
Copy link
Member

@petemill petemill commented May 8, 2019

This fixes an intermittent build error due to the generated_resources being included in web_ui_util (inside the //ui/base project)

This fixes a layer-violation for dependencies where we were using a convenience function in the base //ui project in order to set the strings on all WebUI data sources. With this refactor, the dependencies are already in place from the chromium ui project (containing the webui data sources) to the brave webui project (containing the new navigation bar data provider).

This new NavigationBarDataProvider is not much of a class, in that it only contains a single static function, but it follows the chromium practice of splitting data in to functional classes, and leaving it up to the provider as to whether it adds strings, functions or observers to the WebUI.

Fix brave/brave-browser#4343

Submitter Checklist:

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

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.

@petemill petemill self-assigned this May 8, 2019
simonhong
simonhong previously approved these changes May 8, 2019
Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

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

LGTM.
How about opening an issue for removing this dependency from //ui?

@simonhong
Copy link
Member

Dependency error is happened.

12:50:32  ERROR at //build/config/BUILDCONFIG.gn:563:5: assert_no_deps failed.
12:50:32      target(_target_type, target_name) {
12:50:32      ^----------------------------------
12:50:32  //components:components_unittests has an assert_no_deps entry:
12:50:32    //chrome/*
12:50:32  which fails for the dependency path:
12:50:32    //components:components_unittests ->
12:50:32    //components/autofill/core/browser:unit_tests ->
12:50:32    //components/autofill/core/browser:browser ->
12:50:32    //components/autofill/core/common:common ->
12:50:32    //ui/base:base ->
12:50:32    //brave/ui/base:chromium_deps ->
12:50:32    //chrome/app:generated_resources

@simonhong simonhong dismissed their stale review May 8, 2019 04:23

gn error was found.

@bsclifton
Copy link
Member

got the same error as above

@bsclifton
Copy link
Member

Created brave/brave-browser#4343 to track the problem

@petemill petemill force-pushed the fix-ui-generated-resources-dep branch from 154f678 to 90fcbcd Compare May 9, 2019 04:29
@petemill petemill changed the title //ui/base depends on //chrome/app:generated_resources Add strings for NavigationBar on relevant WebUI data sources directly May 9, 2019
@petemill
Copy link
Member Author

petemill commented May 9, 2019

Updated with a completely different approach. Running tests now

This fixes a layer-violation for dependencies where we were using a convenience function in the base //ui project in order to set the strings on all WebUI data sources. With this refactor, the dependencies are already in place from the chromium ui project (containing the webui data sources) to the brave webui project (containing the new navigation bar data provider).

This new NavigationBarDataProvider is not much of a class, in that it only contains a single static function, but it follows the chromium practice of splitting data in to functional classes, and leaving it up to the provider as to whether it adds strings, functions or observers to the WebUI.
@petemill petemill force-pushed the fix-ui-generated-resources-dep branch from 90fcbcd to f37ff3f Compare May 9, 2019 04:49
Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

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

LGTM with nits 👍

void SetLoadTimeDataDefaults(const std::string& app_locale,
base::DictionaryValue* localized_strings) {

SetLoadTimeDataDefaults_ChromiumImpl(app_locale, localized_strings);
#if !defined(OS_ANDROID)
Copy link
Member

Choose a reason for hiding this comment

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

This define pair can be removed


} // namespace

#include "../../../../../chrome/browser/ui/webui/history_ui.cc"
Copy link
Member

Choose a reason for hiding this comment

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

lint?


} // namespace

#include "../../../../../../chrome/browser/ui/webui/downloads/downloads_ui.cc" // NOLINT
Copy link
Member

Choose a reason for hiding this comment

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

lint fail by no last empty line?

"brToolbarDownloadsTitle", IDS_DOWNLOAD_TITLE);
source->AddLocalizedString(
"brToolbarHistoryTitle", IDS_HISTORY_TITLE);
}
Copy link
Member

Choose a reason for hiding this comment

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

lint?


} // namespace

#include "../../../../../../chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc"
Copy link
Member

Choose a reason for hiding this comment

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

lint

@bsclifton bsclifton merged commit aa79619 into master May 13, 2019
@bsclifton bsclifton deleted the fix-ui-generated-resources-dep branch May 13, 2019 18:52
bsclifton added a commit that referenced this pull request May 13, 2019
bsclifton added a commit that referenced this pull request May 13, 2019
Add strings for NavigationBar on relevant WebUI data sources directly

---

Uplift of #2384

Fixes brave/brave-browser#4343
bsclifton added a commit that referenced this pull request May 13, 2019
Add strings for NavigationBar on relevant WebUI data sources directly

---

Uplift of #2384

Fixes brave/brave-browser#4343
bsclifton added a commit that referenced this pull request May 14, 2019
Add strings for NavigationBar on relevant WebUI data sources directly

---

Uplift of #2384

Fixes brave/brave-browser#4343
bsclifton added a commit that referenced this pull request May 14, 2019
Add strings for NavigationBar on relevant WebUI data sources directly

---

Uplift of #2384

Fixes brave/brave-browser#4343
bsclifton added a commit that referenced this pull request May 15, 2019
Merge pull request #2384 from brave/fix-ui-generated-resources-dep
bsclifton added a commit that referenced this pull request May 15, 2019
Merge pull request #2384 from brave/fix-ui-generated-resources-dep
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.

Error while building 0.65.x
3 participants