Skip to content

Commit

Permalink
Set up serving infrastructure for c/b/r/settings.
Browse files Browse the repository at this point in the history
BUG=

Review URL: https://codereview.chromium.org/985533002

Cr-Commit-Position: refs/heads/master@{#319512}
  • Loading branch information
jlklein authored and Commit bot committed Mar 6, 2015
1 parent a90a4a2 commit 794e982
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 8 deletions.
3 changes: 3 additions & 0 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ group("extra_resources") {
deps += [
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:options_resources",
"//chrome/browser/resources:settings_resources",
]
}

Expand Down Expand Up @@ -466,13 +467,15 @@ repack("packed_extra_resources") {
"$root_gen_dir/chrome/component_extension_resources.pak",
"$root_gen_dir/chrome/options_resources.pak",
"$root_gen_dir/chrome/quota_internals_resources.pak",
"$root_gen_dir/chrome/settings_resources.pak",
"$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
"$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
]
deps += [
"//chrome/browser/devtools:webrtc_device_provider_resources",
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:options_resources",
"//chrome/browser/resources:settings_resources",
"//chrome/browser/resources:quota_internals_resources",
"//chrome/browser/resources:sync_file_system_internals_resources",
"//content/browser/devtools:devtools_resources",
Expand Down
11 changes: 11 additions & 0 deletions chrome/browser/resources/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ if (!is_ios) {
output_dir = "$root_gen_dir/chrome"
}

grit("settings_resources") {
source = "settings/settings_resources.grd"
outputs = [
"grit/settings_resources.h",
"grit/settings_resources_map.cc",
"grit/settings_resources_map.h",
"settings_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}

grit("options_resources") {
source = "options_resources.grd"
outputs = [
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/resources/settings/a11y_page/a11y_page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
* @fileoverview
Expand Down
5 changes: 1 addition & 4 deletions chrome/browser/resources/settings/a11y_page/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
<head>
<link href="a11y_page.html" rel="import">
<link href="../prefs/prefs.html" rel="import">
<script src="demo.js"></script>
</head>
<body unresolved>
<cr-settings-prefs></cr-settings-prefs>
<cr-settings-a11y-page></cr-settings-a11y-page>
<script>
var page = document.querySelector('cr-settings-a11y-page');
page.prefs = document.querySelector('cr-settings-prefs');
</script>
</body>
</html>
11 changes: 11 additions & 0 deletions chrome/browser/resources/settings/a11y_page/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
* Wire up the prefs to the a11y page.
*/
window.onload = function() {
var page = document.querySelector('cr-settings-a11y-page');
page.prefs = document.querySelector('cr-settings-prefs');
};
32 changes: 32 additions & 0 deletions chrome/browser/resources/settings/settings_resources.grd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/settings_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/settings_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/settings_resources_map.h"
type="resource_map_header" />
<output filename="settings_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<structures>
<structure name="IDR_SETTINGS_A11Y_PAGE_JS"
file="a11y_page/a11y_page.js"
type="chrome_html" />
<structure name="IDR_SETTINGS_A11Y_PAGE_HTML"
file="a11y_page/a11y_page.html"
type="chrome_html" />
<structure name="IDR_SETTINGS_A11Y_PAGE_CSS"
file="a11y_page/a11y_page.css"
type="chrome_html" />
<structure name="IDR_SETTINGS_PREFS_JS"
file="prefs/prefs.js"
type="chrome_html" />
<structure name="IDR_SETTINGS_PREFS_HTML"
file="prefs/prefs.html"
type="chrome_html" />
</structures>
</release>
</grit>
8 changes: 8 additions & 0 deletions chrome/browser/ui/webui/md_settings_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
#include "grit/settings_resources.h"
#include "grit/settings_resources_map.h"

MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIMdSettingsHost);

// Add all settings resources.
for (size_t i = 0; i < kSettingsResourcesSize; ++i) {
html_source->AddResourcePath(kSettingsResources[i].name,
kSettingsResources[i].value);
}

html_source->AddResourcePath("md_settings.css", IDR_MD_SETTINGS_UI_CSS);
html_source->SetDefaultResource(IDR_MD_SETTINGS_UI_HTML);

Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,7 @@
# These files are generated by GRIT.
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/grit/ui_resources_map.cc',
'<(grit_out_dir)/grit/component_extension_resources_map.cc',
'<(grit_out_dir)/grit/settings_resources_map.cc',
'<(grit_out_dir)/grit/theme_resources_map.cc',

# This file is generated by
Expand Down
3 changes: 2 additions & 1 deletion chrome/chrome_repack_resources.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
# New paks should be added here by default.
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/blink/devtools_resources.pak',
'<(grit_out_dir)/webrtc_device_provider_resources.pak',
'<(grit_out_dir)/component_extension_resources.pak',
'<(grit_out_dir)/options_resources.pak',
'<(grit_out_dir)/quota_internals_resources.pak',
'<(grit_out_dir)/settings_resources.pak',
'<(grit_out_dir)/sync_file_system_internals_resources.pak',
'<(grit_out_dir)/webrtc_device_provider_resources.pak',
],
}],
['enable_extensions==1', {
Expand Down
8 changes: 8 additions & 0 deletions chrome/chrome_resources.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@
},
'includes': [ '../build/grit_action.gypi' ],
},
{
# GN version: //chrome/browser/resources:settings_resources
'action_name': 'generate_settings_resources',
'variables': {
'grit_grd_file': 'browser/resources/settings/settings_resources.grd',
},
'includes': [ '../build/grit_action.gypi' ],
},
],
'copies': [
{
Expand Down
3 changes: 3 additions & 0 deletions tools/gritsettings/resource_ids
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@
"chrome/browser/devtools/device/webrtc/resources.grd": {
"includes": [30800],
},
"chrome/browser/resources/settings/settings_resources.grd": {
"structures": [30900],
},

# These files don't need to reserve resource ids, but are listed here so that
# translation scripts know of their existence.
Expand Down

0 comments on commit 794e982

Please sign in to comment.