diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-31 01:54:38 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-31 01:54:38 +0000 |
commit | e3a8ebb9866a207a123d7a5f165d35c2f7019b7d (patch) | |
tree | 590cb6c1e3af05fceeaab487c041b17e09cf4d66 /chrome | |
parent | 64304a7356d23cbbe30cc7a61d2a63cc4de90990 (diff) | |
download | chromium_src-e3a8ebb9866a207a123d7a5f165d35c2f7019b7d.zip chromium_src-e3a8ebb9866a207a123d7a5f165d35c2f7019b7d.tar.gz chromium_src-e3a8ebb9866a207a123d7a5f165d35c2f7019b7d.tar.bz2 |
Introduce apps API target in //apps and move app.runtime API into it
This breaks a dependency from //apps onto //chrome, getting us closer to
an app_shell build that does not include chrome.
* Introduce apps/browser/api and apps/common/api to mirror extensions.
* Introduce an apps_api build target.
* Hook up schema and function registration in chrome and app_shell.
* Move app_runtime_api.h/cc into //apps and switch to apps namespace.
* Eliminate AppEventRouter dependencies on Chrome:
** Use ExtensionsBrowserClient to determine if we're in kiosk mode.
** Introduce apps::file_handler_util for GrantedFileEntry (anticipating
more code from app_file_handler_util to move there in the future).
BUG=357818
TEST=browser_tests *PlatformApp*
Review URL: https://codereview.chromium.org/217533006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/apps/app_browsertest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/apps/app_launch_for_metro_restart_win.cc | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/DEPS | 8 | ||||
-rw-r--r-- | chrome/browser/extensions/api/app_runtime/app_runtime_api.cc | 110 | ||||
-rw-r--r-- | chrome/browser/extensions/api/app_runtime/app_runtime_api.h | 69 | ||||
-rw-r--r-- | chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc | 5 | ||||
-rw-r--r-- | chrome/browser/extensions/api/file_handlers/app_file_handler_util.h | 17 | ||||
-rw-r--r-- | chrome/browser/extensions/api/file_system/file_system_api.cc | 3 | ||||
-rw-r--r-- | chrome/browser/extensions/chrome_extensions_browser_client.cc | 6 | ||||
-rw-r--r-- | chrome/chrome_browser_extensions.gypi | 3 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 3 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 | ||||
-rw-r--r-- | chrome/common/extensions/DEPS | 8 | ||||
-rw-r--r-- | chrome/common/extensions/api/api.gyp | 2 | ||||
-rw-r--r-- | chrome/common/extensions/api/app_runtime.idl | 53 | ||||
-rw-r--r-- | chrome/common/extensions/chrome_extensions_client.cc | 12 |
16 files changed, 52 insertions, 258 deletions
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index 10c6636c..da15e6f 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc @@ -4,6 +4,7 @@ #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" @@ -29,7 +30,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/api/app_runtime.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/test_switches.h" @@ -61,9 +61,9 @@ using apps::AppWindowRegistry; using content::WebContents; using web_modal::WebContentsModalDialogManager; -namespace extensions { +namespace app_runtime = apps::api::app_runtime; -namespace app_runtime = api::app_runtime; +namespace extensions { namespace { 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 f4e8a1d..50c3ce8 100644 --- a/chrome/browser/apps/app_launch_for_metro_restart_win.cc +++ b/chrome/browser/apps/app_launch_for_metro_restart_win.cc @@ -4,6 +4,7 @@ #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" @@ -13,7 +14,6 @@ #include "base/prefs/pref_service.h" #include "base/time/time.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -40,7 +40,7 @@ void LaunchAppWithId(Profile* profile, if (!extension) return; - extensions::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); + apps::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); } } // namespace diff --git a/chrome/browser/extensions/DEPS b/chrome/browser/extensions/DEPS index b4ab256..b603eef 100644 --- a/chrome/browser/extensions/DEPS +++ b/chrome/browser/extensions/DEPS @@ -16,3 +16,11 @@ 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/app_runtime/app_runtime_api.cc b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc deleted file mode 100644 index ff40876..0000000 --- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc +++ /dev/null @@ -1,110 +0,0 @@ -// 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/extensions/api/app_runtime/app_runtime_api.h" - -#include "base/time/time.h" -#include "base/values.h" -#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" -#include "chrome/common/extensions/api/app_runtime.h" -#include "extensions/browser/event_router.h" -#include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_system.h" -#include "extensions/common/extension.h" -#include "url/gurl.h" - -#if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/login/user_manager.h" -#endif - -using content::BrowserContext; - -namespace extensions { - -namespace app_runtime = api::app_runtime; - -namespace { - -void DispatchOnLaunchedEventImpl(const std::string& extension_id, - scoped_ptr<base::DictionaryValue> launch_data, - BrowserContext* context) { -#if defined(OS_CHROMEOS) - launch_data->SetBoolean("isKioskSession", - chromeos::UserManager::Get()->IsLoggedInAsKioskApp()); -#else - launch_data->SetBoolean("isKioskSession", false); -#endif - scoped_ptr<base::ListValue> args(new base::ListValue()); - args->Append(launch_data.release()); - ExtensionSystem* system = ExtensionSystem::Get(context); - scoped_ptr<Event> event(new Event(app_runtime::OnLaunched::kEventName, - args.Pass())); - event->restrict_to_browser_context = context; - event->can_load_ephemeral_apps = true; - system->event_router()->DispatchEventWithLazyListener(extension_id, - event.Pass()); - ExtensionPrefs::Get(context) - ->SetLastLaunchTime(extension_id, base::Time::Now()); -} - -} // anonymous namespace - -// static. -void AppEventRouter::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) { - 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::ExtensionSystem::Get(context) - ->event_router() - ->DispatchEventToExtension(extension->id(), event.Pass()); -} - -// static. -void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( - BrowserContext* context, - const Extension* extension, - const std::string& handler_id, - const std::string& mime_type, - const extensions::app_file_handler_util::GrantedFileEntry& file_entry) { - // 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); - launch_data->SetString("id", handler_id); - scoped_ptr<base::DictionaryValue> launch_item(new base::DictionaryValue); - launch_item->SetString("fileSystemId", file_entry.filesystem_id); - launch_item->SetString("baseName", file_entry.registered_name); - launch_item->SetString("mimeType", mime_type); - launch_item->SetString("entryId", file_entry.id); - scoped_ptr<base::ListValue> items(new base::ListValue); - items->Append(launch_item.release()); - launch_data->Set("items", items.release()); - DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), context); -} - -// static. -void AppEventRouter::DispatchOnLaunchedEventWithUrl( - BrowserContext* context, - const Extension* extension, - const std::string& handler_id, - const GURL& url, - const GURL& referrer_url) { - api::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())); - DispatchOnLaunchedEventImpl( - extension->id(), launch_data.ToValue().Pass(), context); -} - -} // namespace extensions diff --git a/chrome/browser/extensions/api/app_runtime/app_runtime_api.h b/chrome/browser/extensions/api/app_runtime/app_runtime_api.h deleted file mode 100644 index c34e0a9..0000000 --- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.h +++ /dev/null @@ -1,69 +0,0 @@ -// 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_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ - -#include <string> - -class GURL; - -namespace content { -class BrowserContext; -class WebContents; -} - -namespace extensions { - -class Extension; - -namespace app_file_handler_util { -struct GrantedFileEntry; -} - -class AppEventRouter { - public: - // Dispatches the onLaunched event to the given app. - static void DispatchOnLaunchedEvent(content::BrowserContext* context, - 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 Extension* extension); - - // TODO(benwells): Update this comment, it is out of date. - // Dispatches the onLaunched event to the given app, providing launch data of - // the form: - // { - // "intent" : { - // "type" : "chrome-extension://fileentry", - // "data" : a FileEntry, - // "postResults" : a null function, - // "postFailure" : a null function - // } - // } - - // The FileEntry is created from |file_system_id| and |base_name|. - // |handler_id| corresponds to the id of the file_handlers item in the - // manifest that resulted in a match which triggered this launch. - static void DispatchOnLaunchedEventWithFileEntry( - content::BrowserContext* context, - const Extension* extension, - const std::string& handler_id, - const std::string& mime_type, - const extensions::app_file_handler_util::GrantedFileEntry& file_entry); - - // |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 Extension* extension, - const std::string& handler_id, - const GURL& url, - const GURL& referrer_url); -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_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 2cea377..d27ccac 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,6 +4,7 @@ #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" @@ -20,6 +21,8 @@ #include "chrome/browser/chromeos/drive/file_system_util.h" #endif +using apps::file_handler_util::GrantedFileEntry; + namespace extensions { namespace app_file_handler_util { @@ -348,8 +351,6 @@ void CheckWritableFiles( checker->Check(); } -GrantedFileEntry::GrantedFileEntry() {} - bool HasFileSystemWritePermission(const Extension* extension) { return extension->HasAPIPermission(APIPermission::kFileSystemWrite); } 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 4dd7300..14bd11c 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,6 +16,12 @@ class Profile; +namespace apps { +namespace file_handler_util { +struct GrantedFileEntry; +} +} + namespace extensions { class ExtensionPrefs; @@ -51,18 +57,9 @@ bool FileHandlerCanHandleFile( const std::string& mime_type, const base::FilePath& path); -// Refers to a file entry that a renderer has been given access to. -struct GrantedFileEntry { - GrantedFileEntry(); - - std::string id; - std::string filesystem_id; - std::string registered_name; -}; - // Creates a new file entry and allows |renderer_id| to access |path|. This // registers a new file system for |path|. -GrantedFileEntry CreateFileEntry( +apps::file_handler_util::GrantedFileEntry CreateFileEntry( Profile* profile, const Extension* extension, int renderer_id, 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 2e4d2e2..cff70ff 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -6,6 +6,7 @@ #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" @@ -322,7 +323,7 @@ void FileSystemEntryFunction::AddEntryToResponse( const base::FilePath& path, const std::string& id_override) { DCHECK(response_); - extensions::app_file_handler_util::GrantedFileEntry file_entry = + apps::file_handler_util::GrantedFileEntry file_entry = extensions::app_file_handler_util::CreateFileEntry( GetProfile(), GetExtension(), diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index 88d497f..67d76bd 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/chrome_extensions_browser_client.h" +#include "apps/common/api/generated_api.h" #include "base/command_line.h" #include "base/version.h" #include "chrome/browser/app_mode/app_mode_utils.h" @@ -228,8 +229,11 @@ void ChromeExtensionsBrowserClient::RegisterExtensionFunctions( registry->RegisterFunction< extensions::chromedirectsetting::ClearDirectSettingFunction>(); - // Generated APIs. + // 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); #endif } diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 6b36a4c..3039efc 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -29,6 +29,7 @@ '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.gyp:wifi_component', @@ -126,8 +127,6 @@ 'browser/extensions/api/alarms/alarms_api.h', 'browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc', 'browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h', - 'browser/extensions/api/app_runtime/app_runtime_api.cc', - 'browser/extensions/api/app_runtime/app_runtime_api.h', 'browser/extensions/api/app_window/app_window_api.cc', 'browser/extensions/api/app_window/app_window_api.h', 'browser/extensions/api/audio/audio_api.cc', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index de0b25a..4c2821e 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -392,7 +392,7 @@ }], ['OS != "ios"', { 'dependencies': [ - '<(DEPTH)/third_party/re2/re2.gyp:re2', + '<(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', @@ -404,6 +404,7 @@ '<(DEPTH)/extensions/extensions.gyp:extensions_common', '<(DEPTH)/ipc/ipc.gyp:ipc', '<(DEPTH)/third_party/adobe/flash/flash_player.gyp:flapper_version_h', + '<(DEPTH)/third_party/re2/re2.gyp:re2', '<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'export_dependent_settings': [ diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 61b6c1b..d0f287b 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -875,6 +875,7 @@ '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/extensions/DEPS b/chrome/common/extensions/DEPS index cce9b4d..cf4620f 100644 --- a/chrome/common/extensions/DEPS +++ b/chrome/common/extensions/DEPS @@ -6,3 +6,11 @@ include_rules = [ "+ppapi/c", # For various types. "+skia", ] + +specific_include_rules = { + # The extensions client interface is the master arbiter of which + # API schemas exist, so it needs to know about app APIs. + "chrome_extensions_client\.cc": [ + "+apps/common/api/generated_schemas.h", + ], +} diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp index fdfc3e7..4cb70de 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -38,7 +38,6 @@ 'activity_log_private.json', 'alarms.idl', 'app_current_window_internal.idl', - 'app_runtime.idl', 'app_window.idl', 'audio.idl', 'automation_internal.idl', @@ -133,7 +132,6 @@ # These should be eliminated. See crbug.com/305852. 'activity_log_private.json', 'alarms.idl', - 'app_runtime.idl', 'app_window.idl', 'context_menus.json', 'downloads.idl', diff --git a/chrome/common/extensions/api/app_runtime.idl b/chrome/common/extensions/api/app_runtime.idl deleted file mode 100644 index b1bd050..0000000 --- a/chrome/common/extensions/api/app_runtime.idl +++ /dev/null @@ -1,53 +0,0 @@ -// 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. - -// Use the <code>chrome.app.runtime</code> API to manage the app lifecycle. -// The app runtime manages app installation, controls the event page, and can -// shut down the app at anytime. -namespace app.runtime { - - [inline_doc] dictionary LaunchItem { - // FileEntry for the file. - [instanceOf=FileEntry] object entry; - - // The MIME type of the file. - DOMString type; - }; - - // Optional data for the launch. Either <code>items</code>, or - // the pair (<code>url, referrerUrl</code>) can be present for any given - // launch. - [inline_doc] dictionary LaunchData { - // The ID of the file or URL handler that the app is being invoked with. - // Handler IDs are the top-level keys in the <code>file_handlers</code> - // and/or <code>url_handlers</code> dictionaries in the manifest. - DOMString? id; - - // The file entries for the <code>onLaunched</code> event triggered by a - // matching file handler in the <code>file_handlers</code> manifest key. - LaunchItem[]? items; - - // The URL for the <code>onLaunched</code> event triggered by a matching - // URL handler in the <code>url_handlers</code> manifest key. - DOMString? url; - - // The referrer URL for the <code>onLaunched</code> event triggered by a - // matching URL handler in the <code>url_handlers</code> manifest key. - DOMString? referrerUrl; - - // Whether the app is being launched in a <a - // href="https://support.google.com/chromebook/answer/3134673">Chrome OS - // kiosk session</a>. - boolean? isKioskSession; - }; - - interface Events { - // Fired when an app is launched from the launcher. - static void onLaunched(optional LaunchData launchData); - - // Fired at Chrome startup to apps that were running when Chrome last shut - // down. - static void onRestarted(); - }; -}; diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 5d82845..28ab995 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -4,6 +4,7 @@ #include "chrome/common/extensions/chrome_extensions_client.h" +#include "apps/common/api/generated_schemas.h" #include "base/command_line.h" #include "chrome/common/extensions/api/generated_schemas.h" #include "chrome/common/extensions/chrome_manifest_handlers.h" @@ -154,15 +155,22 @@ bool ChromeExtensionsClient::IsScriptableURL( bool ChromeExtensionsClient::IsAPISchemaGenerated( const std::string& name) const { + // Test from most common to least common. return extensions::api::GeneratedSchemas::IsGenerated(name) || - extensions::core_api::GeneratedSchemas::IsGenerated(name); + extensions::core_api::GeneratedSchemas::IsGenerated(name) || + apps::api::GeneratedSchemas::IsGenerated(name); } base::StringPiece ChromeExtensionsClient::GetAPISchema( const std::string& name) const { + // Test from most common to least common. if (extensions::api::GeneratedSchemas::IsGenerated(name)) return extensions::api::GeneratedSchemas::Get(name); - return extensions::core_api::GeneratedSchemas::Get(name); + + if (extensions::core_api::GeneratedSchemas::IsGenerated(name)) + return extensions::core_api::GeneratedSchemas::Get(name); + + return apps::api::GeneratedSchemas::Get(name); } // static |