Commit 63538207 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Remove components/chrome_apps

This removes Web Store Widget app code, and with it, the whole
components/chrome_apps dir (which currently contains only the
app in question).

The app was used as a wrapper around Web Store Widget UI. The widget
provides way of displaying filtered list of extensions in Chrome Web
Store and is able to request an extension installation. The widget
itself is still used in Files app (and has been moved alongside other
Files app resources), but the Web Store Widget component app, which
was used to list printer provider extensions for a printer when the
printer gets plugged in is not used anymore (https://crbug.com/734161),
and can be removed.


BUG=1288076

Change-Id: I1818a9fcce6f4bf9fc9877158ba839b22d825fb4
Reviewed-on: https://chromium-review.googlesource.com/c/1291839Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601827}
parent 6c8ccbdd
...@@ -154,14 +154,12 @@ template("chrome_extra_paks") { ...@@ -154,14 +154,12 @@ template("chrome_extra_paks") {
"$root_gen_dir/ash/public/cpp/resources/ash_public_unscaled_resources.pak", "$root_gen_dir/ash/public/cpp/resources/ash_public_unscaled_resources.pak",
"$root_gen_dir/chrome/multidevice_setup_resources.pak", "$root_gen_dir/chrome/multidevice_setup_resources.pak",
"$root_gen_dir/chromeos/chromeos_resources.pak", "$root_gen_dir/chromeos/chromeos_resources.pak",
"$root_gen_dir/components/chrome_apps/chrome_apps_resources.pak",
"$root_gen_dir/ui/file_manager/file_manager_resources.pak", "$root_gen_dir/ui/file_manager/file_manager_resources.pak",
] ]
deps += [ deps += [
"//ash/public/cpp/resources:ash_public_unscaled_resources", "//ash/public/cpp/resources:ash_public_unscaled_resources",
"//chrome/browser/resources/chromeos:multidevice_setup_resources", "//chrome/browser/resources/chromeos:multidevice_setup_resources",
"//chromeos/resources", "//chromeos/resources",
"//components/chrome_apps:resources",
"//ui/file_manager:resources", "//ui/file_manager:resources",
] ]
} }
......
# 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.
import("//tools/grit/grit_rule.gni")
grit("resources") {
source = "chrome_apps_resources.grd"
outputs = [
"grit/chrome_apps_resources.h",
"grit/chrome_apps_resources_map.cc",
"grit/chrome_apps_resources_map.h",
"chrome_apps_resources.pak",
"chrome_apps_resources.rc",
]
}
component("chrome_apps") {
sources = [
"chrome_apps_export.h",
]
defines = [ "CHROME_APPS_IMPLEMENTATION" ]
public_deps = [
":resources",
"//base",
]
}
// 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.
#ifndef COMPONENTS_CHROME_APPS_CHROME_APPS_EXPORT_H_
#define COMPONENTS_CHROME_APPS_CHROME_APPS_EXPORT_H_
// Defines CHROME_APPS_EXPORT so that functionality implemented by the
// CHROME_APPS module can be exported to consumers.
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(CHROME_APPS_IMPLEMENTATION)
#define CHROME_APPS_EXPORT __declspec(dllexport)
#else
#define CHROME_APPS_EXPORT __declspec(dllimport)
#endif // defined(CHROME_APPS_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(CHROME_APPS_IMPLEMENTATION)
#define CHROME_APPS_EXPORT __attribute__((visibility("default")))
#else
#define CHROME_APPS_EXPORT
#endif
#endif
#else // defined(COMPONENT_BUILD)
#define CHROME_APPS_EXPORT
#endif
#endif // COMPONENTS_CHROME_APPS_CHROME_APPS_EXPORT_H_
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/chrome_apps_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/chrome_apps_resources_map.cc" type="resource_file_map_source" />
<output filename="grit/chrome_apps_resources_map.h" type="resource_map_header" />
<output filename="chrome_apps_resources.pak" type="data_package" />
<output filename="chrome_apps_resources.rc" type="rc_all" />
</outputs>
<release seq="1">
<includes>
<if expr="chromeos">
<part file="webstore_widget_resources.grdp" />
</if>
</includes>
</release>
</grit>
fukino@chromium.org
hirono@chromium.org
tbarzic@chromium.org
yoshiki@chromium.org
// 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.
/** @const {number} */
var APP_WINDOW_WIDTH = 735;
/** @const {number} */
var APP_WINDOW_HEIGHT = 530;
chrome.webstoreWidgetPrivate.onShowWidget.addListener(function(options) {
if (!options || options.type != 'PRINTER_PROVIDER' || !options.usbId) {
console.error('Invalid widget options.');
return;
}
chrome.app.window.create('app/main.html', {
id: JSON.stringify(options),
frame: 'none',
innerBounds: {width: APP_WINDOW_WIDTH, height: APP_WINDOW_HEIGHT},
resizable: false
}, function(createdWindow) {
createdWindow.contentWindow.params = {
filter: {
'printer_provider_vendor_id': options.usbId.vendorId,
'printer_provider_product_id': options.usbId.productId
},
webstoreUrl: null
};
});
});
/* 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. */
body {
margin: 0;
}
.title-area {
-webkit-app-region: drag;
background-color: white;
box-shadow: 0 1px #d0d0d0;
display: flex;
font-size: 15px;
height: 48px;
}
.window-title {
flex: 1;
line-height: 48px;
margin-inline-start: 20px;
}
<!DOCTYPE HTML>
<!--
-- 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.
-->
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="chrome://resources/css/apps/topbutton_bar.css">
<link rel="stylesheet" href="chrome://resources/css/dialogs.css">
<link rel="stylesheet" href="/app/main.css">
<link rel="stylesheet" href="/cws_widget/cws_widget_container.css">
<script src="/app/main.js"></script>
</head>
<body>
<div class="title-area">
<span id="title" class="window-title"></span>
<span class="topbutton-bar">
<button id="minimize-button" class="minimize-button" tabindex="-1"
aria-label="-">
</button>
<button id="close-button" class="close-button" tabindex="-1"
aria-label="x">
</button>
</span>
</div>
<div id="widget-container-root"></div>
</body>
</html>
// 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.
// <include src="../../../../ui/webui/resources/js/cr.js">
// <include src="../../../../ui/webui/resources/js/load_time_data.js">
// <include src="../../../../ui/webui/resources/js/i18n_template_no_process.js">
// <include src="../../../../ui/webui/resources/js/cr/event_target.js">
// <include src="../../../../ui/webui/resources/js/cr/ui/dialogs.js">
(function() {
'use strict';
/**
* @type {?{
* filter: !Object<*>,
* webstoreUrl: ?string
* }}
*/
window.params = window.params || null;
/**
* @param {string} id Element id.
* @return {HTMLElement} The found element, or null.
*/
function $(id) {
return document.getElementById(id);
}
/**
* Default strings.
*/
var defaultStrings = {
'language': 'en',
'LINK_TO_WEBSTORE': '[LOCALIZE ME] Learn more...',
'INSTALLATION_FAILED_MESSAGE': '[LOCALIZE ME] Installation failed!',
'OK_BUTTON': '[LOCALIZE ME] OK',
'TITLE_PRINTER_PROVIDERS': '[LOCALIZE ME] Select app for your printer',
'DEFAULT_ERROR_MESSAGE': '[LOCALIZE ME] Failure'
};
/**
* @param {string} id The string id.
* @return {string}
*/
function getString(id) {
return loadTimeData.getString(id) || defaultStrings[id] || '';
}
/**
* @param {Object<string>} strings Localized strings used by the container.
* @return {!CWSWidgetContainerPlatformDelegate}
*/
function createPlatformDelegate(strings) {
return {
strings: {
UI_LOCALE: getString('language'),
LINK_TO_WEBSTORE: getString('LINK_TO_WEBSTORE'),
INSTALLATION_FAILED_MESSAGE: getString('INSTALLATION_FAILED_MESSAGE'),
LOADING_SPINNER_ALT: getString('LOADING_SPINNER_ALT'),
INSTALLING_SPINNER_ALT: getString('INSTALLING_SPINNER_ALT')
},
metricsImpl: {
/**
* Map from interval name to interval start timestamp.
* @type {Object<string, Date>}
*/
intervals: {},
/**
* @param {string} enumName
* @param {number} value
* @param {number} enumSize
*/
recordEnum: function(enumName, value, enumSize) {
var index = (value >= 0 && value < enumSize) ? value : enumSize;
chrome.metricsPrivate.recordValue({
'metricName': 'WebstoreWidgetApp.' + enumName,
'type': chrome.metricsPrivate.MetricTypeType.HISTOGRAM_LINEAR,
'min': 1,
'max': enumSize,
'buckets': enumSize + 1
}, index);
},
/** @param {string} actionName */
recordUserAction: function(actionName) {
chrome.metricsPrivate.recordUserAction(
'WebstoreWidgetApp.' + actionName);
},
/** @param {string} intervalName */
startInterval: function(intervalName) {
this.intervals[intervalName] = Date.now();
},
/** @param {string} intervalName */
recordInterval: function(intervalName) {
if (!intervalName in this.intervals) {
console.error('Interval \'' + intervalName + '\' not started');
return;
}
chrome.metricsPrivate.recordTime(
'WebstoreWidgetApp.' + intervalName,
Date.now() - this.intervals[intervalName]);
delete this.intervals[intervalName];
}
},
/**
* @param {string} itemId Item to be installed.
* @param {function(?string)} callback Callback param is the error message,
* which is set to null on success.
*/
installWebstoreItem: function(itemId, callback) {
chrome.webstoreWidgetPrivate.installWebstoreItem(
itemId,
false,
function() {
callback(chrome.runtime.lastError ?
chrome.runtime.lastError.message || 'UNKNOWN_ERROR' : null);
});
},
/** @param {function(Array<string>)} callback */
getInstalledItems: function(callback) { callback([]); },
/**
* @param {function(?string)} callback The argument is the fetche3d access
* token. Null on error.
*/
requestWebstoreAccessToken: function(callback) {
chrome.fileManagerPrivate.requestWebStoreAccessToken(function(token) {
if (chrome.runtime.lastError) {
console.error('Error getting access token: ' +
chrome.runtime.lastError.message);
callback(null);
return;
}
callback(token);
});
}
};
}
function initializeTopbarButtons() {
$('close-button').addEventListener('click', function(e) {
e.preventDefault();
closeAppWindow();
});
$('close-button').addEventListener('mousedown', function(e) {
e.preventDefault();
});
$('minimize-button').addEventListener('click', function(e) {
e.preventDefault();
chrome.app.window.current().minimize();
});
$('minimize-button').addEventListener('mousedown', function(e) {
e.preventDefault();
});
}
/**
* @param {!CWSWidgetContainer.Result} result The result reported by the widget.
*/
function showWidgetResult(result) {
// TODO(tbarzic): Add some UI to show on success.
if (result != CWSWidgetContainer.Result.FAILED) {
closeAppWindow();
return;
}
var dialog = new CWSWidgetContainerErrorDialog($('widget-container-root'));
dialog.show(getString('DEFAULT_ERROR_MESSAGE'),
closeAppWindow,
closeAppWindow);
}
/** Closes the current app window. */
function closeAppWindow() {
chrome.app.window.current().close();
}
window.addEventListener('DOMContentLoaded', function() {
initializeTopbarButtons();
chrome.webstoreWidgetPrivate.getStrings(function(strings) {
loadTimeData.data = strings;
i18nTemplate.process(document, loadTimeData);
cr.ui.dialogs.BaseDialog.OK_LABEL = getString('OK_BUTTON');
document.title = getString('TITLE_PRINTER_PROVIDERS');
$('title').textContent = document.title;
if (!window.params) {
console.error('Params not set!');
return;
}
/** @type {!CWSWidgetContainerPlatformDelegate} */
var platformDelegate = createPlatformDelegate(strings);
var root = $('widget-container-root');
if (!root) {
console.error('No root element');
return;
}
/** @type {!CWSWidgetContainer} */
var widgetContainer = new CWSWidgetContainer(
document, root, platformDelegate, {} /* state */);
widgetContainer.ready()
/** @return {!Promise.<CWSWidgetContainer.ResolveReason>} */
.then(function() {
return widgetContainer.start(window.params.filter,
window.params.webstoreUrl);
})
/** @param {!CWSWidgetContainer.ResolveReason} reason */
.then(function(reason) {
if (reason != CWSWidgetContainer.ResolveReason.DONE)
return;
var result = widgetContainer.finalizeAndGetResult();
showWidgetResult(result.result);
})
/** @param {*} error */
.catch(function(error) {
showWidgetResult(CWSWidgetContainer.Result.FAILED);
});
});
});
})();
// 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.
/** @const */
chrome.webstoreWidgetPrivate = {};
/**
* @enum {string}
*/
chrome.webstoreWidgetPrivate.Type = {
PRINTER_PROVIDER: 'PRINTER_PROVIDER'
};
/**
* @typedef {{vendorId: number, productId: number}}
*/
chrome.webstoreWidgetPrivate.UsbId;
/**
* @typedef {{
* options: chrome.webstoreWidgetPrivate.Type,
* usbId: (chrome.webstoreWidgetPrivate.UsbId|undefined)
* }}
*/
chrome.webstoreWidgetPrivate.Options;
/**
* @constructor
*/
chrome.webstoreWidgetPrivate.ShowWidgetEvent;
/**
* @param {function(!chrome.webstoreWidgetPrivate.Options)} callback
*/
chrome.webstoreWidgetPrivate.ShowWidgetEvent.prototype.addListener = function(
callback) {
};
/**
* @param {function(!chrome.webstoreWidgetPrivate.Options)} callback
*/
chrome.webstoreWidgetPrivate.ShowWidgetEvent.prototype.removeListener =
function(callback) {};
/**
* @param {function(!chrome.webstoreWidgetPrivate.Options)} callback
* @return {boolean}
*/
chrome.webstoreWidgetPrivate.ShowWidgetEvent.prototype.hasListener = function(
callback) {
};
/**
* @return {boolean}
*/
chrome.webstoreWidgetPrivate.ShowWidgetEvent.prototype.hasListeners =
function() {};
/**
* @typedef {!chrome.webstoreWidgetPrivate.ShowWidgetEvent}
*/
chrome.webstoreWidgetPrivate.onShowWidget;
/**
* @param {function(Object<string>)} callback
*/
chrome.webstoreWidgetPrivate.getStrings = function(callback) {};
/**
* Installs the app with ID {@code itemId}.
* @param {string} itemId
* @param {boolean} silentInstall
* @param {function()} callback
*/
chrome.webstoreWidgetPrivate.installWebstoreItem = function(
itemId, silentInstall, callback) {
};
{
// chrome-extension://fbjakikfhfdajcamjleinfciajelkpek/
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ZSmlOjtKoapSOZ4kH4vpSh2WzGxT7AlJgTet+0v5O/eV56dg1D+hpIltMswe47zX3kozOOzZ3LhnLHZb7kBIyVdgmtAv73XP1/CjvO7w1F5dzdS3zqJEg4JIblKmGIs8Zb93rols5DsJth58w3nPDz94clWQY3VI0IsgPfgssi/5OHyyzd3fVZS6UQU1XBkfZ+mpUQSKD293Rqq2aol1WgmyVumj7o8YM73SU/9Hnxla56ew88Zv/A78o1i1X6mcQcLCexDIAwcerJ09TvrLRv0sexRKBx47YZqVmR5yJRNGQiJdV54Es/jP6K8Oy8oZnz7Wea/nAL0b0OKAcq7+QIDAQAB",
"name": "Chrome Webstore Gallery Widget app",
"description": "App for showing Chrome Webstore Gallery widget and handling extension installs from the widget",
"version": "0.2",
"manifest_version": 2,
"display_in_launcher": false,
"web_accessible_resources": [
"cws_widget/app_installer.js",
"cws_widget/cws_webview_client.js",
"cws_widget/cws_widget_container.css",
"cws_widget/cws_widget_container.js",
"cws_widget/cws_widget_container_error_dialog.js"
],
"icons": {
"16": "app/icons/icon_16.png",
"32": "app/icons/icon_32.png",
"128": "app/icons/icon_128.png"
},
"app": {
"background": {
"scripts": ["app/background.js"]
},
"content_security_policy": "style-src 'self' blob: filesystem: chrome://resources; img-src 'self' blob: filesystem: chrome://theme chrome://resources;"
},
"permissions": [
"chrome://resources/",
"chrome://theme/",
"fileManagerPrivate",
"metricsPrivate",
"webstoreWidgetPrivate",
"webview"
]
}
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- Manifest: -->
<include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_MANIFEST" file="webstore_widget/manifest.json" type="BINDATA" />
<!-- Background page: -->
<include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_BACKGROUND_JS" file="webstore_widget/app/background.js" type="BINDATA" />
<!-- Main app window resources: -->
<include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_MAIN_HTML" file="webstore_widget/app/main.html" type="BINDATA" />
<include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_MAIN_JS" file="webstore_widget/app/main.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_MAIN_CSS" file="webstore_widget/app/main.css" flattenhtml="true" type="BINDATA" />
</grit-part>
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