diff options
29 files changed, 117 insertions, 203 deletions
@@ -19,7 +19,6 @@ group("root") { # This is a temporary test of the not-yet-complete NaCl cross-compilation. #"//base(//build/toolchain/nacl:x86_newlib)", - "//apps/common/api:apps_api", "//cc", "//chrome/common", "//chrome/renderer", diff --git a/apps/app_restore_service.cc b/apps/app_restore_service.cc index b077266..7388cdc1 100644 --- a/apps/app_restore_service.cc +++ b/apps/app_restore_service.cc @@ -7,7 +7,6 @@ #include "apps/app_lifetime_monitor_factory.h" #include "apps/app_restore_service_factory.h" #include "apps/app_window.h" -#include "apps/browser/api/app_runtime/app_runtime_api.h" #include "apps/launcher.h" #include "apps/saved_files_service.h" #include "chrome/browser/chrome_notification_types.h" diff --git a/apps/apps.gypi b/apps/apps.gypi index e2b4e7e..f52151a 100644 --- a/apps/apps.gypi +++ b/apps/apps.gypi @@ -16,7 +16,6 @@ 'dependencies': [ 'browser_extensions', 'common/extensions/api/api.gyp:chrome_api', - '../apps/common/api/api.gyp:apps_api', '../skia/skia.gyp:skia', ], 'include_dirs': [ @@ -48,10 +47,6 @@ 'apps_client.h', 'browser_context_keyed_service_factories.cc', 'browser_context_keyed_service_factories.h', - 'browser/api/app_runtime/app_runtime_api.cc', - 'browser/api/app_runtime/app_runtime_api.h', - 'browser/file_handler_util.cc', - 'browser/file_handler_util.h', 'launcher.cc', 'launcher.h', 'metrics_names.h', diff --git a/apps/browser/file_handler_util.cc b/apps/browser/file_handler_util.cc deleted file mode 100644 index 073760a..0000000 --- a/apps/browser/file_handler_util.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 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 "apps/browser/file_handler_util.h" - -namespace apps { -namespace file_handler_util { - -GrantedFileEntry::GrantedFileEntry() {} - -GrantedFileEntry::~GrantedFileEntry() {} - -} // namespace file_handler_util -} // namespace apps diff --git a/apps/common/api/BUILD.gn b/apps/common/api/BUILD.gn deleted file mode 100644 index a1cf00b..0000000 --- a/apps/common/api/BUILD.gn +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2014 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("//extensions/generated_extensions_api.gni") - -# GYP version: apps/common/api/api.gyp:apps_api -generated_extensions_api("apps_api") { - sources = [ - "app_runtime.idl", - ] - root_namespace = "apps::api" - impl_dir = "//apps/browser/api" -} diff --git a/apps/common/api/api.gyp b/apps/common/api/api.gyp deleted file mode 100644 index 61f7431..0000000 --- a/apps/common/api/api.gyp +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2014 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. - -{ - 'targets': [ - { - # GN version: //apps/common/api:apps_api - 'target_name': 'apps_api', - 'type': 'static_library', - 'sources': [ - '<@(schema_files)', - ], - # TODO(jschuh): http://crbug.com/167187 size_t -> int - 'msvs_disabled_warnings': [ 4267 ], - 'includes': [ - '../../../build/json_schema_bundle_compile.gypi', - '../../../build/json_schema_compile.gypi', - ], - 'variables': { - 'chromium_code': 1, - 'non_compiled_schema_files': [ - ], - # TODO: Eliminate these on Android. See crbug.com/305852. - 'schema_files': [ - 'app_runtime.idl', - ], - 'cc_dir': 'apps/common/api', - 'root_namespace': 'apps::api', - 'impl_dir': 'apps/browser/api', - }, - 'dependencies': [ - # None yet, but some may need to be added as more APIs move in. - ], - }, - ], -} diff --git a/apps/launcher.cc b/apps/launcher.cc index 72ed788..7d700a6 100644 --- a/apps/launcher.cc +++ b/apps/launcher.cc @@ -4,9 +4,6 @@ #include "apps/launcher.h" -#include "apps/browser/api/app_runtime/app_runtime_api.h" -#include "apps/browser/file_handler_util.h" -#include "apps/common/api/app_runtime.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/files/file_path.h" @@ -22,12 +19,15 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" +#include "extensions/browser/api/app_runtime/app_runtime_api.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/granted_file_entry.h" #include "extensions/browser/lazy_background_task_queue.h" #include "extensions/browser/process_manager.h" +#include "extensions/common/api/app_runtime.h" #include "extensions/common/extension.h" #include "extensions/common/extension_messages.h" #include "extensions/common/manifest_handlers/kiosk_mode_info.h" @@ -42,20 +42,21 @@ #include "chrome/browser/chromeos/login/users/user_manager.h" #endif -namespace app_runtime = apps::api::app_runtime; +namespace app_runtime = extensions::core_api::app_runtime; -using apps::file_handler_util::GrantedFileEntry; using content::BrowserThread; -using extensions::app_file_handler_util::PrepareFilesForWritableApp; -using extensions::app_file_handler_util::FileHandlerForId; +using extensions::AppRuntimeEventRouter; +using extensions::app_file_handler_util::CreateFileEntry; using extensions::app_file_handler_util::FileHandlerCanHandleFile; +using extensions::app_file_handler_util::FileHandlerForId; using extensions::app_file_handler_util::FirstFileHandlerForFile; -using extensions::app_file_handler_util::CreateFileEntry; using extensions::app_file_handler_util::HasFileSystemWritePermission; +using extensions::app_file_handler_util::PrepareFilesForWritableApp; using extensions::EventRouter; using extensions::Extension; using extensions::ExtensionHost; using extensions::ExtensionSystem; +using extensions::GrantedFileEntry; namespace apps { @@ -86,7 +87,7 @@ bool DoMakePathAbsolute(const base::FilePath& current_directory, // load or obtain file launch data. void LaunchPlatformAppWithNoData(Profile* profile, const Extension* extension) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - AppEventRouter::DispatchOnLaunchedEvent(profile, extension); + AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, extension); } // Class to handle launching of platform apps to open specific paths. @@ -366,7 +367,7 @@ class PlatformAppPathLauncher false)); } - AppEventRouter::DispatchOnLaunchedEventWithFileEntries( + AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries( profile_, extension_, handler_id_, mime_types_, file_entries); } @@ -464,7 +465,7 @@ void RestartPlatformApp(Profile* profile, const Extension* extension) { app_runtime::OnRestarted::kEventName); if (listening_to_restart) { - AppEventRouter::DispatchOnRestartedEvent(profile, extension); + AppRuntimeEventRouter::DispatchOnRestartedEvent(profile, extension); return; } @@ -485,7 +486,7 @@ void LaunchPlatformAppWithUrl(Profile* profile, const std::string& handler_id, const GURL& url, const GURL& referrer_url) { - AppEventRouter::DispatchOnLaunchedEventWithUrl( + AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( profile, extension, handler_id, url, referrer_url); } diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index 3c6c946..d3ce62c 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc @@ -4,7 +4,6 @@ #include "apps/app_window.h" #include "apps/app_window_registry.h" -#include "apps/common/api/app_runtime.h" #include "apps/launcher.h" #include "apps/ui/native_app_window.h" #include "base/bind.h" @@ -43,6 +42,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/pref_names.h" +#include "extensions/common/api/app_runtime.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "url/gurl.h" @@ -60,7 +60,7 @@ using apps::AppWindowRegistry; using content::WebContents; using web_modal::WebContentsModalDialogManager; -namespace app_runtime = apps::api::app_runtime; +namespace app_runtime = extensions::core_api::app_runtime; namespace extensions { diff --git a/chrome/browser/apps/app_launch_for_metro_restart_win.cc b/chrome/browser/apps/app_launch_for_metro_restart_win.cc index ea82b28..2002d78 100644 --- a/chrome/browser/apps/app_launch_for_metro_restart_win.cc +++ b/chrome/browser/apps/app_launch_for_metro_restart_win.cc @@ -4,7 +4,6 @@ #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" -#include "apps/browser/api/app_runtime/app_runtime_api.h" #include "apps/launcher.h" #include "apps/pref_names.h" #include "base/bind.h" @@ -18,8 +17,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" +#include "extensions/browser/api/app_runtime/app_runtime_api.h" #include "extensions/browser/extension_system.h" +using extensions::AppRuntimeEventRouter; using extensions::Extension; using extensions::ExtensionSystem; @@ -39,7 +40,7 @@ void LaunchAppWithId(Profile* profile, if (!extension) return; - apps::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); + AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, extension); } } // namespace diff --git a/chrome/browser/extensions/DEPS b/chrome/browser/extensions/DEPS index b603eef..b4ab256 100644 --- a/chrome/browser/extensions/DEPS +++ b/chrome/browser/extensions/DEPS @@ -16,11 +16,3 @@ include_rules = [ # For access to testing command line switches. "+ppapi/shared_impl", ] - -specific_include_rules = { - # The extensions client interface is the master arbiter of which - # API functions exist, so it needs to know about app APIs. - "chrome_extensions_browser_client\.cc": [ - "+apps/common/api/generated_api.h", - ], -} diff --git a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc index 91b24c5..dd6b81d 100644 --- a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc +++ b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc @@ -4,7 +4,6 @@ #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" -#include "apps/browser/file_handler_util.h" #include "base/file_util.h" #include "base/files/file.h" #include "base/files/file_path.h" @@ -12,6 +11,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_process_host.h" #include "extensions/browser/extension_prefs.h" +#include "extensions/browser/granted_file_entry.h" #include "extensions/common/permissions/permissions_data.h" #include "net/base/mime_util.h" #include "webkit/browser/fileapi/isolated_context.h" @@ -22,8 +22,6 @@ #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" #endif -using apps::file_handler_util::GrantedFileEntry; - namespace extensions { namespace app_file_handler_util { diff --git a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.h b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.h index ef43bbf..e39d941 100644 --- a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.h +++ b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.h @@ -16,14 +16,10 @@ class Profile; -namespace apps { -namespace file_handler_util { -struct GrantedFileEntry; -} -} - namespace extensions { + class ExtensionPrefs; +struct GrantedFileEntry; // TODO(benwells): move this to platform_apps namespace. namespace app_file_handler_util { @@ -59,12 +55,11 @@ bool FileHandlerCanHandleFile( // Creates a new file entry and allows |renderer_id| to access |path|. This // registers a new file system for |path|. -apps::file_handler_util::GrantedFileEntry CreateFileEntry( - Profile* profile, - const Extension* extension, - int renderer_id, - const base::FilePath& path, - bool is_directory); +GrantedFileEntry CreateFileEntry(Profile* profile, + const Extension* extension, + int renderer_id, + const base::FilePath& path, + bool is_directory); // When |is_directory| is true, it verifies that directories exist at each of // the |paths| and calls back to |on_success| or otherwise to |on_failure|. diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index ddec04b..18943bc 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -6,7 +6,6 @@ #include "apps/app_window.h" #include "apps/app_window_registry.h" -#include "apps/browser/file_handler_util.h" #include "apps/saved_files_service.h" #include "base/bind.h" #include "base/file_util.h" @@ -34,6 +33,7 @@ #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/granted_file_entry.h" #include "extensions/common/permissions/api_permission.h" #include "extensions/common/permissions/permissions_data.h" #include "grit/generated_resources.h" @@ -324,13 +324,12 @@ void FileSystemEntryFunction::AddEntryToResponse( const base::FilePath& path, const std::string& id_override) { DCHECK(response_); - apps::file_handler_util::GrantedFileEntry file_entry = - extensions::app_file_handler_util::CreateFileEntry( - GetProfile(), - GetExtension(), - render_view_host_->GetProcess()->GetID(), - path, - is_directory_); + GrantedFileEntry file_entry = app_file_handler_util::CreateFileEntry( + GetProfile(), + GetExtension(), + render_view_host_->GetProcess()->GetID(), + path, + is_directory_); base::ListValue* entries; bool success = response_->GetList("entries", &entries); DCHECK(success); diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index 938ca29..dc7cfaf 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc @@ -4,7 +4,6 @@ #include "chrome/browser/extensions/chrome_extensions_browser_client.h" -#include "apps/common/api/generated_api.h" #include "base/command_line.h" #include "base/path_service.h" #include "base/version.h" @@ -265,7 +264,6 @@ void ChromeExtensionsBrowserClient::RegisterExtensionFunctions( // Generated APIs from lower-level modules. extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); - apps::api::GeneratedFunctionRegistry::RegisterAll(registry); // Generated APIs from Chrome. extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 3483642f..f28a066 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -29,7 +29,6 @@ 'safe_browsing_proto', 'sync_file_system_proto', '../third_party/re2/re2.gyp:re2', - '../apps/common/api/api.gyp:apps_api', '../components/components.gyp:onc_component', '../components/components.gyp:url_matcher', '../components/components_strings.gyp:components_strings', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 4125a86..665ec7f 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -348,7 +348,6 @@ }], ['OS != "ios"', { 'dependencies': [ - '<(DEPTH)/apps/common/api/api.gyp:apps_api', '<(DEPTH)/chrome/common/extensions/api/api.gyp:chrome_api', '<(DEPTH)/components/components.gyp:autofill_core_common', '<(DEPTH)/components/components.gyp:autofill_content_common', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 49d2186..10fd5a1 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -799,7 +799,6 @@ 'test/perf/perf_test.gyp:*', 'test_support_common', 'test_support_sync_integration', - '../apps/common/api/api.gyp:apps_api', '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../base/base.gyp:test_support_base', diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index bd9f733..2b74304 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn @@ -64,7 +64,6 @@ static_library("common") { if (!is_ios) { deps += [ - "//apps/common/api:apps_api", "//chrome/common/extensions/api", #'<(DEPTH)/components/components.gyp:autofill_core_common', TODO(GYP) #'<(DEPTH)/components/components.gyp:autofill_content_common', TODO(GYP) diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index fd83c02..6b80340 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json @@ -59,23 +59,6 @@ "http://*/*", "https://*/*", "chrome-extension://*/*", "file://*/*" ] }, - "app.runtime": [{ - "channel": "stable", - "contexts": ["blessed_extension"], - "extension_types": ["platform_app"], - "noparent": true - }, { - "channel": "stable", - "component_extensions_auto_granted": false, - "contexts": ["blessed_extension"], - "extension_types": ["extension"], - "noparent": true, - "whitelist": [ - "2FC374607C2DF285634B67C64A2E356C607091C3", // Quickoffice - "3727DD3E564B6055387425027AD74C58784ACC15", // Quickoffice internal - "12E618C3C6E97495AAECF2AC12DEB082353241C6" // QO component extension - ] - }], "app.window": { "channel": "stable", "contexts": ["blessed_extension"], diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 6009076..d668b1b 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -4,7 +4,6 @@ #include "chrome/common/extensions/chrome_extensions_client.h" -#include "apps/common/api/generated_schemas.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/extensions/api/generated_schemas.h" #include "chrome/common/extensions/chrome_manifest_handlers.h" @@ -217,8 +216,7 @@ bool ChromeExtensionsClient::IsAPISchemaGenerated( const std::string& name) const { // Test from most common to least common. return api::GeneratedSchemas::IsGenerated(name) || - core_api::GeneratedSchemas::IsGenerated(name) || - apps::api::GeneratedSchemas::IsGenerated(name); + core_api::GeneratedSchemas::IsGenerated(name); } base::StringPiece ChromeExtensionsClient::GetAPISchema( @@ -227,10 +225,7 @@ base::StringPiece ChromeExtensionsClient::GetAPISchema( if (api::GeneratedSchemas::IsGenerated(name)) return api::GeneratedSchemas::Get(name); - if (core_api::GeneratedSchemas::IsGenerated(name)) - return core_api::GeneratedSchemas::Get(name); - - return apps::api::GeneratedSchemas::Get(name); + return core_api::GeneratedSchemas::Get(name); } void ChromeExtensionsClient::RegisterAPISchemaResources( diff --git a/apps/browser/api/app_runtime/app_runtime_api.cc b/extensions/browser/api/app_runtime/app_runtime_api.cc index 68be588..cb93a85 100644 --- a/apps/browser/api/app_runtime/app_runtime_api.cc +++ b/extensions/browser/api/app_runtime/app_runtime_api.cc @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "apps/browser/api/app_runtime/app_runtime_api.h" +#include "extensions/browser/api/app_runtime/app_runtime_api.h" -#include "apps/browser/file_handler_util.h" -#include "apps/common/api/app_runtime.h" #include "base/time/time.h" #include "base/values.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/granted_file_entry.h" +#include "extensions/common/api/app_runtime.h" #include "url/gurl.h" using content::BrowserContext; -using extensions::Event; -using extensions::Extension; -using extensions::ExtensionPrefs; -namespace apps { +namespace extensions { -namespace app_runtime = api::app_runtime; +namespace app_runtime = core_api::app_runtime; namespace { @@ -30,47 +27,49 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id, // "Forced app mode" is true for Chrome OS kiosk mode. launch_data->SetBoolean( "isKioskSession", - extensions::ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode()); + ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode()); scoped_ptr<base::ListValue> args(new base::ListValue()); args->Append(launch_data.release()); scoped_ptr<Event> event( new Event(app_runtime::OnLaunched::kEventName, args.Pass())); event->restrict_to_browser_context = context; event->can_load_ephemeral_apps = true; - extensions::EventRouter::Get(context) + EventRouter::Get(context) ->DispatchEventWithLazyListener(extension_id, event.Pass()); ExtensionPrefs::Get(context) ->SetLastLaunchTime(extension_id, base::Time::Now()); } -} // anonymous namespace +} // namespace -// static. -void AppEventRouter::DispatchOnLaunchedEvent(BrowserContext* context, - const Extension* extension) { +// static +void AppRuntimeEventRouter::DispatchOnLaunchedEvent( + BrowserContext* context, + const Extension* extension) { scoped_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue()); DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), context); } -// static. -void AppEventRouter::DispatchOnRestartedEvent(BrowserContext* context, - const Extension* extension) { +// static +void AppRuntimeEventRouter::DispatchOnRestartedEvent( + BrowserContext* context, + const Extension* extension) { scoped_ptr<base::ListValue> arguments(new base::ListValue()); scoped_ptr<Event> event( new Event(app_runtime::OnRestarted::kEventName, arguments.Pass())); event->restrict_to_browser_context = context; event->can_load_ephemeral_apps = true; - extensions::EventRouter::Get(context) + EventRouter::Get(context) ->DispatchEventToExtension(extension->id(), event.Pass()); } -// static. -void AppEventRouter::DispatchOnLaunchedEventWithFileEntries( +// static +void AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries( BrowserContext* context, const Extension* extension, const std::string& handler_id, const std::vector<std::string>& mime_types, - const std::vector<file_handler_util::GrantedFileEntry>& file_entries) { + const std::vector<GrantedFileEntry>& file_entries) { // TODO(sergeygs): Use the same way of creating an event (using the generated // boilerplate) as below in DispatchOnLaunchedEventWithUrl. scoped_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue); @@ -89,14 +88,14 @@ void AppEventRouter::DispatchOnLaunchedEventWithFileEntries( DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), context); } -// static. -void AppEventRouter::DispatchOnLaunchedEventWithUrl( +// static +void AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( BrowserContext* context, const Extension* extension, const std::string& handler_id, const GURL& url, const GURL& referrer_url) { - api::app_runtime::LaunchData launch_data; + app_runtime::LaunchData launch_data; launch_data.id.reset(new std::string(handler_id)); launch_data.url.reset(new std::string(url.spec())); launch_data.referrer_url.reset(new std::string(referrer_url.spec())); @@ -104,4 +103,4 @@ void AppEventRouter::DispatchOnLaunchedEventWithUrl( extension->id(), launch_data.ToValue().Pass(), context); } -} // namespace apps +} // namespace extensions diff --git a/apps/browser/api/app_runtime/app_runtime_api.h b/extensions/browser/api/app_runtime/app_runtime_api.h index 6853696..c2d59fc 100644 --- a/apps/browser/api/app_runtime/app_runtime_api.h +++ b/extensions/browser/api/app_runtime/app_runtime_api.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ -#define APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ +#ifndef EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ +#define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ #include <string> #include <vector> @@ -16,25 +16,20 @@ class WebContents; } namespace extensions { -class Extension; -} -namespace apps { - -namespace file_handler_util { +class Extension; struct GrantedFileEntry; -} -class AppEventRouter { +class AppRuntimeEventRouter { public: // Dispatches the onLaunched event to the given app. static void DispatchOnLaunchedEvent(content::BrowserContext* context, - const extensions::Extension* extension); + const Extension* extension); // Dispatches the onRestarted event to the given app, providing a list of // restored file entries from the previous run. static void DispatchOnRestartedEvent(content::BrowserContext* context, - const extensions::Extension* extension); + const Extension* extension); // TODO(benwells): Update this comment, it is out of date. // Dispatches the onLaunched event to the given app, providing launch data of @@ -53,21 +48,20 @@ class AppEventRouter { // manifest that resulted in a match which triggered this launch. static void DispatchOnLaunchedEventWithFileEntries( content::BrowserContext* context, - const extensions::Extension* extension, + const Extension* extension, const std::string& handler_id, const std::vector<std::string>& mime_types, - const std::vector<file_handler_util::GrantedFileEntry>& file_entries); + const std::vector<GrantedFileEntry>& file_entries); // |handler_id| corresponds to the id of the url_handlers item // in the manifest that resulted in a match which triggered this launch. - static void DispatchOnLaunchedEventWithUrl( - content::BrowserContext* context, - const extensions::Extension* extension, - const std::string& handler_id, - const GURL& url, - const GURL& referrer_url); + static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, + const Extension* extension, + const std::string& handler_id, + const GURL& url, + const GURL& referrer_url); }; -} // namespace apps +} // namespace extensions -#endif // APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ +#endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ diff --git a/extensions/browser/granted_file_entry.cc b/extensions/browser/granted_file_entry.cc new file mode 100644 index 0000000..b1874e0 --- /dev/null +++ b/extensions/browser/granted_file_entry.cc @@ -0,0 +1,15 @@ +// Copyright 2014 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 "extensions/browser/granted_file_entry.h" + +namespace extensions { + +GrantedFileEntry::GrantedFileEntry() { +} + +GrantedFileEntry::~GrantedFileEntry() { +} + +} // namespace extension diff --git a/apps/browser/file_handler_util.h b/extensions/browser/granted_file_entry.h index 1d0cfa3..97755ba 100644 --- a/apps/browser/file_handler_util.h +++ b/extensions/browser/granted_file_entry.h @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef APPS_BROWSER_FILE_HANDLER_UTIL_H_ -#define APPS_BROWSER_FILE_HANDLER_UTIL_H_ +#ifndef EXTENSIONS_BROWSER_GRANTED_FILE_ENTRY_H_ +#define EXTENSIONS_BROWSER_GRANTED_FILE_ENTRY_H_ #include <string> -namespace apps { -namespace file_handler_util { +namespace extensions { // Refers to a file entry that a renderer has been given access to. struct GrantedFileEntry { @@ -20,7 +19,6 @@ struct GrantedFileEntry { std::string registered_name; }; -} // namespace file_handler_util -} // namespace apps +} // namespace extensions -#endif // APPS_BROWSER_FILE_HANDLER_UTIL_H_ +#endif // EXTENSIONS_BROWSER_GRANTED_FILE_ENTRY_H_ diff --git a/extensions/common/api/BUILD.gn b/extensions/common/api/BUILD.gn index 8ece118..b4321de6 100644 --- a/extensions/common/api/BUILD.gn +++ b/extensions/common/api/BUILD.gn @@ -6,6 +6,7 @@ import("//extensions/generated_extensions_api.gni") generated_extensions_api("extensions_api") { sources = [ + "app_runtime.idl", "dns.idl", "extensions_manifest_types.json", "socket.idl", diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json index c415da8..084428e 100644 --- a/extensions/common/api/_api_features.json +++ b/extensions/common/api/_api_features.json @@ -19,6 +19,23 @@ // hashes back to ids. { + "app.runtime": [{ + "channel": "stable", + "contexts": ["blessed_extension"], + "extension_types": ["platform_app"], + "noparent": true + }, { + "channel": "stable", + "component_extensions_auto_granted": false, + "contexts": ["blessed_extension"], + "extension_types": ["extension"], + "noparent": true, + "whitelist": [ + "2FC374607C2DF285634B67C64A2E356C607091C3", // Quickoffice + "3727DD3E564B6055387425027AD74C58784ACC15", // Quickoffice internal + "12E618C3C6E97495AAECF2AC12DEB082353241C6" // QO component extension + ] + }], "dns": { "dependencies": ["permission:dns"], "contexts": ["blessed_extension"] diff --git a/extensions/common/api/api.gyp b/extensions/common/api/api.gyp index cd623d8..cfb880f 100644 --- a/extensions/common/api/api.gyp +++ b/extensions/common/api/api.gyp @@ -23,6 +23,7 @@ 'conditions': [ ['enable_extensions==1', { 'schema_files': [ + 'app_runtime.idl', 'dns.idl', 'extensions_manifest_types.json', 'runtime.json', diff --git a/apps/common/api/app_runtime.idl b/extensions/common/api/app_runtime.idl index b094c98..b094c98 100644 --- a/apps/common/api/app_runtime.idl +++ b/extensions/common/api/app_runtime.idl diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 9d195fa..d4cd8d7 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -255,6 +255,8 @@ 'browser/api/api_resource.cc', 'browser/api/api_resource.h', 'browser/api/api_resource_manager.h', + 'browser/api/app_runtime/app_runtime_api.cc', + 'browser/api/app_runtime/app_runtime_api.h', 'browser/api/async_api_function.cc', 'browser/api/async_api_function.h', 'browser/api/dns/dns_api.cc', @@ -387,6 +389,8 @@ 'browser/extensions_browser_client.cc', 'browser/extensions_browser_client.h', 'browser/external_provider_interface.h', + 'browser/granted_file_entry.cc', + 'browser/granted_file_entry.h', 'browser/image_loader.cc', 'browser/image_loader.h', 'browser/image_loader_factory.cc', |