Commit 3a36e4b2 authored by newt@chromium.org's avatar newt@chromium.org

Upstream about:welcome page for Android.

This page is specific to Android devices and is shown to the user
after first-run.

BUG=136951


Review URL: https://chromiumcodereview.appspot.com/10828140

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152007 0039d316-1c4b-4281-b951-d872f2087c98
parent 039124e7
......@@ -19,6 +19,10 @@
<structure name="IDR_ABOUT_MEMORY_HTML" file="resources\about_memory.html" flattenhtml="true" type="chrome_html" />
</if>
<structure name="IDR_ABOUT_VERSION_HTML" file="resources\about_version.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
<if expr="pp_ifdef('android')">
<structure name="IDR_ABOUT_WELCOME_HTML" file="resources\about_welcome_android\about_welcome_android.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_ABOUT_WELCOME_CSS" file="resources\about_welcome_android\about_welcome_android.css" flattenhtml="true" type="chrome_html" />
</if>
<if expr="pp_ifdef('chromeos')">
<structure name="IDR_DEMO_USER_LOGIN_HTML" file="resources\chromeos\login\demo_user_login.html" flattenhtml="true" type="chrome_html" />
</if>
......@@ -57,6 +61,9 @@
<include name="IDR_ABOUT_STATS_HTML" file="resources\about_stats.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_ABOUT_STATS_JS" file="resources\about_stats.js" type="BINDATA" />
<include name="IDR_ABOUT_VERSION_JS" file="resources\about_version.js" type="BINDATA" />
<if expr="pp_ifdef('android')">
<include name="IDR_ABOUT_WELCOME_JS" file="resources\about_welcome_android\about_welcome_android.js" type="BINDATA" />
</if>
<include name="IDR_BOOKMARKS_MANIFEST" file="resources\bookmark_manager\manifest.json" type="BINDATA" />
<if expr="is_posix and not is_macosx">
<include name="IDR_CERTIFICATE_VIEWER_HTML" file="resources\certificate_viewer.html" type="BINDATA" />
......
/* Copyright (c) 2012 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. */
html {
height: 100%;
width: 100%;
}
body {
background-color: #f4f4f4;
background-repeat: no-repeat;
font-family: Droid Sans;
height: 100%;
margin: 0;
width: 100%;
}
a {
color: rgb(51, 181, 229);
}
#logo {
background-position: center;
background-repeat: no-repeat;
background-size: 100%;
margin-left: auto;
margin-right: auto;
}
#center-wrapper {
height: 100%;
width: 100%;
}
#footer-container {
display: none;
position: fixed;
text-align: center;
width: 100%;
}
#footer {
color: #646464;
}
#take-a-tour {
background: -webkit-gradient(
linear, left top, left bottom, from(#f5f5f5), to(#f1f1f1));
border: 1px solid #ccc;
border-radius: 2px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08),
inset 0 0 2px rgba(255, 255, 255, 0.6);
color: rgb(73, 73, 74);
display: block;
font-size: 20px;
font-weight: bold;
margin-left: auto;
margin-right: auto;
max-width: 400px;
padding: 11px 0;
text-align: center;
text-decoration: none;
}
@media only screen and (max-width: 400px) {
#take-a-tour {
/* By default the button is 400px wide and center. In this selector, the
screen isn't wide enough for that. */
margin-left: 20px;
margin-right: 20px;
}
}
#take-a-tour:active {
border: 1px solid #a1a1a1;
box-shadow: inset 0 5px 15px rgba(100, 100, 100, 0.20);
}
/* Logos */
@media only screen and (-webkit-min-device-pixel-ratio: 1.0) {
#logo {
background-image: url(images/holo_logo_200.png);
height: 152px;
width: 536px;
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.3) {
#logo {
background-image: url(images/holo_logo_200.png);
height: 114px;
width: 402px;
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
#logo {
background-image: url(images/holo_logo_150.png);
height: 76px;
width: 268px;
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 2.0) {
#logo {
background-image: url(images/holo_logo_200.png);
height: 76px;
width: 268px;
}
}
/* Logo/tour button spacing */
@media only screen and (min-height: 401px) {
#take-a-tour {
/* Add space between the logo and the tour button */
margin-top: 60px;
}
}
@media only screen and (max-height: 400px) {
#take-a-tour {
/* Add a little space between the logo and tour button, and push the
logo and button up some. */
margin-bottom: 40px;
margin-top: 20px;
}
}
/* Footer vertical positioning */
@media only screen and (min-height: 601px) {
#footer-container {
/* the top of the footer is 140px from the bottom of the screen */
bottom: 0;
height: 140px;
}
}
@media only screen and (max-height: 600px) {
#footer-container {
/* the bottom of footer is 20px from the bottom of the screen */
bottom: 20px;
}
}
/* Footer horizontal width */
#footer {
max-width: 600px;
}
@media only screen and (min-width: 606px) {
#footer {
/* the footer doesn't fill the page horizontally, so center it */
margin-left: auto;
margin-right: auto;
}
}
@media only screen and (max-width: 605px) {
#footer {
/* the footer horizontally fills the page, so add some margin */
margin-left: 20px;
margin-right: 20px;
}
}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title i18n-content="title"></title>
<link rel="stylesheet" href="about_welcome_android.css">
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://welcome/about_welcome_android.js"></script>
</head>
<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
<table id="center-wrapper">
<tr>
<td>
<div class="center">
<div id="logo"></div>
<a href="http://www.google.com/chrome/android/tour"
id="take-a-tour" i18n-content="takeATour"></a>
</div>
</td>
</tr>
</table>
<div id="footer-container">
<div id="footer">
<span i18n-content="firstRunSignedIn"></span>
<a id="settings" href="#settings" i18n-content="settings"></a>
</div>
</div>
<script src="chrome://welcome/strings.js"></script>
<script src="chrome://resources/js/i18n_template2.js"></script>
</body>
</html>
// Copyright (c) 2012 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.
// File Description:
// Contains all the necessary functions for rendering the Welcome page on
// Android.
cr.define('about_welcome_android', function() {
'use strict';
/**
* Disable context menus.
*/
function initialize() {
document.body.oncontextmenu = function(e) {
e.preventDefault();
}
}
// Return an object with all of the exports.
return {
initialize: initialize,
};
});
document.addEventListener('DOMContentLoaded', about_welcome_android.initialize);
......@@ -63,6 +63,10 @@
#include "ui/web_dialogs/constrained_web_dialog_ui.h"
#include "ui/web_dialogs/web_dialog_ui.h"
#if defined(OS_ANDROID)
#include "chrome/browser/ui/webui/welcome_ui_android.h"
#endif
#if defined(OS_CHROMEOS)
#include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h"
#include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h"
......@@ -233,7 +237,10 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
/****************************************************************************
* OS Specific #defines
***************************************************************************/
#if !defined(OS_ANDROID)
#if defined(OS_ANDROID)
if (url.host() == chrome::kChromeUIWelcomeHost)
return &NewWebUI<WelcomeUI>;
#else
// These pages are implemented with native UI elements on Android.
if (url.host() == chrome::kChromeUIDownloadsHost)
return &NewWebUI<DownloadsUI>;
......
// Copyright (c) 2012 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.
#include "chrome/browser/ui/webui/welcome_ui_android.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/google_chrome_strings.h"
WelcomeUI::WelcomeUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
// Set up the chrome://welcome source.
ChromeWebUIDataSource* html_source =
new ChromeWebUIDataSource(chrome::kChromeUIWelcomeHost);
html_source->set_use_json_js_format_v2();
// Localized strings.
html_source->AddLocalizedString("title",
IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE);
html_source->AddLocalizedString("takeATour", IDS_FIRSTRUN_TAKE_TOUR);
html_source->AddLocalizedString("firstRunSignedIn", IDS_FIRSTRUN_SIGNED_IN);
html_source->AddLocalizedString("settings", IDS_FIRSTRUN_SETTINGS_LINK);
// Add required resources.
html_source->set_json_path("strings.js");
html_source->add_resource_path("about_welcome_android.css",
IDR_ABOUT_WELCOME_CSS);
html_source->add_resource_path("about_welcome_android.js",
IDR_ABOUT_WELCOME_JS);
html_source->set_default_resource(IDR_ABOUT_WELCOME_HTML);
Profile* profile = Profile::FromWebUI(web_ui);
ChromeURLDataManager::AddDataSource(profile, html_source);
}
WelcomeUI::~WelcomeUI() {
}
// Copyright (c) 2012 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.
#ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_UI_ANDROID_H_
#define CHROME_BROWSER_UI_WEBUI_WELCOME_UI_ANDROID_H_
#include "content/public/browser/web_ui_controller.h"
// The WebUI for chrome://welcome
class WelcomeUI : public content::WebUIController {
public:
explicit WelcomeUI(content::WebUI* web_ui);
virtual ~WelcomeUI();
private:
DISALLOW_COPY_AND_ASSIGN(WelcomeUI);
};
#endif // CHROME_BROWSER_UI_WEBUI_WELCOME_UI_ANDROID_H_
......@@ -4285,6 +4285,8 @@
'browser/ui/webui/uber/uber_ui.h',
'browser/ui/webui/web_ui_util.cc',
'browser/ui/webui/web_ui_util.h',
'browser/ui/webui/welcome_ui_android.cc',
'browser/ui/webui/welcome_ui_android.h',
'browser/ui/window_sizer/window_sizer.cc',
'browser/ui/window_sizer/window_sizer.h',
'browser/ui/window_sizer/window_sizer_ash.cc',
......
......@@ -79,6 +79,10 @@ const char kChromeUIUberURL[] = "chrome://chrome/";
const char kChromeUIUberFrameURL[] = "chrome://uber-frame/";
const char kChromeUIVersionURL[] = "chrome://version/";
#if defined(OS_ANDROID)
const char kChromeUIWelcomeURL[] = "chrome://welcome/";
#endif
#if defined(OS_CHROMEOS)
const char kChromeUIActivationMessage[] = "chrome://activationmessage/";
const char kChromeUIChooseMobileNetworkURL[] =
......@@ -209,6 +213,10 @@ const char kChromeUIWorkersHost[] = "workers";
const char kChromeUIScreenshotPath[] = "screenshots";
const char kChromeUIThemePath[] = "theme";
#if defined(OS_ANDROID)
const char kChromeUIWelcomeHost[] = "welcome";
#endif
#if defined(OS_LINUX) || defined(OS_OPENBSD)
const char kChromeUILinuxProxyConfigHost[] = "linux-proxy-config";
const char kChromeUISandboxHost[] = "sandbox";
......
......@@ -71,6 +71,10 @@ extern const char kChromeUIUberURL[];
extern const char kChromeUIUberFrameURL[];
extern const char kChromeUIVersionURL[];
#if defined(OS_ANDROID)
extern const char kChromeUIWelcomeURL[];
#endif
#if defined(OS_CHROMEOS)
extern const char kChromeUIActivationMessage[];
extern const char kChromeUIChooseMobileNetworkURL[];
......@@ -198,6 +202,10 @@ extern const char kChromeUIWorkersHost[];
extern const char kChromeUIScreenshotPath[];
extern const char kChromeUIThemePath[];
#if defined(OS_ANDROID)
extern const char kChromeUIWelcomeHost[];
#endif
#if defined(OS_LINUX) || defined(OS_OPENBSD)
extern const char kChromeUILinuxProxyConfigHost[];
extern const char kChromeUISandboxHost[];
......@@ -387,6 +395,7 @@ extern const char kExtensionResourceScheme[];
#if defined(OS_CHROMEOS)
extern const char kDriveScheme[];
#endif
#if defined(OS_ANDROID)
extern const char kContentScheme[];
// Special Android file paths.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment