Skip to content

Commit 2db603c

Browse files
Xiaohui ChenChromium LUCI CQ
Xiaohui Chen
authored and
Chromium LUCI CQ
committed
Reland "os settings: move constants mojom to ash dir"
This is a reland of commit 18d33ea The original CL failed on lacros build with link time symbol issue. It seems although `:mojom` is in the `public_deps` of `:constants` target, the linker still could not resolve the symbols, need to explicitly list `:mojom` as a dependency instead. Original change's description: > os settings: move constants mojom to ash dir > > AX-Relnotes: n/a > Bug: b/284187997 > Change-Id: Ibe60e20bc72ea4cc09b0cf5a64a6f4e6dfdf32ca > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4743786 > Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> > Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org> > Reviewed-by: Wes Okuhara <wesokuhara@google.com> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: James Cook <jamescook@chromium.org> > Owners-Override: Katie Dektar <katie@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1179924} Bug: b/284187997 Change-Id: Id2fe1759d019d7a45d316dff5c82c26971faa372 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4752724 Reviewed-by: James Cook <jamescook@chromium.org> Owners-Override: Navin Ramsaroop <ramsaroop@google.com> Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Reviewed-by: Wes Okuhara <wesokuhara@google.com> Reviewed-by: Tom Sepez <tsepez@chromium.org> Cr-Commit-Position: refs/heads/main@{#1182841}
1 parent f51d3d8 commit 2db603c

File tree

110 files changed

+211
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+211
-179
lines changed

ash/assistant/util/deep_link_util.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,8 @@ GURL GetChromeSettingsUrl(const absl::optional<std::string>& page) {
430430
// Browser Settings at some point in the future at which point we will define
431431
// an analogous collection of |kAllowedBrowserPages|.
432432
// These values are copied from
433-
// chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.
434-
// We can not reuse the generated defines as we can not depend on //chrome.
435-
// TODO(b/168138594): use generated defines once that header has been moved to
436-
// chromeos.
433+
// ash/webui/settings/public/constants/routes.mojom.
434+
// TODO(b/168138594): use generated defines, now it's ready to use.
437435
static const std::map<std::string, std::string> kAllowedOsPages = {
438436
{/*page=*/"googleAssistant", /*os_page=*/"googleAssistant"},
439437
{/*page=*/"languages", /*os_page=*/"osLanguages/languages"}};

ash/webui/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ test("ash_webui_unittests") {
3535
"//ash/webui/projector_app:unit_tests",
3636
"//ash/webui/scanning:unit_tests",
3737
"//ash/webui/scanning/mojom:unit_tests",
38+
"//ash/webui/settings/public/constants:unit_tests",
3839
"//ash/webui/shimless_rma/backend:unit_tests",
3940
"//ash/webui/shimless_rma/mojom:unit_tests",
4041
"//ash/webui/shortcut_customization_ui:unit_tests",
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2020 The Chromium Authors
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("//build/config/chromeos/ui_mode.gni")
6+
import("//mojo/public/tools/bindings/mojom.gni")
7+
8+
assert(is_chromeos)
9+
10+
# TODO(http://b/284187997): add assert(is_chromeos_ash) when all browser
11+
# dependencies are cleaned up. Also rename the namespace to `ash::settings`.
12+
13+
mojom("mojom") {
14+
sources = [
15+
"routes.mojom",
16+
"setting.mojom",
17+
]
18+
webui_module_path = "/"
19+
use_typescript_sources = true
20+
}
21+
22+
action("gen_routes") {
23+
script = "gen_routes.py"
24+
outputs = [ "$target_gen_dir/routes.h" ]
25+
deps = [ ":mojom" ]
26+
args = [
27+
"--gen_dir",
28+
rebase_path(target_gen_dir, root_build_dir),
29+
]
30+
}
31+
32+
component("constants") {
33+
output_name = "ash_webui_settings_public_constants"
34+
35+
defines = [ "IS_ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_IMPL" ]
36+
37+
sources = [
38+
"routes_util.cc",
39+
"routes_util.h",
40+
]
41+
42+
public_deps = [ ":mojom" ]
43+
44+
deps = [
45+
":gen_routes",
46+
"//base",
47+
]
48+
}
49+
50+
source_set("unit_tests") {
51+
testonly = true
52+
53+
sources = [ "routes_util_unittest.cc" ]
54+
55+
deps = [
56+
":constants",
57+
"//base",
58+
"//content/test:test_support",
59+
"//testing/gtest",
60+
]
61+
}

chrome/browser/ui/webui/settings/chromeos/constants/gen_routes.py ash/webui/settings/public/constants/gen_routes.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import sys
1818

1919
# Path of the <chromium>/src directory.
20-
CHROMIUM_SRC_PATH = pathlib.Path(__file__).parents[7].resolve(strict=True)
20+
CHROMIUM_SRC_PATH = pathlib.Path(__file__).parents[5].resolve(strict=True)
2121
if CHROMIUM_SRC_PATH.name != 'src':
2222
raise AssertionError(
2323
f'CHROMIUM_SRC_PATH "{CHROMIUM_SRC_PATH}" should end in "src".')
@@ -51,10 +51,10 @@ def main(args):
5151
// Use of this source code is governed by a BSD-style license that can be
5252
// found in the LICENSE file.
5353
54-
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CONSTANTS_ROUTES_H_
55-
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CONSTANTS_ROUTES_H_
54+
#ifndef ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_ROUTES_H_
55+
#define ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_ROUTES_H_
5656
57-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
57+
#include "ash/webui/settings/public/constants/routes.mojom.h"
5858
5959
namespace chromeos::settings {{
6060
@@ -67,7 +67,7 @@ def main(args):
6767
6868
} // namespace chromeos::settings
6969
70-
#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CONSTANTS_ROUTES_H_
70+
#endif // ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_ROUTES_H_
7171
'''
7272
output_path = os.path.join(parsed_args.gen_dir, 'routes.h')
7373
with open(output_path, 'w') as f:

chrome/browser/ui/webui/settings/chromeos/constants/routes_util.cc ash/webui/settings/public/constants/routes_util.cc

+6-9
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CONSTANTS_ROUTES_UTIL_H_
6-
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CONSTANTS_ROUTES_UTIL_H_
7-
8-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes_util.h"
5+
#include "ash/webui/settings/public/constants/routes_util.h"
96

107
#include <string>
118

12-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.h"
9+
#include "ash/webui/settings/public/constants/routes.h"
1310

1411
namespace chromeos::settings {
1512

1613
namespace {
1714

1815
std::string RemoveQuery(std::string path) {
1916
std::string::size_type input_index = path.find('?');
20-
if (input_index != std::string::npos)
17+
if (input_index != std::string::npos) {
2118
path.resize(input_index);
19+
}
2220
return path;
2321
}
2422

@@ -30,13 +28,12 @@ bool IsOSSettingsSubPage(const std::string& sub_page) {
3028

3129
for (const char* p : kPaths) {
3230
std::string path_without_query = RemoveQuery(p);
33-
if (sub_page_without_query == path_without_query)
31+
if (sub_page_without_query == path_without_query) {
3432
return true;
33+
}
3534
}
3635

3736
return false;
3837
}
3938

4039
} // namespace chromeos::settings
41-
42-
#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CONSTANTS_ROUTES_UTIL_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2020 The Chromium Authors
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_ROUTES_UTIL_H_
6+
#define ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_ROUTES_UTIL_H_
7+
8+
#include <string>
9+
10+
#include "base/component_export.h"
11+
12+
namespace chromeos::settings {
13+
14+
// Returns true if the sub-page is one defined in `routes.mojom`.
15+
COMPONENT_EXPORT(ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS)
16+
bool IsOSSettingsSubPage(const std::string& sub_page);
17+
18+
} // namespace chromeos::settings
19+
20+
#endif // ASH_WEBUI_SETTINGS_PUBLIC_CONSTANTS_ROUTES_UTIL_H_

chrome/browser/ui/webui/settings/chromeos/constants/routes_util_unittest.cc ash/webui/settings/public/constants/routes_util_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2022 The Chromium Authors
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes_util.h"
4+
#include "ash/webui/settings/public/constants/routes_util.h"
55

66
#include "testing/gtest/include/gtest/gtest.h"
77

chrome/browser/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -5704,12 +5704,12 @@ static_library("browser") {
57045704
]
57055705
deps += [
57065706
"//ash/webui/projector_app/public/cpp",
5707+
"//ash/webui/settings/public/constants",
57075708
"//chrome/browser/chromeos",
57085709
"//chrome/browser/chromeos/drivefs",
57095710
"//chrome/browser/chromeos/extensions/telemetry",
57105711
"//chrome/browser/policy:onc",
57115712
"//chrome/browser/ui/quick_answers",
5712-
"//chrome/browser/ui/webui/settings/chromeos/constants:mojom",
57135713
"//chrome/browser/webshare:storage",
57145714
"//chrome/common/chromeos/extensions",
57155715
"//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_browser",

chrome/browser/accessibility/accessibility_extension_api_chromeos.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "ash/public/cpp/accessibility_focus_ring_info.h"
1515
#include "ash/public/cpp/event_rewriter_controller.h"
1616
#include "ash/public/cpp/window_tree_host_lookup.h"
17+
#include "ash/webui/settings/public/constants/routes_util.h"
1718
#include "base/containers/contains.h"
1819
#include "base/functional/bind.h"
1920
#include "base/json/json_writer.h"
@@ -30,7 +31,6 @@
3031
#include "chrome/browser/extensions/extension_tab_util.h"
3132
#include "chrome/browser/profiles/profile.h"
3233
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
33-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes_util.h"
3434
#include "chrome/common/extensions/api/accessibility_private.h"
3535
#include "chrome/common/extensions/extension_constants.h"
3636
#include "chrome/common/webui_url_constants.h"

chrome/browser/apps/guest_view/web_view_browsertest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@
140140
#include "url/url_constants.h"
141141

142142
#if BUILDFLAG(IS_CHROMEOS_ASH)
143+
#include "ash/webui/settings/public/constants/routes.mojom.h" // nogncheck
143144
#include "chrome/browser/ash/system_web_apps/system_web_app_manager.h"
144-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h" // nogncheck
145145
#endif
146146

147147
#if defined(USE_AURA)

chrome/browser/ash/BUILD.gn

+3-3
Original file line numberDiff line numberDiff line change
@@ -3469,6 +3469,7 @@ source_set("ash") {
34693469
"//ash/webui/projector_app",
34703470
"//ash/webui/scanning",
34713471
"//ash/webui/scanning/mojom",
3472+
"//ash/webui/settings/public/constants",
34723473
"//ash/webui/shimless_rma",
34733474
"//ash/webui/shimless_rma/backend",
34743475
"//ash/webui/shortcut_customization_ui",
@@ -3862,6 +3863,7 @@ source_set("ash") {
38623863
"//ash/webui/resources:scanning_app_resources",
38633864
"//ash/webui/resources:shimless_rma_resources",
38643865
"//ash/webui/resources:shortcut_customization_app_resources",
3866+
"//ash/webui/settings/public/constants:mojom",
38653867
"//ash/webui/system_apps/public:system_web_app_config",
38663868
"//ash/webui/system_apps/public:system_web_app_type",
38673869
"//build:branding_buildflags",
@@ -3907,7 +3909,6 @@ source_set("ash") {
39073909
"//chrome/browser/ui/ash/system_web_apps",
39083910
"//chrome/browser/ui/webui/ash/cloud_upload:mojo_bindings_shared",
39093911
"//chrome/browser/ui/webui/ash/crostini_upgrader:mojo_bindings",
3910-
"//chrome/browser/ui/webui/settings/chromeos/constants:mojom",
39113912
"//chrome/browser/webshare:storage",
39123913
"//chrome/common:channel_info",
39133914
"//chrome/common:non_code_constants",
@@ -4878,7 +4879,6 @@ source_set("unit_tests") {
48784879
"../ui/webui/settings/ash/search_engines_handler_unittest.cc",
48794880
"../ui/webui/settings/ash/send_search_feedback_handler_unittest.cc",
48804881
"../ui/webui/settings/ash/settings_user_action_tracker_unittest.cc",
4881-
"../ui/webui/settings/chromeos/constants/routes_util_unittest.cc",
48824882
"accessibility/pumpkin_installer_unittest.cc",
48834883
"account_manager/account_apps_availability_unittest.cc",
48844884
"account_manager/account_manager_edu_coexistence_controller_unittest.cc",
@@ -5901,6 +5901,7 @@ source_set("unit_tests") {
59015901
"//ash/webui/personalization_app/mojom",
59025902
"//ash/webui/scanning",
59035903
"//ash/webui/scanning/mojom",
5904+
"//ash/webui/settings/public/constants:mojom",
59045905
"//base",
59055906
"//base:i18n",
59065907
"//base/test:test_config",
@@ -5955,7 +5956,6 @@ source_set("unit_tests") {
59555956
"//chrome/browser/ui/webui/settings/ash/input_device_settings:mojom",
59565957
"//chrome/browser/ui/webui/settings/ash/os_apps_page/mojom",
59575958
"//chrome/browser/ui/webui/settings/ash/search/mojom",
5958-
"//chrome/browser/ui/webui/settings/chromeos/constants:mojom",
59595959
"//chrome/browser/web_applications",
59605960
"//chrome/browser/web_applications:web_applications_test_support",
59615961
"//chrome/browser/web_applications/mojom:mojom_web_apps_enum",

chrome/browser/ash/account_manager/account_manager_ui_impl.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
// found in the LICENSE file.
44

55
#include "chrome/browser/ash/account_manager/account_manager_ui_impl.h"
6+
7+
#include "ash/webui/settings/public/constants/routes.mojom.h"
68
#include "chrome/browser/profiles/profile.h"
79
#include "chrome/browser/profiles/profile_manager.h"
810
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
9-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
1011
#include "chrome/browser/ui/webui/signin/ash/inline_login_dialog.h"
1112
#include "components/account_manager_core/account_addition_options.h"
1213

chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "ash/public/cpp/test/shell_test_api.h"
1515
#include "ash/public/cpp/window_properties.h"
1616
#include "ash/shell.h"
17+
#include "ash/webui/settings/public/constants/routes.mojom.h"
1718
#include "base/command_line.h"
1819
#include "base/feature_list.h"
1920
#include "base/memory/raw_ptr.h"
@@ -59,7 +60,6 @@
5960
#include "chrome/browser/ui/browser_window.h"
6061
#include "chrome/browser/ui/chrome_pages.h"
6162
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
62-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
6363
#include "chrome/browser/web_applications/web_app_provider.h"
6464
#include "chrome/common/chrome_paths.h"
6565
#include "chrome/common/chrome_switches.h"

chrome/browser/ash/app_list/search/system_info/system_info_card_provider.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <string>
1111

1212
#include "ash/strings/grit/ash_strings.h"
13+
#include "ash/webui/settings/public/constants/routes.mojom-forward.h"
1314
#include "base/functional/bind.h"
1415
#include "base/strings/utf_string_conversions.h"
1516
#include "chrome/browser/apps/app_service/app_service_proxy.h"
@@ -24,7 +25,6 @@
2425
#include "chrome/browser/ash/app_list/vector_icons/vector_icons.h"
2526
#include "chrome/browser/ui/webui/settings/ash/calculator/size_calculator.h"
2627
#include "chrome/browser/ui/webui/settings/ash/device_storage_util.h"
27-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom-forward.h"
2828
#include "chrome/common/channel_info.h"
2929
#include "chrome/grit/generated_resources.h"
3030
#include "chromeos/ash/components/string_matching/fuzzy_tokenized_string_match.h"

chrome/browser/ash/app_restore/full_restore_service.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "ash/constants/ash_switches.h"
88
#include "ash/constants/notifier_catalogs.h"
99
#include "ash/public/cpp/notification_utils.h"
10+
#include "ash/webui/settings/public/constants/routes.mojom.h"
1011
#include "ash/wm/desks/templates/saved_desk_controller.h"
1112
#include "base/command_line.h"
1213
#include "base/metrics/histogram_functions.h"
@@ -26,7 +27,6 @@
2627
#include "chrome/browser/notifications/notification_display_service.h"
2728
#include "chrome/browser/profiles/profile.h"
2829
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
29-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
3030
#include "chrome/browser/web_applications/web_app_utils.h"
3131
#include "chrome/grit/chromium_strings.h"
3232
#include "chrome/grit/generated_resources.h"

chrome/browser/ash/arc/auth/arc_auth_service.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "ash/components/arc/session/arc_management_transition.h"
1717
#include "ash/components/arc/session/arc_service_manager.h"
1818
#include "ash/constants/ash_switches.h"
19+
#include "ash/webui/settings/public/constants/routes.mojom.h"
1920
#include "base/command_line.h"
2021
#include "base/containers/flat_set.h"
2122
#include "base/functional/bind.h"
@@ -40,7 +41,6 @@
4041
#include "chrome/browser/signin/identity_manager_factory.h"
4142
#include "chrome/browser/signin/signin_ui_util.h"
4243
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
43-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
4444
#include "chrome/browser/ui/webui/signin/ash/inline_login_dialog.h"
4545
#include "chrome/common/webui_url_constants.h"
4646
#include "components/account_manager_core/account_manager_facade.h"

chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "ash/components/arc/arc_features.h"
1212
#include "ash/components/arc/arc_util.h"
1313
#include "ash/public/cpp/app_types_util.h"
14+
#include "ash/webui/settings/public/constants/routes.mojom.h"
1415
#include "base/feature_list.h"
1516
#include "base/files/file_util.h"
1617
#include "base/functional/bind.h"
@@ -40,7 +41,6 @@
4041
#include "chrome/browser/sharesheet/sharesheet_service_factory.h"
4142
#include "chrome/browser/sharesheet/sharesheet_types.h"
4243
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
43-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
4444
#include "chrome/browser/webshare/prepare_directory_task.h"
4545
#include "chrome/common/chrome_paths_internal.h"
4646
#include "components/services/app_service/public/cpp/intent.h"

chrome/browser/ash/arc/notification/arc_boot_error_notification.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "ash/components/arc/arc_browser_context_keyed_service_factory_base.h"
1111
#include "ash/public/cpp/notification_utils.h"
12+
#include "ash/webui/settings/public/constants/routes.mojom.h"
1213
#include "base/functional/bind.h"
1314
#include "base/memory/scoped_refptr.h"
1415
#include "base/strings/utf_string_conversions.h"
@@ -21,7 +22,6 @@
2122
#include "chrome/browser/notifications/notification_display_service_factory.h"
2223
#include "chrome/browser/profiles/profile.h"
2324
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
24-
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
2525
#include "chrome/common/webui_url_constants.h"
2626
#include "chrome/grit/generated_resources.h"
2727
#include "components/user_manager/user_manager.h"

0 commit comments

Comments
 (0)