diff options
21 files changed, 238 insertions, 0 deletions
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 8ba8eb4..6790c4b 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn @@ -92,6 +92,7 @@ static_library("extensions") { "//third_party/libevent", "//third_party/protobuf:protobuf_lite", "//chromeos/ime:gencode", + "//components/chrome_apps", "//remoting/host/it2me:common", ] } else { diff --git a/chrome/browser/extensions/DEPS b/chrome/browser/extensions/DEPS index 5bbbf4e..2f74ae8 100644 --- a/chrome/browser/extensions/DEPS +++ b/chrome/browser/extensions/DEPS @@ -5,6 +5,7 @@ include_rules = [ # to depend on apps will be lifted. "-apps", "-chrome/browser/apps", + "+components/chrome_apps", "+components/crx_file", "+components/user_manager", "+extensions/strings/grit/extensions_strings.h", diff --git a/chrome/browser/extensions/chrome_component_extension_resource_manager.cc b/chrome/browser/extensions/chrome_component_extension_resource_manager.cc index 91546cf..61321a0 100644 --- a/chrome/browser/extensions/chrome_component_extension_resource_manager.cc +++ b/chrome/browser/extensions/chrome_component_extension_resource_manager.cc @@ -12,6 +12,7 @@ #include "grit/theme_resources.h" #if defined(OS_CHROMEOS) +#include "components/chrome_apps/chrome_apps_resource_util.h" #include "ui/file_manager/file_manager_resource_util.h" #endif @@ -43,6 +44,13 @@ ChromeComponentExtensionResourceManager() { kExtraComponentExtensionResources, arraysize(kExtraComponentExtensionResources)); #if defined(OS_CHROMEOS) + size_t chrome_apps_resource_size; + const GritResourceMap* chrome_apps_resources = + chrome_apps::GetChromeAppsResources(&chrome_apps_resource_size); + AddComponentResourceEntries( + chrome_apps_resources, + chrome_apps_resource_size); + size_t file_manager_resource_size; const GritResourceMap* file_manager_resources = file_manager::GetFileManagerResources(&file_manager_resource_size); diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index d892327..4ef251b 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -943,6 +943,7 @@ 'dependencies': [ '../build/linux/system.gyp:dbus', '../chromeos/ime/input_method.gyp:gencode', + '../components/components.gyp:chrome_apps', '../remoting/remoting.gyp:remoting_it2me_host_static', '../third_party/libevent/libevent.gyp:libevent', '../ui/base/ime/ui_base_ime.gyp:ui_base_ime', diff --git a/chrome/chrome_repack_resources.gypi b/chrome/chrome_repack_resources.gypi index 1cc88e5..8c0c7e7 100644 --- a/chrome/chrome_repack_resources.gypi +++ b/chrome/chrome_repack_resources.gypi @@ -24,6 +24,7 @@ ['chromeos==1', { 'pak_inputs': [ '<(SHARED_INTERMEDIATE_DIR)/ui/file_manager/file_manager_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/components/chrome_apps/chrome_apps_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/ui/oobe/oobe_resources.pak', ], }], diff --git a/components/BUILD.gn b/components/BUILD.gn index 4898af9..66864f0 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -27,6 +27,7 @@ group("all_components") { "//components/cdm/common", "//components/cdm/renderer", "//components/cloud_devices/common", + "//components/chrome_apps", "//components/component_updater", "//components/content_settings/core/browser", "//components/content_settings/core/common", @@ -143,6 +144,11 @@ group("all_components") { "//components/wifi_sync", ] } + + if (!is_chromeos || !enable_extensions) { + deps -= [ "//components/chrome_apps" ] + } + if (is_ios) { deps -= [ "//components/history/content/browser", diff --git a/components/OWNERS b/components/OWNERS index 86bc6db..0c5f5f5 100644 --- a/components/OWNERS +++ b/components/OWNERS @@ -32,6 +32,8 @@ per-file cdm.gypi=xhwang@chromium.org per-file cloud_devices*=gene@chromium.org per-file cloud_devices*=vitalybuka@chromium.org +per-file chrome_apps.gypi=tbarzic@chromium.org + per-file constrained_window*=gbillock@chromium.org per-file constrained_window*=msw@chromium.org diff --git a/components/chrome_apps.gypi b/components/chrome_apps.gypi new file mode 100644 index 0000000..4d01ece --- /dev/null +++ b/components/chrome_apps.gypi @@ -0,0 +1,51 @@ +# 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. +{ + 'variables': { + 'chromium_code': 1, + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/components/chrome_apps', + }, + 'targets': [ + { + 'target_name': 'chrome_apps_resources', + 'type': 'none', + 'actions': [ + { + 'action_name': 'chrome_apps_resources', + 'variables': { + 'grit_grd_file': 'chrome_apps/chrome_apps_resources.grd', + }, + 'includes': [ '../build/grit_action.gypi' ], + }, + ], + 'includes': [ '../build/grit_target.gypi' ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(SHARED_INTERMEDIATE_DIR)/components/chrome_apps/chrome_apps_resources.pak', + ], + }, + ], + }, + { + 'target_name': 'chrome_apps', + 'type': '<(component)', + 'dependencies': [ + '../base/base.gyp:base', + 'chrome_apps_resources', + ], + 'defines': [ + 'CHROME_APPS_IMPLEMENTATION', + ], + 'sources': [ + '<(grit_out_dir)/grit/chrome_apps_resources_map.cc', + '<(grit_out_dir)/grit/chrome_apps_resources_map.h', + 'chrome_apps/chrome_apps_export.h', + 'chrome_apps/chrome_apps_resource_util.cc', + 'chrome_apps/chrome_apps_resource_util.h', + ] + } + ] +} diff --git a/components/chrome_apps/BUILD.gn b/components/chrome_apps/BUILD.gn new file mode 100644 index 0000000..a559500 --- /dev/null +++ b/components/chrome_apps/BUILD.gn @@ -0,0 +1,29 @@ +# 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", + "chrome_apps_resource_util.cc", + "chrome_apps_resource_util.h", + ] + deps = [ + "//base", + ":resources", + ] + defines = [ "CHROME_APPS_IMPLEMENTATION" ] +} diff --git a/components/chrome_apps/DEPS b/components/chrome_apps/DEPS new file mode 100644 index 0000000..8ef0c33 --- /dev/null +++ b/components/chrome_apps/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+grit/chrome_apps_resources.h", + "+grit/chrome_apps_resources_map.h" +] diff --git a/components/chrome_apps/OWNERS b/components/chrome_apps/OWNERS new file mode 100644 index 0000000..d063efc --- /dev/null +++ b/components/chrome_apps/OWNERS @@ -0,0 +1 @@ +tbarzic@chromium.org diff --git a/components/chrome_apps/chrome_apps_export.h b/components/chrome_apps/chrome_apps_export.h new file mode 100644 index 0000000..6569016 --- /dev/null +++ b/components/chrome_apps/chrome_apps_export.h @@ -0,0 +1,32 @@ +// 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_ diff --git a/components/chrome_apps/chrome_apps_resource_util.cc b/components/chrome_apps/chrome_apps_resource_util.cc new file mode 100644 index 0000000..78fd827 --- /dev/null +++ b/components/chrome_apps/chrome_apps_resource_util.cc @@ -0,0 +1,19 @@ +// 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 "components/chrome_apps/chrome_apps_resource_util.h" + +#include "base/logging.h" +#include "grit/chrome_apps_resources_map.h" + +namespace chrome_apps { + +const GritResourceMap* GetChromeAppsResources(size_t* size) { + DCHECK(size); + + *size = kChromeAppsResourcesSize; + return kChromeAppsResources; +} + +} // namespace chrome_apps diff --git a/components/chrome_apps/chrome_apps_resource_util.h b/components/chrome_apps/chrome_apps_resource_util.h new file mode 100644 index 0000000..591929c --- /dev/null +++ b/components/chrome_apps/chrome_apps_resource_util.h @@ -0,0 +1,23 @@ +// 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_RESOURCE_UTIL_H_ +#define COMPONENTS_CHROME_APPS_CHROME_APPS_RESOURCE_UTIL_H_ + +#include <cstddef> + +#include "components/chrome_apps/chrome_apps_export.h" + +struct GritResourceMap; + +namespace chrome_apps { + +// Get the list of resources. |size| is populated with the number of resources +// in the returned array. +CHROME_APPS_EXPORT const GritResourceMap* GetChromeAppsResources( + size_t* size); + +} // namespace chrome_apps + +#endif // COMPONENTS_CHROME_APPS_CHROME_APPS_RESOURCE_UTIL_H_ diff --git a/components/chrome_apps/chrome_apps_resources.grd b/components/chrome_apps/chrome_apps_resources.grd new file mode 100644 index 0000000..725f042 --- /dev/null +++ b/components/chrome_apps/chrome_apps_resources.grd @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grit latest_public_release="0" current_release="1"> + <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> diff --git a/components/chrome_apps/webstore_widget/OWNERS b/components/chrome_apps/webstore_widget/OWNERS new file mode 100644 index 0000000..c0edc54 --- /dev/null +++ b/components/chrome_apps/webstore_widget/OWNERS @@ -0,0 +1,5 @@ +fukino@chromium.org +hirono@chromium.org +mtomasz@chromium.org +tbarzic@chromium.org +yoshiki@chromium.org diff --git a/components/chrome_apps/webstore_widget/app/background.js b/components/chrome_apps/webstore_widget/app/background.js new file mode 100644 index 0000000..c878b2a --- /dev/null +++ b/components/chrome_apps/webstore_widget/app/background.js @@ -0,0 +1,5 @@ +// 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. + +// TODO(tbarzic): Implement this. diff --git a/components/chrome_apps/webstore_widget/manifest.json b/components/chrome_apps/webstore_widget/manifest.json new file mode 100644 index 0000000..fad4329 --- /dev/null +++ b/components/chrome_apps/webstore_widget/manifest.json @@ -0,0 +1,15 @@ +{ + // 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.1", + "manifest_version": 2, + "app": { + "background": { + "scripts": ["app/background.js"] + } + }, + "permissions": [ + ] +} diff --git a/components/chrome_apps/webstore_widget_resources.grdp b/components/chrome_apps/webstore_widget_resources.grdp new file mode 100644 index 0000000..b08ef3f --- /dev/null +++ b/components/chrome_apps/webstore_widget_resources.grdp @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<grit-part> + <include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_MANIFEST" file="webstore_widget/manifest.json" type="BINDATA" /> + <include name="IDR_CHROME_APPS_WEBSTORE_WIDGET_BACKGROUND_JS" file="webstore_widget/app/background.js" type="BINDATA" /> +</grit-part> diff --git a/components/components.gyp b/components/components.gyp index 3f6eb49..f8dee130 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -152,5 +152,12 @@ 'pdf.gypi', ], }], + # TODO(tbarzic): Remove chromeos condition when there are non-chromeos apps + # in components/apps. + ['enable_extensions == 1 and chromeos == 1', { + 'includes': [ + 'chrome_apps.gypi', + ], + }], ], } diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids index d56ba05..6c353d2 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids @@ -218,6 +218,9 @@ "ui/file_manager/file_manager_resources.grd": { "includes": [28100], }, + "components/chrome_apps/chrome_apps_resources.grd": { + "includes": [28250], + }, "ui/login/login_resources.grd": { "includes": [28300], }, |