Commit 9a92c3af authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Chrome OS Discover: Add Launch Help module.

Bug: 862853
Change-Id: I5277cc404c9829353e38614b1fa94223e52152c8
Reviewed-on: https://chromium-review.googlesource.com/1188426
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586157}
parent 44a84f0f
......@@ -1988,6 +1988,9 @@
<message name="IDS_DISCOVER_SYNC_MY_FILES" desc="A label on the button that leads to the new web page where owner of the new device can sync their data with other devices.">
Sync my files
</message>
<message name="IDS_DISCOVER_GET_HELP" desc="A label on the button that opens Help App.">
Get Help
</message>
<message name="IDS_APP_START_NETWORK_WAIT_MESSAGE" desc="Message displayed while installing and/or launching web application in kiosk mode.">
Waiting for network connection...
</message>
......
086b9ab7eefe06c37c2c7238b4769907d22ab3dd
\ No newline at end of file
<include src="discover_card.html">
<include src="modules/discover_module_redeem_offers.html">
<include src="modules/discover_module_launch_help_app.html">
<include src="modules/discover_module_sync_files.html">
<include src="discover_welcome.html">
......
......@@ -8,6 +8,7 @@
// --- Modules.
// <include src="modules/discover_module_redeem_offers.js">
// <include src="modules/discover_module_launch_help_app.js">
// <include src="modules/discover_module_sync_files.js">
// --- These depend on modules.
......
......@@ -34,6 +34,9 @@
<discover-redeem-offers-card class="card" slot="cards"
module="redeem-offers">
</discover-redeem-offers-card>
<discover-launch-help-app-card class="card" slot="cards"
module="launch-help-app">
</discover-launch-help-app-card>
<discover-sync-files-card class="card" slot="cards"
module="sync-files">
</discover-sync-files-card>
......
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<dom-module id="discover-launch-help-app-card">
<template>
<discover-card on-click="onClick_">
<if expr="chromeos and _google_chrome">
<img slot="background"
srcset="../../../../../internal/resources/chromeos/discover/launch_help_app/help-regular-module_1x.png 1x,
../../../../../internal/resources/chromeos/discover/launch_help_app/help-regular-module_2x.png 2x">
<img slot="icon"
srcset="../../../../../internal/resources/chromeos/discover/launch_help_app/ic_help-round_1x.png 1x,
../../../../../internal/resources/chromeos/discover/launch_help_app/ic_help-round_2x.png 2x">
</if>
<div slot="title">
[[i18nDynamic(locale, 'discoverGetHelp')]]
</div>
</discover-card>
</template>
</dom-module>
// Copyright 2018 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.
Polymer({
is: 'discover-launch-help-app-card',
behaviors: [DiscoverModuleBehavior],
onClick_: function() {
chrome.send('discover.launch-help-app.handleLaunchHelpApp');
},
});
......@@ -1992,6 +1992,8 @@ jumbo_split_static_library("ui") {
"webui/chromeos/login/discover/discover_window_manager.cc",
"webui/chromeos/login/discover/discover_window_manager.h",
"webui/chromeos/login/discover/discover_window_manager_observer.h",
"webui/chromeos/login/discover/modules/discover_module_launch_help_app.cc",
"webui/chromeos/login/discover/modules/discover_module_launch_help_app.h",
"webui/chromeos/login/discover/modules/discover_module_redeem_offers.cc",
"webui/chromeos/login/discover/modules/discover_module_redeem_offers.h",
"webui/chromeos/login/discover/modules/discover_module_sync_files.cc",
......
......@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_launch_help_app.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_redeem_offers.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_sync_files.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_welcome.h"
......@@ -29,6 +30,8 @@ bool DiscoverManager::IsCompleted() const {
}
void DiscoverManager::CreateModules() {
modules_[DiscoverModuleLaunchHelpApp::kModuleName] =
std::make_unique<DiscoverModuleLaunchHelpApp>();
modules_[DiscoverModuleRedeemOffers::kModuleName] =
std::make_unique<DiscoverModuleRedeemOffers>();
modules_[DiscoverModuleSyncFiles::kModuleName] =
......
// Copyright 2018 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/chromeos/login/discover/modules/discover_module_launch_help_app.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h"
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
#include "content/public/browser/web_ui.h"
#include "ui/chromeos/devicetype_utils.h"
namespace chromeos {
namespace {
class DiscoverModuleLaunchHelpAppHandler : public DiscoverHandler {
public:
DiscoverModuleLaunchHelpAppHandler();
~DiscoverModuleLaunchHelpAppHandler() override = default;
private:
// BaseWebUIHandler: implementation
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void Initialize() override;
void RegisterMessages() override;
// Message handlers.
void HandleLaunchHelpApp();
DISALLOW_COPY_AND_ASSIGN(DiscoverModuleLaunchHelpAppHandler);
};
DiscoverModuleLaunchHelpAppHandler::DiscoverModuleLaunchHelpAppHandler()
: DiscoverHandler(DiscoverModuleLaunchHelpApp::kModuleName) {}
void DiscoverModuleLaunchHelpAppHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
builder->Add("discoverGetHelp", IDS_DISCOVER_GET_HELP);
}
void DiscoverModuleLaunchHelpAppHandler::Initialize() {}
void DiscoverModuleLaunchHelpAppHandler::RegisterMessages() {
AddPrefixedCallback("handleLaunchHelpApp",
&DiscoverModuleLaunchHelpAppHandler::HandleLaunchHelpApp);
}
void DiscoverModuleLaunchHelpAppHandler::HandleLaunchHelpApp() {
chrome::ShowHelpForProfile(Profile::FromWebUI(web_ui()),
chrome::HelpSource::HELP_SOURCE_WEBUI);
}
} // anonymous namespace
/* ***************************************************************** */
/* Discover LaunchHelpApp module implementation below. */
const char DiscoverModuleLaunchHelpApp::kModuleName[] = "launch-help-app";
DiscoverModuleLaunchHelpApp::DiscoverModuleLaunchHelpApp() = default;
DiscoverModuleLaunchHelpApp::~DiscoverModuleLaunchHelpApp() = default;
bool DiscoverModuleLaunchHelpApp::IsCompleted() const {
return false;
}
std::unique_ptr<DiscoverHandler>
DiscoverModuleLaunchHelpApp::CreateWebUIHandler() const {
return std::make_unique<DiscoverModuleLaunchHelpAppHandler>();
}
} // namespace chromeos
// Copyright 2018 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_CHROMEOS_LOGIN_DISCOVER_MODULES_DISCOVER_MODULE_LAUNCH_HELP_APP_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DISCOVER_MODULES_DISCOVER_MODULE_LAUNCH_HELP_APP_H_
#include <memory>
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_module.h"
namespace chromeos {
class DiscoverModuleLaunchHelpApp : public DiscoverModule {
public:
DiscoverModuleLaunchHelpApp();
~DiscoverModuleLaunchHelpApp() override;
// DiscoverModule:
bool IsCompleted() const override;
std::unique_ptr<DiscoverHandler> CreateWebUIHandler() const override;
// Module name.
static const char kModuleName[];
private:
DISALLOW_COPY_AND_ASSIGN(DiscoverModuleLaunchHelpApp);
};
} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DISCOVER_MODULES_DISCOVER_MODULE_LAUNCH_HELP_APP_H_
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