summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoredwardjung <edwardjung@chromium.org>2016-01-15 06:18:35 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-15 14:19:48 +0000
commitb7dac1a6a7997c1c7bb440d5eb5a4aa6ee38cf8b (patch)
tree45d01a5f31121f2b7fb272441e2505829fb3f0d6
parent3d14d22a68702b3ec8118f1fe60a3bc2bd002f30 (diff)
downloadchromium_src-b7dac1a6a7997c1c7bb440d5eb5a4aa6ee38cf8b.zip
chromium_src-b7dac1a6a7997c1c7bb440d5eb5a4aa6ee38cf8b.tar.gz
chromium_src-b7dac1a6a7997c1c7bb440d5eb5a4aa6ee38cf8b.tar.bz2
Incognito NTP style tweaks
BUG=512984 Review URL: https://codereview.chromium.org/1516233003 Cr-Commit-Position: refs/heads/master@{#369736}
-rw-r--r--chrome/app/generated_resources.grd4
-rw-r--r--chrome/browser/resources/ntp4/incognito_and_guest_tab.css12
-rw-r--r--chrome/browser/resources/ntp4/incognito_tab.css6
-rw-r--r--chrome/browser/resources/ntp4/incognito_tab.html3
-rw-r--r--content/browser/webui/shared_resources_data_source.cc3
-rw-r--r--ui/base/webui/web_ui_util.cc15
-rw-r--r--ui/base/webui/web_ui_util.h8
-rw-r--r--ui/webui/resources/css/roboto.css8
-rw-r--r--ui/webui/resources/css/text_defaults_md.css31
-rw-r--r--ui/webui/resources/roboto/roboto-light.woff2bin0 -> 61372 bytes
-rw-r--r--ui/webui/resources/webui_resources.grd7
11 files changed, 87 insertions, 10 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index bebce6e..eb2a637 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -10433,8 +10433,8 @@ I don't think this site should be blocked!
Learn more
</message>
<message name="IDS_NEW_TAB_OTR_MESSAGE_WARNING"
- desc="OTR window warning message">
- Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.
+ desc="OTR window warning message. This follows the IDS_NEW_TAB_OTR_DESCRIPTION paragraph">
+ However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.
</message>
<message name="IDS_NEW_TAB_GUEST_SESSION_HEADING"
desc="Heading used when a person enters Guest Session">
diff --git a/chrome/browser/resources/ntp4/incognito_and_guest_tab.css b/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
index fb398dd..90e52d9 100644
--- a/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
+++ b/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
@@ -7,12 +7,12 @@
h1 {
font-size: 200%;
- font-weight: normal;
+ font-weight: 300;
margin-bottom: 1.33em;
}
p {
- line-height: 1.7;
+ line-height: 1.5;
margin-bottom: 2em;
text-align: start;
}
@@ -30,9 +30,10 @@ a:hover {
.content {
box-sizing: border-box;
margin: 3.5em auto 0;
+ max-width: 420px;
+ min-width: 240px;
padding: 30px 35px;
text-align: center;
- width: 420px;
}
html[hascustombackground='true'] .content {
@@ -54,6 +55,11 @@ html[hascustombackground='true'] .content {
body {
margin: 3em 1.5em 2em;
}
+
+ /* Adjustment for narrow screen to prevent horizontal scrollbar. */
+ .content {
+ padding: 16px 8px;
+ }
}
@media (max-height:480px) and (max-width:400px) {
diff --git a/chrome/browser/resources/ntp4/incognito_tab.css b/chrome/browser/resources/ntp4/incognito_tab.css
index 874b1f2..6994b2c 100644
--- a/chrome/browser/resources/ntp4/incognito_tab.css
+++ b/chrome/browser/resources/ntp4/incognito_tab.css
@@ -2,6 +2,10 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
+body {
+ margin-top: 0;
+}
+
.content {
background-color: #323232;
color: white;
@@ -20,4 +24,6 @@ h1 {
a {
color: rgb(3, 169, 244);
+ display: inline-block;
+ padding: 10.5px 12px;
}
diff --git a/chrome/browser/resources/ntp4/incognito_tab.html b/chrome/browser/resources/ntp4/incognito_tab.html
index f61294e..4b19819 100644
--- a/chrome/browser/resources/ntp4/incognito_tab.html
+++ b/chrome/browser/resources/ntp4/incognito_tab.html
@@ -6,7 +6,8 @@
<head>
<meta charset="utf-8">
<title i18n-content="title"></title>
-<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
+<meta name="viewport" content="width=device-width">
+<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="incognito_and_guest_tab.css">
<link rel="stylesheet" href="incognito_tab.css">
<script>
diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc
index 3c7c01b..8383fc2 100644
--- a/content/browser/webui/shared_resources_data_source.cc
+++ b/content/browser/webui/shared_resources_data_source.cc
@@ -92,6 +92,9 @@ void SharedResourcesDataSource::StartDataRequest(
if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS) {
std::string css = webui::GetWebUiCssTextDefaults();
bytes = base::RefCountedString::TakeString(&css);
+ } else if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS_MD) {
+ std::string css = webui::GetWebUiCssTextDefaultsMd();
+ bytes = base::RefCountedString::TakeString(&css);
} else {
bytes = GetContentClient()->GetDataResourceBytes(idr);
}
diff --git a/ui/base/webui/web_ui_util.cc b/ui/base/webui/web_ui_util.cc
index 7c894f6..d9c1d76 100644
--- a/ui/base/webui/web_ui_util.cc
+++ b/ui/base/webui/web_ui_util.cc
@@ -122,19 +122,30 @@ void SetLoadTimeDataDefaults(const std::string& app_locale,
localized_strings->SetString("textdirection", GetTextDirection());
}
-std::string GetWebUiCssTextDefaults() {
+std::string GetWebUiCssTextDefaults(const std::string& css_template) {
std::map<base::StringPiece, std::string> placeholders;
placeholders["textDirection"] = GetTextDirection();
placeholders["fontFamily"] = GetFontFamily();
placeholders["fontSize"] = GetFontSize();
+ return ui::ReplaceTemplateExpressions(css_template, placeholders);
+}
+std::string GetWebUiCssTextDefaults() {
const ui::ResourceBundle& resource_bundle =
ui::ResourceBundle::GetSharedInstance();
const std::string& css_template =
resource_bundle.GetRawDataResource(IDR_WEBUI_CSS_TEXT_DEFAULTS)
.as_string();
+ return GetWebUiCssTextDefaults(css_template);
+}
- return ui::ReplaceTemplateExpressions(css_template, placeholders);
+std::string GetWebUiCssTextDefaultsMd() {
+ const ui::ResourceBundle& resource_bundle =
+ ui::ResourceBundle::GetSharedInstance();
+ const std::string& css_template =
+ resource_bundle.GetRawDataResource(IDR_WEBUI_CSS_TEXT_DEFAULTS_MD)
+ .as_string();
+ return GetWebUiCssTextDefaults(css_template);
}
void AppendWebUiCssTextDefaults(std::string* html) {
diff --git a/ui/base/webui/web_ui_util.h b/ui/base/webui/web_ui_util.h
index c774af9..dc24839 100644
--- a/ui/base/webui/web_ui_util.h
+++ b/ui/base/webui/web_ui_util.h
@@ -50,9 +50,17 @@ UI_BASE_EXPORT void SetLoadTimeDataDefaults(
const std::string& app_locale,
base::DictionaryValue* localized_strings);
+// Get a CSS declaration for common text styles using provided template.
+UI_BASE_EXPORT std::string GetWebUiCssTextDefaults(
+ const std::string& css_template);
+
// Get a CSS declaration for common text styles for all of Web UI.
UI_BASE_EXPORT std::string GetWebUiCssTextDefaults();
+// Get a CSS declaration for common text styles for Web UI using
+// Material Design.
+UI_BASE_EXPORT std::string GetWebUiCssTextDefaultsMd();
+
// Appends the CSS declaration returned by GetWebUiCssTextDefaults() as an
// inline stylesheet.
UI_BASE_EXPORT void AppendWebUiCssTextDefaults(std::string* html);
diff --git a/ui/webui/resources/css/roboto.css b/ui/webui/resources/css/roboto.css
index 34c0ad7..c9554f2 100644
--- a/ui/webui/resources/css/roboto.css
+++ b/ui/webui/resources/css/roboto.css
@@ -5,6 +5,14 @@
@font-face {
font-family: 'Roboto';
font-style: normal;
+ font-weight: 300;
+ src: local('Roboto Light'), local('Roboto-Light'),
+ url(chrome://resources/roboto/roboto-light.woff2) format('woff2');
+}
+
+@font-face {
+ font-family: 'Roboto';
+ font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'),
url(chrome://resources/roboto/roboto-regular.woff2) format('woff2');
diff --git a/ui/webui/resources/css/text_defaults_md.css b/ui/webui/resources/css/text_defaults_md.css
new file mode 100644
index 0000000..a2b2022
--- /dev/null
+++ b/ui/webui/resources/css/text_defaults_md.css
@@ -0,0 +1,31 @@
+/* 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. */
+
+/* This file is dynamically processed by a C++ data source handler to fill in
+ * some per-platform/locale styles that dramatically alter the page. This is
+ * done to reduce flicker, as JS may not run before the page is rendered.
+ *
+ * There are two ways to include this stylesheet:
+ * 1. via its chrome://resources/ URL in HTML, i.e.:
+ *
+ * <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
+ *
+ * 2. via the webui::AppendWebUICSSTextDefaultsMd() method to directly append it
+ * to an HTML string.
+ * Otherwise its $placeholders won't be expanded. */
+
+@import url(chrome://resources/css/roboto.css);
+
+html {
+ direction: ${textDirection};
+}
+
+body {
+ font-family: Roboto, ${fontFamily};
+ font-size: ${fontSize};
+}
+
+button {
+ font-family: Roboto, ${fontFamily};
+}
diff --git a/ui/webui/resources/roboto/roboto-light.woff2 b/ui/webui/resources/roboto/roboto-light.woff2
new file mode 100644
index 0000000..49288bc
--- /dev/null
+++ b/ui/webui/resources/roboto/roboto-light.woff2
Binary files differ
diff --git a/ui/webui/resources/webui_resources.grd b/ui/webui/resources/webui_resources.grd
index 8abacac..df687b7 100644
--- a/ui/webui/resources/webui_resources.grd
+++ b/ui/webui/resources/webui_resources.grd
@@ -16,9 +16,10 @@ without changes to the corresponding grd file. -->
<include name="IDR_WEBUI_I18N_TEMPLATE_JS" file="js/i18n_template.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_WEBUI_JSTEMPLATE_JS" file="js/jstemplate_compiled.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_WEBUI_ANALYTICS_JS" file="js/analytics.js" flattenhtml="true" type="BINDATA" />
- <!-- Roboto Font. Roboto-Regular is already available on Android, and
- Roboto-Medium is not used on Android. -->
+ <!-- Roboto Font. Roboto-Regular and Roboto-Light is already available on
+ Android, and Roboto-Medium is not used on Android. -->
<if expr="not android">
+ <include name="IDR_WEBUI_ROBOTO_ROBOTO_LIGHT_WOFF2" file="roboto/roboto-light.woff2" type="BINDATA" />
<include name="IDR_WEBUI_ROBOTO_ROBOTO_REGULAR_WOFF2" file="roboto/roboto-regular.woff2" type="BINDATA" />
<include name="IDR_WEBUI_ROBOTO_ROBOTO_MEDIUM_WOFF2" file="roboto/roboto-medium.woff2" type="BINDATA" />
</if>
@@ -230,6 +231,8 @@ without changes to the corresponding grd file. -->
flattenhtml="true" />
<structure name="IDR_WEBUI_CSS_TEXT_DEFAULTS"
file="css/text_defaults.css" type="chrome_html" />
+ <structure name="IDR_WEBUI_CSS_TEXT_DEFAULTS_MD"
+ file="css/text_defaults_md.css" type="chrome_html" />
<structure name="IDR_WEBUI_CSS_OVERLAY"
file="css/overlay.css" type="chrome_html"
flattenhtml="true" />