From 00f1fc22bfcc653b47d62778170af3eee9855720 Mon Sep 17 00:00:00 2001 From: "rdevlin.cronin" Date: Mon, 6 Apr 2015 10:19:18 -0700 Subject: [PATCH] [Extensions API] Remove inline enums Remove all inlined enums from extension APIs. BUG=472279 TBR=derat@chromium.org (mechanical changes to chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc and chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc) Review URL: https://codereview.chromium.org/1055673002 Cr-Commit-Position: refs/heads/master@{#323912} --- .../chromeos/app_mode/kiosk_app_update_service.cc | 12 +-- .../browser/chromeos/extensions/wallpaper_api.cc | 2 +- .../chromeos/extensions/wallpaper_private_api.cc | 13 +-- .../extensions/activity_log/activity_actions.cc | 41 ++++++---- .../activity_log_private_api.cc | 20 ++--- .../activity_log_private_api_unittest.cc | 6 +- .../api/bookmarks/bookmark_api_helpers.cc | 3 +- .../api/bookmarks/bookmark_api_helpers_unittest.cc | 6 +- .../api/content_settings/content_settings_api.cc | 4 +- .../api/context_menus/context_menus_api_helpers.cc | 68 ++++++++++++++++ .../api/context_menus/context_menus_api_helpers.h | 80 +++---------------- .../extensions/api/debugger/debugger_api.cc | 8 +- .../browser/extensions/api/history/history_api.cc | 24 +++--- .../extensions/api/input_ime/input_ime_api.cc | 36 ++++----- .../api/metrics_private/metrics_private_api.cc | 3 +- .../browser/extensions/api/omnibox/omnibox_api.cc | 6 +- .../api/runtime/chrome_runtime_api_delegate.cc | 25 +++--- .../extensions/api/sessions/sessions_api.cc | 29 ++++--- chrome/browser/extensions/api/tabs/tabs_api.cc | 72 ++++++++--------- .../chrome_virtual_keyboard_delegate.cc | 12 +-- .../api/webstore_private/webstore_private_api.cc | 4 +- .../ui/ash/ash_keyboard_controller_proxy.cc | 24 +++--- .../extensions/api/activity_log_private.json | 22 ++++- chrome/common/extensions/api/bookmarks.json | 9 ++- .../extensions/api/chrome_web_view_internal.json | 18 ++--- .../extensions/api/chromeos_info_private.json | 27 ++++--- chrome/common/extensions/api/content_settings.json | 93 ++++++++++++++++++---- chrome/common/extensions/api/context_menus.json | 28 ++++--- chrome/common/extensions/api/cookies.json | 8 +- chrome/common/extensions/api/debugger.json | 22 +++-- chrome/common/extensions/api/extension.json | 11 ++- chrome/common/extensions/api/history.json | 9 ++- chrome/common/extensions/api/input_ime.json | 76 +++++++++++++----- chrome/common/extensions/api/metrics_private.json | 10 ++- chrome/common/extensions/api/omnibox.json | 20 +++-- chrome/common/extensions/api/system_private.json | 21 +++-- chrome/common/extensions/api/tabs.json | 84 +++++++++++-------- chrome/common/extensions/api/terminal_private.json | 13 ++- chrome/common/extensions/api/types.json | 32 +++++--- chrome/common/extensions/api/wallpaper.json | 12 ++- .../common/extensions/api/wallpaper_private.json | 15 ++-- chrome/common/extensions/api/web_navigation.json | 26 ++++-- chrome/common/extensions/api/webstore_private.json | 8 +- chrome/common/extensions/api/windows.json | 38 ++++++--- .../data/extensions/webui/runtime_last_error.js | 13 ++- .../browser/api/capture_web_contents_function.cc | 12 ++- .../browser/api/capture_web_contents_function.h | 3 +- extensions/browser/api/execute_code_function.cc | 8 +- .../guest_view/web_view/web_view_internal_api.cc | 12 +-- .../browser/api/management/management_api.cc | 26 +++--- extensions/browser/api/runtime/runtime_api.cc | 2 +- extensions/browser/api/runtime/runtime_api.h | 2 +- extensions/browser/test_runtime_api_delegate.cc | 2 +- extensions/common/api/bluetooth_private.json | 8 +- extensions/common/api/extension_types.json | 18 ++++- extensions/common/api/idle.json | 14 ++-- extensions/common/api/management.json | 29 +++++-- extensions/common/api/runtime.json | 58 ++++++++++---- .../common/api/virtual_keyboard_private.json | 30 +++++-- extensions/common/api/web_request.json | 89 +++++++++++++++------ extensions/common/api/web_request_internal.json | 10 ++- extensions/common/api/web_view_internal.json | 23 ++++-- extensions/renderer/resources/binding.js | 10 +-- extensions/renderer/safe_builtins.cc | 2 +- .../shell/browser/shell_runtime_api_delegate.cc | 4 +- tools/json_schema_compiler/cc_generator.py | 23 ++++-- tools/json_schema_compiler/compiler.py | 2 +- tools/json_schema_compiler/model.py | 15 +++- tools/json_schema_compiler/test/arrays.json | 23 +----- tools/json_schema_compiler/test/arrays_unittest.cc | 58 ++------------ tools/json_schema_compiler/test/callbacks.json | 14 ++-- .../test/callbacks_unittest.cc | 4 +- tools/json_schema_compiler/test/enums.json | 50 +++++------- tools/json_schema_compiler/test/enums_unittest.cc | 87 ++++++++++---------- tools/json_schema_compiler/test/objects.json | 31 +++++--- .../json_schema_compiler/test/objects_unittest.cc | 4 +- 76 files changed, 1065 insertions(+), 721 deletions(-) diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc index 0c0266eade1e..beefd31e42b5 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc @@ -99,22 +99,22 @@ void KioskAppUpdateService::OnAppUpdateAvailable( extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( profile_, app_id_, - extensions::core_api::runtime::OnRestartRequired::REASON_APP_UPDATE); + extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE); StartAppUpdateRestartTimer(); } void KioskAppUpdateService::OnRebootRequested(Reason reason) { - extensions::core_api::runtime::OnRestartRequired::Reason restart_reason = - extensions::core_api::runtime::OnRestartRequired::REASON_NONE; + extensions::core_api::runtime::OnRestartRequiredReason restart_reason = + extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_NONE; switch (reason) { case REBOOT_REASON_OS_UPDATE: restart_reason = - extensions::core_api::runtime::OnRestartRequired::REASON_OS_UPDATE; + extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_OS_UPDATE; break; case REBOOT_REASON_PERIODIC: restart_reason = - extensions::core_api::runtime::OnRestartRequired::REASON_PERIODIC; + extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_PERIODIC; break; default: NOTREACHED() << "Unknown reboot reason=" << reason; @@ -137,7 +137,7 @@ void KioskAppUpdateService::OnKioskAppCacheUpdated(const std::string& app_id) { extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( profile_, app_id_, - extensions::core_api::runtime::OnRestartRequired::REASON_APP_UPDATE); + extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE); StartAppUpdateRestartTimer(); } diff --git a/chrome/browser/chromeos/extensions/wallpaper_api.cc b/chrome/browser/chromeos/extensions/wallpaper_api.cc index 55e9ea088859..b57296cbe9e9 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_api.cc @@ -142,7 +142,7 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded( GetSequencedTaskRunnerWithShutdownBehavior(sequence_token_, base::SequencedWorkerPool::BLOCK_SHUTDOWN); wallpaper::WallpaperLayout layout = wallpaper_api_util::GetLayoutEnum( - set_wallpaper::Params::Details::ToString(params_->details.layout)); + extensions::api::wallpaper::ToString(params_->details.layout)); bool update_wallpaper = user_id_ == user_manager::UserManager::Get()->GetActiveUser()->email(); wallpaper_manager->SetCustomWallpaper(user_id_, diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index 206f13763229..cce297f29283 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -48,6 +48,7 @@ using base::BinaryValue; using content::BrowserThread; +namespace wallpaper_base = extensions::api::wallpaper; namespace wallpaper_private = extensions::api::wallpaper_private; namespace set_wallpaper_if_exists = wallpaper_private::SetWallpaperIfExists; namespace set_wallpaper = wallpaper_private::SetWallpaper; @@ -361,7 +362,7 @@ bool WallpaperPrivateSetWallpaperIfExistsFunction::RunAsync() { CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_path)); fallback_path = wallpaper_path.Append(file_name); - if (params->layout != wallpaper_private::WALLPAPER_LAYOUT_STRETCH && + if (params->layout != wallpaper_base::WALLPAPER_LAYOUT_STRETCH && resolution == chromeos::WallpaperManager::WALLPAPER_RESOLUTION_SMALL) { file_name = base::FilePath(file_name) .InsertBeforeExtension(wallpaper::kSmallWallpaperSuffix) @@ -420,7 +421,7 @@ void WallpaperPrivateSetWallpaperIfExistsFunction::OnWallpaperDecoded( chromeos::WallpaperManager* wallpaper_manager = chromeos::WallpaperManager::Get(); wallpaper::WallpaperLayout layout = wallpaper_api_util::GetLayoutEnum( - wallpaper_private::ToString(params->layout)); + wallpaper_base::ToString(params->layout)); bool update_wallpaper = user_id_ == user_manager::UserManager::Get()->GetActiveUser()->email(); @@ -530,7 +531,7 @@ void WallpaperPrivateSetWallpaperFunction::SetDecodedWallpaper( chromeos::WallpaperManager::Get(); wallpaper::WallpaperLayout layout = wallpaper_api_util::GetLayoutEnum( - wallpaper_private::ToString(params->layout)); + wallpaper_base::ToString(params->layout)); bool update_wallpaper = user_id_ == user_manager::UserManager::Get()->GetActiveUser()->email(); @@ -620,7 +621,7 @@ void WallpaperPrivateSetCustomWallpaperFunction::OnWallpaperDecoded( base::SequencedWorkerPool::BLOCK_SHUTDOWN); wallpaper::WallpaperLayout layout = wallpaper_api_util::GetLayoutEnum( - wallpaper_private::ToString(params->layout)); + wallpaper_base::ToString(params->layout)); bool update_wallpaper = user_id_ == user_manager::UserManager::Get()->GetActiveUser()->email(); @@ -702,7 +703,7 @@ bool WallpaperPrivateSetCustomWallpaperLayoutFunction::RunAsync() { return false; } info.layout = wallpaper_api_util::GetLayoutEnum( - wallpaper_private::ToString(params->layout)); + wallpaper_base::ToString(params->layout)); std::string email = user_manager::UserManager::Get()->GetActiveUser()->email(); @@ -758,7 +759,7 @@ bool WallpaperPrivateGetThumbnailFunction::RunAsync() { base::FilePath thumbnail_path; std::string email = user_manager::UserManager::Get()->GetActiveUser()->email(); - if (params->source == get_thumbnail::Params::SOURCE_ONLINE) { + if (params->source == wallpaper_private::WALLPAPER_SOURCE_ONLINE) { std::string file_name = GURL(params->url_or_file).ExtractFileName(); CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS, &thumbnail_path)); diff --git a/chrome/browser/extensions/activity_log/activity_actions.cc b/chrome/browser/extensions/activity_log/activity_actions.cc index 6912abd74c8f..63f9774ed42e 100644 --- a/chrome/browser/extensions/activity_log/activity_actions.cc +++ b/chrome/browser/extensions/activity_log/activity_actions.cc @@ -31,6 +31,7 @@ #include "url/gurl.h" namespace constants = activity_log_constants; +namespace activity_log = extensions::api::activity_log_private; namespace extensions { @@ -218,29 +219,30 @@ scoped_ptr Action::ConvertToExtensionActivity() { // without affecting the database. switch (action_type()) { case ACTION_API_CALL: - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_API_CALL; + result->activity_type = activity_log::EXTENSION_ACTIVITY_TYPE_API_CALL; break; case ACTION_API_EVENT: - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_API_EVENT; + result->activity_type = activity_log::EXTENSION_ACTIVITY_TYPE_API_EVENT; break; case ACTION_CONTENT_SCRIPT: - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_CONTENT_SCRIPT; + result->activity_type = + activity_log::EXTENSION_ACTIVITY_TYPE_CONTENT_SCRIPT; break; case ACTION_DOM_ACCESS: - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_DOM_ACCESS; + result->activity_type = activity_log::EXTENSION_ACTIVITY_TYPE_DOM_ACCESS; break; case ACTION_DOM_EVENT: - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_DOM_EVENT; + result->activity_type = activity_log::EXTENSION_ACTIVITY_TYPE_DOM_EVENT; break; case ACTION_WEB_REQUEST: - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_WEB_REQUEST; + result->activity_type = activity_log::EXTENSION_ACTIVITY_TYPE_WEB_REQUEST; break; case UNUSED_ACTION_API_BLOCKED: case ACTION_ANY: default: // This shouldn't be reached, but some people might have old or otherwise // weird db entries. Treat it like an API call if that happens. - result->activity_type = ExtensionActivity::ACTIVITY_TYPE_API_CALL; + result->activity_type = activity_log::EXTENSION_ACTIVITY_TYPE_API_CALL; break; } @@ -282,31 +284,38 @@ scoped_ptr Action::ConvertToExtensionActivity() { &dom_verb)) { switch (static_cast(dom_verb)) { case DomActionType::GETTER: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_GETTER; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_GETTER; break; case DomActionType::SETTER: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_SETTER; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_SETTER; break; case DomActionType::METHOD: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_METHOD; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_METHOD; break; case DomActionType::INSERTED: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_INSERTED; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_INSERTED; break; case DomActionType::XHR: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_XHR; + other_field->dom_verb = activity_log::EXTENSION_ACTIVITY_DOM_VERB_XHR; break; case DomActionType::WEBREQUEST: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_WEBREQUEST; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_WEBREQUEST; break; case DomActionType::MODIFIED: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_MODIFIED; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_MODIFIED; break; default: - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_NONE; + other_field->dom_verb = + activity_log::EXTENSION_ACTIVITY_DOM_VERB_NONE; } } else { - other_field->dom_verb = ExtensionActivity::Other::DOM_VERB_NONE; + other_field->dom_verb = activity_log::EXTENSION_ACTIVITY_DOM_VERB_NONE; } result->other.reset(other_field.release()); } diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc index bb6fa76a6a2e..691825d5f0bd 100644 --- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc +++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc @@ -22,9 +22,9 @@ namespace extensions { namespace activity_log_private = api::activity_log_private; -using api::activity_log_private::ActivityResultSet; -using api::activity_log_private::ExtensionActivity; -using api::activity_log_private::Filter; +using activity_log_private::ActivityResultSet; +using activity_log_private::ExtensionActivity; +using activity_log_private::Filter; static base::LazyInstance > g_factory = LAZY_INSTANCE_INITIALIZER; @@ -104,25 +104,25 @@ bool ActivityLogPrivateGetExtensionActivitiesFunction::RunAsync() { filter.reset(¶ms.release()->filter); Action::ActionType action_type = Action::ACTION_API_CALL; switch (filter->activity_type) { - case Filter::ACTIVITY_TYPE_API_CALL: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_API_CALL: action_type = Action::ACTION_API_CALL; break; - case Filter::ACTIVITY_TYPE_API_EVENT: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_API_EVENT: action_type = Action::ACTION_API_EVENT; break; - case Filter::ACTIVITY_TYPE_CONTENT_SCRIPT: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_CONTENT_SCRIPT: action_type = Action::ACTION_CONTENT_SCRIPT; break; - case Filter::ACTIVITY_TYPE_DOM_ACCESS: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_DOM_ACCESS: action_type = Action::ACTION_DOM_ACCESS; break; - case Filter::ACTIVITY_TYPE_DOM_EVENT: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_DOM_EVENT: action_type = Action::ACTION_DOM_EVENT; break; - case Filter::ACTIVITY_TYPE_WEB_REQUEST: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_WEB_REQUEST: action_type = Action::ACTION_WEB_REQUEST; break; - case Filter::ACTIVITY_TYPE_ANY: + case activity_log_private::EXTENSION_ACTIVITY_FILTER_ANY: default: action_type = Action::ACTION_ANY; } diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc index b4837899b85f..dfdf3cb1fd9a 100644 --- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc +++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc @@ -34,7 +34,8 @@ TEST_F(ActivityLogApiUnitTest, ConvertChromeApiAction) { kApiCall)); action->set_args(args.Pass()); scoped_ptr result = action->ConvertToExtensionActivity(); - ASSERT_EQ(ExtensionActivity::ACTIVITY_TYPE_API_CALL, result->activity_type); + ASSERT_EQ(api::activity_log_private::EXTENSION_ACTIVITY_TYPE_API_CALL, + result->activity_type); ASSERT_EQ(kExtensionId, *(result->extension_id.get())); ASSERT_EQ(kApiCall, *(result->api_call.get())); ASSERT_EQ(kArgs, *(result->args.get())); @@ -64,7 +65,8 @@ TEST_F(ActivityLogApiUnitTest, ConvertDomAction) { ASSERT_EQ(kApiCall, *(result->api_call.get())); ASSERT_EQ(kArgs, *(result->args.get())); scoped_ptr other(result->other.Pass()); - ASSERT_EQ(ExtensionActivity::Other::DOM_VERB_INSERTED, other->dom_verb); + ASSERT_EQ(api::activity_log_private::EXTENSION_ACTIVITY_DOM_VERB_INSERTED, + other->dom_verb); ASSERT_TRUE(other->prerender.get()); ASSERT_EQ("12345", *(result->activity_id.get())); } diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.cc b/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.cc index 6d902a139432..6c9fb4a731c0 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.cc @@ -78,7 +78,8 @@ BookmarkTreeNode* GetBookmarkTreeNode(ChromeBookmarkClient* client, if (bookmarks::IsDescendantOf(node, client->managed_node()) || bookmarks::IsDescendantOf(node, client->supervised_node())) { - bookmark_tree_node->unmodifiable = BookmarkTreeNode::UNMODIFIABLE_MANAGED; + bookmark_tree_node->unmodifiable = + api::bookmarks::BOOKMARK_TREE_NODE_UNMODIFIABLE_MANAGED; } if (recurse && node->is_folder()) { diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc b/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc index 2f6d5faed96a..bca84deaedc4 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc @@ -118,7 +118,8 @@ TEST_F(ExtensionBookmarksTest, GetModifiableNode) { EXPECT_EQ("Digg", tree->title); ASSERT_TRUE(tree->url); EXPECT_EQ("http://www.reddit.com/", *tree->url); - EXPECT_EQ(BookmarkTreeNode::UNMODIFIABLE_NONE, tree->unmodifiable); + EXPECT_EQ(api::bookmarks::BOOKMARK_TREE_NODE_UNMODIFIABLE_NONE, + tree->unmodifiable); } TEST_F(ExtensionBookmarksTest, GetManagedNode) { @@ -134,7 +135,8 @@ TEST_F(ExtensionBookmarksTest, GetManagedNode) { false)); // Only folders. EXPECT_EQ("Chromium", tree->title); EXPECT_EQ("http://www.chromium.org/", *tree->url); - EXPECT_EQ(BookmarkTreeNode::UNMODIFIABLE_MANAGED, tree->unmodifiable); + EXPECT_EQ(api::bookmarks::BOOKMARK_TREE_NODE_UNMODIFIABLE_MANAGED, + tree->unmodifiable); } TEST_F(ExtensionBookmarksTest, RemoveNodeInvalidId) { diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api.cc b/chrome/browser/extensions/api/content_settings/content_settings_api.cc index d9d174c3252a..e8e2240f382a 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_api.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_api.cc @@ -70,7 +70,7 @@ bool ContentSettingsContentSettingClearFunction::RunSync() { ExtensionPrefsScope scope = kExtensionPrefsScopeRegular; bool incognito = false; if (params->details.scope == - Clear::Params::Details::SCOPE_INCOGNITO_SESSION_ONLY) { + api::content_settings::SCOPE_INCOGNITO_SESSION_ONLY) { scope = kExtensionPrefsScopeIncognitoSessionOnly; incognito = true; } @@ -212,7 +212,7 @@ bool ContentSettingsContentSettingSetFunction::RunSync() { ExtensionPrefsScope scope = kExtensionPrefsScopeRegular; bool incognito = false; if (params->details.scope == - Set::Params::Details::SCOPE_INCOGNITO_SESSION_ONLY) { + api::content_settings::SCOPE_INCOGNITO_SESSION_ONLY) { scope = kExtensionPrefsScopeIncognitoSessionOnly; incognito = true; } diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc index 2b994855bc9b..0a4b4ddc9ee3 100644 --- a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc +++ b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc @@ -51,5 +51,73 @@ MenuItem* GetParent(MenuItem::Id parent_id, return parent; } +MenuItem::ContextList GetContexts(const std::vector< + extensions::api::context_menus::ContextType>& in_contexts) { + MenuItem::ContextList contexts; + for (size_t i = 0; i < in_contexts.size(); ++i) { + switch (in_contexts[i]) { + case extensions::api::context_menus::CONTEXT_TYPE_ALL: + contexts.Add(extensions::MenuItem::ALL); + break; + case extensions::api::context_menus::CONTEXT_TYPE_PAGE: + contexts.Add(extensions::MenuItem::PAGE); + break; + case extensions::api::context_menus::CONTEXT_TYPE_SELECTION: + contexts.Add(extensions::MenuItem::SELECTION); + break; + case extensions::api::context_menus::CONTEXT_TYPE_LINK: + contexts.Add(extensions::MenuItem::LINK); + break; + case extensions::api::context_menus::CONTEXT_TYPE_EDITABLE: + contexts.Add(extensions::MenuItem::EDITABLE); + break; + case extensions::api::context_menus::CONTEXT_TYPE_IMAGE: + contexts.Add(extensions::MenuItem::IMAGE); + break; + case extensions::api::context_menus::CONTEXT_TYPE_VIDEO: + contexts.Add(extensions::MenuItem::VIDEO); + break; + case extensions::api::context_menus::CONTEXT_TYPE_AUDIO: + contexts.Add(extensions::MenuItem::AUDIO); + break; + case extensions::api::context_menus::CONTEXT_TYPE_FRAME: + contexts.Add(extensions::MenuItem::FRAME); + break; + case extensions::api::context_menus::CONTEXT_TYPE_LAUNCHER: + // Not available for . + contexts.Add(extensions::MenuItem::LAUNCHER); + break; + case extensions::api::context_menus::CONTEXT_TYPE_BROWSER_ACTION: + // Not available for . + contexts.Add(extensions::MenuItem::BROWSER_ACTION); + break; + case extensions::api::context_menus::CONTEXT_TYPE_PAGE_ACTION: + // Not available for . + contexts.Add(extensions::MenuItem::PAGE_ACTION); + break; + case extensions::api::context_menus::CONTEXT_TYPE_NONE: + NOTREACHED(); + } + } + return contexts; +} + +MenuItem::Type GetType(extensions::api::context_menus::ItemType type, + MenuItem::Type default_type) { + switch (type) { + case extensions::api::context_menus::ITEM_TYPE_NONE: + return default_type; + case extensions::api::context_menus::ITEM_TYPE_NORMAL: + return extensions::MenuItem::NORMAL; + case extensions::api::context_menus::ITEM_TYPE_CHECKBOX: + return extensions::MenuItem::CHECKBOX; + case extensions::api::context_menus::ITEM_TYPE_RADIO: + return extensions::MenuItem::RADIO; + case extensions::api::context_menus::ITEM_TYPE_SEPARATOR: + return extensions::MenuItem::SEPARATOR; + } + return extensions::MenuItem::NORMAL; +} + } // namespace context_menus_api_helpers } // namespace extensions diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h index bcd3a4bb2a5b..9b7ce87d0080 100644 --- a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h +++ b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h @@ -9,6 +9,7 @@ #include "chrome/browser/extensions/menu_manager.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/extensions/api/context_menus.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_handlers/background_info.h" @@ -54,74 +55,11 @@ MenuItem* GetParent(MenuItem::Id parent_id, const MenuManager* menu_manager, std::string* error); -template -MenuItem::ContextList GetContexts(const PropertyWithEnumT& property) { - MenuItem::ContextList contexts; - for (size_t i = 0; i < property.contexts->size(); ++i) { - switch (property.contexts->at(i)) { - case PropertyWithEnumT::CONTEXTS_TYPE_ALL: - contexts.Add(extensions::MenuItem::ALL); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_PAGE: - contexts.Add(extensions::MenuItem::PAGE); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_SELECTION: - contexts.Add(extensions::MenuItem::SELECTION); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_LINK: - contexts.Add(extensions::MenuItem::LINK); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_EDITABLE: - contexts.Add(extensions::MenuItem::EDITABLE); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_IMAGE: - contexts.Add(extensions::MenuItem::IMAGE); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_VIDEO: - contexts.Add(extensions::MenuItem::VIDEO); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_AUDIO: - contexts.Add(extensions::MenuItem::AUDIO); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_FRAME: - contexts.Add(extensions::MenuItem::FRAME); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_LAUNCHER: - // Not available for . - contexts.Add(extensions::MenuItem::LAUNCHER); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_BROWSER_ACTION: - // Not available for . - contexts.Add(extensions::MenuItem::BROWSER_ACTION); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_PAGE_ACTION: - // Not available for . - contexts.Add(extensions::MenuItem::PAGE_ACTION); - break; - case PropertyWithEnumT::CONTEXTS_TYPE_NONE: - NOTREACHED(); - } - } - return contexts; -} +MenuItem::ContextList GetContexts(const std::vector< + extensions::api::context_menus::ContextType>& in_contexts); -template -MenuItem::Type GetType(const PropertyWithEnumT& property, - MenuItem::Type default_type) { - switch (property.type) { - case PropertyWithEnumT::TYPE_NONE: - return default_type; - case PropertyWithEnumT::TYPE_NORMAL: - return extensions::MenuItem::NORMAL; - case PropertyWithEnumT::TYPE_CHECKBOX: - return extensions::MenuItem::CHECKBOX; - case PropertyWithEnumT::TYPE_RADIO: - return extensions::MenuItem::RADIO; - case PropertyWithEnumT::TYPE_SEPARATOR: - return extensions::MenuItem::SEPARATOR; - } - return extensions::MenuItem::NORMAL; -} +MenuItem::Type GetType(extensions::api::context_menus::ItemType type, + MenuItem::Type default_type); // Creates and adds a menu item from |create_properties|. template @@ -148,7 +86,7 @@ bool CreateMenuItem(const PropertyWithEnumT& create_properties, // Contexts. MenuItem::ContextList contexts; if (create_properties.contexts.get()) - contexts = GetContexts(create_properties); + contexts = GetContexts(*create_properties.contexts); else contexts.Add(MenuItem::PAGE); @@ -174,7 +112,7 @@ bool CreateMenuItem(const PropertyWithEnumT& create_properties, if (create_properties.title.get()) title = *create_properties.title; - MenuItem::Type type = GetType(create_properties, MenuItem::NORMAL); + MenuItem::Type type = GetType(create_properties.type, MenuItem::NORMAL); if (title.empty() && type != MenuItem::SEPARATOR) { *error = kTitleNeededError; return false; @@ -240,7 +178,7 @@ bool UpdateMenuItem(const PropertyWithEnumT& update_properties, } // Type. - MenuItem::Type type = GetType(update_properties, item->type()); + MenuItem::Type type = GetType(update_properties.type, item->type()); if (type != item->type()) { if (type == MenuItem::RADIO || item->type() == MenuItem::RADIO) @@ -283,7 +221,7 @@ bool UpdateMenuItem(const PropertyWithEnumT& update_properties, // Contexts. MenuItem::ContextList contexts; if (update_properties.contexts.get()) { - contexts = GetContexts(update_properties); + contexts = GetContexts(*update_properties.contexts); if (contexts.Contains(MenuItem::LAUNCHER)) { // Launcher item is not allowed for . diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc index 1b7a2642b219..9acec23bd6f8 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.cc +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc @@ -124,7 +124,7 @@ class ExtensionDevToolsClientHost : public content::DevToolsAgentHostClient, PendingRequests; PendingRequests pending_requests_; infobars::InfoBar* infobar_; - OnDetach::Reason detach_reason_; + api::debugger::DetachReason detach_reason_; // Listen to extension unloaded notification. ScopedObserver @@ -311,7 +311,7 @@ ExtensionDevToolsClientHost::ExtensionDevToolsClientHost( extension_id_(extension_id), last_request_id_(0), infobar_(infobar), - detach_reason_(OnDetach::REASON_TARGET_CLOSED), + detach_reason_(api::debugger::DETACH_REASON_TARGET_CLOSED), extension_registry_observer_(this) { CopyDebuggee(&debuggee_, debuggee); @@ -361,7 +361,7 @@ void ExtensionDevToolsClientHost::AgentHostClosed( DevToolsAgentHost* agent_host, bool replaced_with_another_client) { DCHECK(agent_host == agent_host_.get()); if (replaced_with_another_client) - detach_reason_ = OnDetach::REASON_REPLACED_WITH_DEVTOOLS; + detach_reason_ = api::debugger::DETACH_REASON_REPLACED_WITH_DEVTOOLS; SendDetachedEvent(); delete this; } @@ -391,7 +391,7 @@ void ExtensionDevToolsClientHost::SendMessageToBackend( } void ExtensionDevToolsClientHost::MarkAsDismissed() { - detach_reason_ = OnDetach::REASON_CANCELED_BY_USER; + detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; } void ExtensionDevToolsClientHost::SendDetachedEvent() { diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc index 4e7a7bcb2bd6..3354f0f0da34 100644 --- a/chrome/browser/extensions/api/history/history_api.cc +++ b/chrome/browser/extensions/api/history/history_api.cc @@ -82,40 +82,40 @@ scoped_ptr GetVisitItem(const history::VisitRow& row) { new double(MilliSecondsFromTime(row.visit_time))); visit_item->referring_visit_id = base::Int64ToString(row.referring_visit); - VisitItem::Transition transition = VisitItem::TRANSITION_LINK; + api::history::TransitionType transition = api::history::TRANSITION_TYPE_LINK; switch (row.transition & ui::PAGE_TRANSITION_CORE_MASK) { case ui::PAGE_TRANSITION_LINK: - transition = VisitItem::TRANSITION_LINK; + transition = api::history::TRANSITION_TYPE_LINK; break; case ui::PAGE_TRANSITION_TYPED: - transition = VisitItem::TRANSITION_TYPED; + transition = api::history::TRANSITION_TYPE_TYPED; break; case ui::PAGE_TRANSITION_AUTO_BOOKMARK: - transition = VisitItem::TRANSITION_AUTO_BOOKMARK; + transition = api::history::TRANSITION_TYPE_AUTO_BOOKMARK; break; case ui::PAGE_TRANSITION_AUTO_SUBFRAME: - transition = VisitItem::TRANSITION_AUTO_SUBFRAME; + transition = api::history::TRANSITION_TYPE_AUTO_SUBFRAME; break; case ui::PAGE_TRANSITION_MANUAL_SUBFRAME: - transition = VisitItem::TRANSITION_MANUAL_SUBFRAME; + transition = api::history::TRANSITION_TYPE_MANUAL_SUBFRAME; break; case ui::PAGE_TRANSITION_GENERATED: - transition = VisitItem::TRANSITION_GENERATED; + transition = api::history::TRANSITION_TYPE_GENERATED; break; case ui::PAGE_TRANSITION_AUTO_TOPLEVEL: - transition = VisitItem::TRANSITION_AUTO_TOPLEVEL; + transition = api::history::TRANSITION_TYPE_AUTO_TOPLEVEL; break; case ui::PAGE_TRANSITION_FORM_SUBMIT: - transition = VisitItem::TRANSITION_FORM_SUBMIT; + transition = api::history::TRANSITION_TYPE_FORM_SUBMIT; break; case ui::PAGE_TRANSITION_RELOAD: - transition = VisitItem::TRANSITION_RELOAD; + transition = api::history::TRANSITION_TYPE_RELOAD; break; case ui::PAGE_TRANSITION_KEYWORD: - transition = VisitItem::TRANSITION_KEYWORD; + transition = api::history::TRANSITION_TYPE_KEYWORD; break; case ui::PAGE_TRANSITION_KEYWORD_GENERATED: - transition = VisitItem::TRANSITION_KEYWORD_GENERATED; + transition = api::history::TRANSITION_TYPE_KEYWORD_GENERATED; break; default: DCHECK(false); diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc index a85fdd40af6f..77d6fb52c641 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc @@ -59,7 +59,7 @@ void SetMenuItemToMenu(const input_ime::MenuItem& input, out->label = *input.label; } - if (input.style != input_ime::MenuItem::STYLE_NONE) { + if (input.style != input_ime::MENU_ITEM_STYLE_NONE) { out->modified |= InputMethodEngineInterface::MENU_ITEM_MODIFIED_STYLE; out->style = static_cast( input.style); @@ -135,7 +135,7 @@ class ImeObserver : public InputMethodEngineInterface::Observer { scoped_ptr args(input_ime::OnActivate::Create( component_id, - input_ime::OnActivate::ParseScreen(GetCurrentScreenType()))); + input_ime::ParseScreenType(GetCurrentScreenType()))); DispatchEventToExtension( extension_id_, input_ime::OnActivate::kEventName, args.Pass()); @@ -160,7 +160,7 @@ class ImeObserver : public InputMethodEngineInterface::Observer { input_ime::InputContext context_value; context_value.context_id = context.id; - context_value.type = input_ime::InputContext::ParseType(context.type); + context_value.type = input_ime::ParseInputContextType(context.type); context_value.auto_correct = context.auto_correct; context_value.auto_complete = context.auto_complete; context_value.spell_check = context.spell_check; @@ -189,7 +189,7 @@ class ImeObserver : public InputMethodEngineInterface::Observer { input_ime::InputContext context_value; context_value.context_id = context.id; - context_value.type = input_ime::InputContext::ParseType(context.type); + context_value.type = input_ime::ParseInputContextType(context.type); scoped_ptr args( input_ime::OnInputContextUpdate::Create(context_value)); @@ -221,7 +221,7 @@ class ImeObserver : public InputMethodEngineInterface::Observer { ime_event_router->AddRequest(component_id, key_data); input_ime::KeyboardEvent key_data_value; - key_data_value.type = input_ime::KeyboardEvent::ParseType(event.type); + key_data_value.type = input_ime::ParseKeyboardEventType(event.type); key_data_value.request_id = request_id; if (!event.extension_id.empty()) key_data_value.extension_id.reset(new std::string(event.extension_id)); @@ -247,21 +247,20 @@ class ImeObserver : public InputMethodEngineInterface::Observer { !HasListener(input_ime::OnCandidateClicked::kEventName)) return; - input_ime::OnCandidateClicked::Button button_enum = - input_ime::OnCandidateClicked::BUTTON_NONE; + input_ime::MouseButton button_enum = input_ime::MOUSE_BUTTON_NONE; switch (button) { case InputMethodEngineInterface::MOUSE_BUTTON_MIDDLE: - button_enum = input_ime::OnCandidateClicked::BUTTON_MIDDLE; + button_enum = input_ime::MOUSE_BUTTON_MIDDLE; break; case InputMethodEngineInterface::MOUSE_BUTTON_RIGHT: - button_enum = input_ime::OnCandidateClicked::BUTTON_RIGHT; + button_enum = input_ime::MOUSE_BUTTON_RIGHT; break; case InputMethodEngineInterface::MOUSE_BUTTON_LEFT: // Default to left. default: - button_enum = input_ime::OnCandidateClicked::BUTTON_LEFT; + button_enum = input_ime::MOUSE_BUTTON_LEFT; break; } @@ -551,17 +550,16 @@ bool InputImeSetCompositionFunction::RunSync() { for (size_t i = 0; i < segments_args.size(); ++i) { EXTENSION_FUNCTION_VALIDATE( segments_args[i]->style != - SetComposition::Params::Parameters::SegmentsType::STYLE_NONE); + input_ime::UNDERLINE_STYLE_NONE); segments.push_back(InputMethodEngineInterface::SegmentInfo()); segments.back().start = segments_args[i]->start; segments.back().end = segments_args[i]->end; if (segments_args[i]->style == - SetComposition::Params::Parameters::SegmentsType::STYLE_UNDERLINE) { + input_ime::UNDERLINE_STYLE_UNDERLINE) { segments.back().style = InputMethodEngineInterface::SEGMENT_STYLE_UNDERLINE; } else if (segments_args[i]->style == - SetComposition::Params::Parameters::SegmentsType:: - STYLE_DOUBLEUNDERLINE) { + input_ime::UNDERLINE_STYLE_DOUBLEUNDERLINE) { segments.back().style = InputMethodEngineInterface::SEGMENT_STYLE_DOUBLE_UNDERLINE; } else { @@ -648,7 +646,7 @@ bool InputImeSendKeyEventsFunction::RunAsync() { for (size_t i = 0; i < key_data.size(); ++i) { chromeos::InputMethodEngineInterface::KeyboardEvent event; - event.type = input_ime::KeyboardEvent::ToString(key_data[i]->type); + event.type = input_ime::ToString(key_data[i]->type); event.key = key_data[i]->key; event.code = key_data[i]->code; event.key_code = key_data[i]->key_code.get() ? *(key_data[i]->key_code) : 0; @@ -710,14 +708,10 @@ bool InputImeSetCandidateWindowPropertiesFunction::RunSync() { modified = true; } - if (properties.window_position == - SetCandidateWindowProperties::Params::Parameters::Properties:: - WINDOW_POSITION_COMPOSITION) { + if (properties.window_position == input_ime::WINDOW_POSITION_COMPOSITION) { properties_out.show_window_at_composition = true; modified = true; - } else if (properties.window_position == - SetCandidateWindowProperties::Params::Parameters::Properties:: - WINDOW_POSITION_CURSOR) { + } else if (properties.window_position == input_ime::WINDOW_POSITION_CURSOR) { properties_out.show_window_at_composition = false; modified = true; } diff --git a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc index 60036a2498c1..52d21f8caf76 100644 --- a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc +++ b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc @@ -116,8 +116,7 @@ bool MetricsPrivateRecordValueFunction::RunSync() { EXTENSION_FUNCTION_VALIDATE(params.get()); // Get the histogram parameters from the metric type object. - std::string type = api::metrics_private::MetricType::ToString( - params->metric.type); + std::string type = api::metrics_private::ToString(params->metric.type); base::HistogramType histogram_type(type == "histogram-linear" ? base::LINEAR_HISTOGRAM : base::HISTOGRAM); diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index 5281e912e8ae..b8b1ee889952 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -328,13 +328,13 @@ ACMatchClassifications StyleTypesToACMatchClassifications( int type_class; switch (style->type) { - case omnibox::SuggestResult::DescriptionStylesType::TYPE_URL: + case omnibox::DESCRIPTION_STYLE_TYPE_URL: type_class = AutocompleteMatch::ACMatchClassification::URL; break; - case omnibox::SuggestResult::DescriptionStylesType::TYPE_MATCH: + case omnibox::DESCRIPTION_STYLE_TYPE_MATCH: type_class = AutocompleteMatch::ACMatchClassification::MATCH; break; - case omnibox::SuggestResult::DescriptionStylesType::TYPE_DIM: + case omnibox::DESCRIPTION_STYLE_TYPE_DIM: type_class = AutocompleteMatch::ACMatchClassification::DIM; break; default: diff --git a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc index 1e3eb46cfb6b..7c48a5629e06 100644 --- a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc +++ b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc @@ -187,15 +187,15 @@ void ChromeRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { const char* os = update_client::UpdateQueryParams::GetOS(); if (strcmp(os, "mac") == 0) { - info->os = PlatformInfo::OS_MAC_; + info->os = extensions::core_api::runtime::PLATFORM_OS_MAC; } else if (strcmp(os, "win") == 0) { - info->os = PlatformInfo::OS_WIN_; + info->os = extensions::core_api::runtime::PLATFORM_OS_WIN; } else if (strcmp(os, "cros") == 0) { - info->os = PlatformInfo::OS_CROS_; + info->os = extensions::core_api::runtime::PLATFORM_OS_CROS; } else if (strcmp(os, "linux") == 0) { - info->os = PlatformInfo::OS_LINUX_; + info->os = extensions::core_api::runtime::PLATFORM_OS_LINUX; } else if (strcmp(os, "openbsd") == 0) { - info->os = PlatformInfo::OS_OPENBSD_; + info->os = extensions::core_api::runtime::PLATFORM_OS_OPENBSD; } else { NOTREACHED(); return false; @@ -203,11 +203,11 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { const char* arch = update_client::UpdateQueryParams::GetArch(); if (strcmp(arch, "arm") == 0) { - info->arch = PlatformInfo::ARCH_ARM; + info->arch = extensions::core_api::runtime::PLATFORM_ARCH_ARM; } else if (strcmp(arch, "x86") == 0) { - info->arch = PlatformInfo::ARCH_X86_32; + info->arch = extensions::core_api::runtime::PLATFORM_ARCH_X86_32; } else if (strcmp(arch, "x64") == 0) { - info->arch = PlatformInfo::ARCH_X86_64; + info->arch = extensions::core_api::runtime::PLATFORM_ARCH_X86_64; } else { NOTREACHED(); return false; @@ -215,11 +215,14 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch(); if (strcmp(nacl_arch, "arm") == 0) { - info->nacl_arch = PlatformInfo::NACL_ARCH_ARM; + info->nacl_arch = + extensions::core_api::runtime::PLATFORM_NACL_ARCH_ARM; } else if (strcmp(nacl_arch, "x86-32") == 0) { - info->nacl_arch = PlatformInfo::NACL_ARCH_X86_32; + info->nacl_arch = + extensions::core_api::runtime::PLATFORM_NACL_ARCH_X86_32; } else if (strcmp(nacl_arch, "x86-64") == 0) { - info->nacl_arch = PlatformInfo::NACL_ARCH_X86_64; + info->nacl_arch = + extensions::core_api::runtime::PLATFORM_NACL_ARCH_X86_64; } else { NOTREACHED(); return false; diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc index 0aaecb5b71e2..e900b5922a24 100644 --- a/chrome/browser/extensions/api/sessions/sessions_api.cc +++ b/chrome/browser/extensions/api/sessions/sessions_api.cc @@ -109,10 +109,10 @@ scoped_ptr CreateTabModelHelper( } scoped_ptr CreateWindowModelHelper( - scoped_ptr > > tabs, + scoped_ptr>> tabs, const std::string& session_id, - const windows::Window::Type& type, - const windows::Window::State& state) { + const windows::WindowType& type, + const windows::WindowState& state) { scoped_ptr window_struct(new windows::Window); window_struct->tabs = tabs.Pass(); window_struct->session_id.reset(new std::string(session_id)); @@ -172,10 +172,9 @@ scoped_ptr window.selected_tab_index).release())); } - return CreateWindowModelHelper(tabs.Pass(), - base::IntToString(session_id), - windows::Window::TYPE_NORMAL, - windows::Window::STATE_NORMAL); + return CreateWindowModelHelper(tabs.Pass(), base::IntToString(session_id), + windows::WINDOW_TYPE_NORMAL, + windows::WINDOW_STATE_NORMAL); } scoped_ptr @@ -288,29 +287,29 @@ scoped_ptr SessionsGetDevicesFunction::CreateWindowModel( std::string session_id = SessionId(session_tag, window.window_id.id()).ToString(); - windows::Window::Type type = windows::Window::TYPE_NONE; + windows::WindowType type = windows::WINDOW_TYPE_NONE; switch (window.type) { case sessions::SessionWindow::TYPE_TABBED: - type = windows::Window::TYPE_NORMAL; + type = windows::WINDOW_TYPE_NORMAL; break; case sessions::SessionWindow::TYPE_POPUP: - type = windows::Window::TYPE_POPUP; + type = windows::WINDOW_TYPE_POPUP; break; } - windows::Window::State state = windows::Window::STATE_NONE; + windows::WindowState state = windows::WINDOW_STATE_NONE; switch (window.show_state) { case ui::SHOW_STATE_NORMAL: - state = windows::Window::STATE_NORMAL; + state = windows::WINDOW_STATE_NORMAL; break; case ui::SHOW_STATE_MINIMIZED: - state = windows::Window::STATE_MINIMIZED; + state = windows::WINDOW_STATE_MINIMIZED; break; case ui::SHOW_STATE_MAXIMIZED: - state = windows::Window::STATE_MAXIMIZED; + state = windows::WINDOW_STATE_MAXIMIZED; break; case ui::SHOW_STATE_FULLSCREEN: - state = windows::Window::STATE_FULLSCREEN; + state = windows::WINDOW_STATE_FULLSCREEN; break; case ui::SHOW_STATE_DEFAULT: case ui::SHOW_STATE_INACTIVE: diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index e6130ec1153c..d212cafc223b 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -188,20 +188,20 @@ void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, DCHECK(zoom_settings); switch (zoom_mode) { case ZoomController::ZOOM_MODE_DEFAULT: - zoom_settings->mode = api::tabs::ZoomSettings::MODE_AUTOMATIC; - zoom_settings->scope = api::tabs::ZoomSettings::SCOPE_PER_ORIGIN; + zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC; + zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN; break; case ZoomController::ZOOM_MODE_ISOLATED: - zoom_settings->mode = api::tabs::ZoomSettings::MODE_AUTOMATIC; - zoom_settings->scope = api::tabs::ZoomSettings::SCOPE_PER_TAB; + zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC; + zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB; break; case ZoomController::ZOOM_MODE_MANUAL: - zoom_settings->mode = api::tabs::ZoomSettings::MODE_MANUAL; - zoom_settings->scope = api::tabs::ZoomSettings::SCOPE_PER_TAB; + zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_MANUAL; + zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB; break; case ZoomController::ZOOM_MODE_DISABLED: - zoom_settings->mode = api::tabs::ZoomSettings::MODE_DISABLED; - zoom_settings->scope = api::tabs::ZoomSettings::SCOPE_PER_TAB; + zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_DISABLED; + zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB; break; } } @@ -432,20 +432,19 @@ bool WindowsCreateFunction::RunSync() { // Figure out window type before figuring out bounds so that default // bounds can be set according to the window type. switch (create_data->type) { - case windows::Create::Params::CreateData::TYPE_POPUP: + case windows::CREATE_TYPE_POPUP: window_type = Browser::TYPE_POPUP; extension_id = extension()->id(); break; - case windows::Create::Params::CreateData::TYPE_PANEL: - case windows::Create::Params::CreateData::TYPE_DETACHED_PANEL: { + case windows::CREATE_TYPE_PANEL: + case windows::CREATE_TYPE_DETACHED_PANEL: { extension_id = extension()->id(); bool use_panels = PanelManager::ShouldUsePanels(extension_id); if (use_panels) { create_panel = true; // Non-ash supports both docked and detached panel types. if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH && - create_data->type == - windows::Create::Params::CreateData::TYPE_DETACHED_PANEL) { + create_data->type == windows::CREATE_TYPE_DETACHED_PANEL) { panel_create_mode = PanelManager::CREATE_AS_DETACHED; } } else { @@ -453,8 +452,8 @@ bool WindowsCreateFunction::RunSync() { } break; } - case windows::Create::Params::CreateData::TYPE_NONE: - case windows::Create::Params::CreateData::TYPE_NORMAL: + case windows::CREATE_TYPE_NONE: + case windows::CREATE_TYPE_NORMAL: break; default: error_ = keys::kInvalidWindowTypeError; @@ -626,19 +625,19 @@ bool WindowsUpdateFunction::RunSync() { ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change. switch (params->update_info.state) { - case windows::Update::Params::UpdateInfo::STATE_NORMAL: + case windows::WINDOW_STATE_NORMAL: show_state = ui::SHOW_STATE_NORMAL; break; - case windows::Update::Params::UpdateInfo::STATE_MINIMIZED: + case windows::WINDOW_STATE_MINIMIZED: show_state = ui::SHOW_STATE_MINIMIZED; break; - case windows::Update::Params::UpdateInfo::STATE_MAXIMIZED: + case windows::WINDOW_STATE_MAXIMIZED: show_state = ui::SHOW_STATE_MAXIMIZED; break; - case windows::Update::Params::UpdateInfo::STATE_FULLSCREEN: + case windows::WINDOW_STATE_FULLSCREEN: show_state = ui::SHOW_STATE_FULLSCREEN; break; - case windows::Update::Params::UpdateInfo::STATE_NONE: + case windows::WINDOW_STATE_NONE: break; default: error_ = keys::kInvalidWindowStateError; @@ -803,10 +802,8 @@ bool TabsQueryFunction::RunSync() { scoped_ptr params(tabs::Query::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - bool loading_status_set = params->query_info.status != - tabs::Query::Params::QueryInfo::STATUS_NONE; - bool loading = params->query_info.status == - tabs::Query::Params::QueryInfo::STATUS_LOADING; + bool loading_status_set = params->query_info.status != tabs::TAB_STATUS_NONE; + bool loading = params->query_info.status == tabs::TAB_STATUS_LOADING; URLPatternSet url_patterns; if (params->query_info.url.get()) { @@ -837,11 +834,8 @@ bool TabsQueryFunction::RunSync() { index = *params->query_info.index; std::string window_type; - if (params->query_info.window_type != - tabs::Query::Params::QueryInfo::WINDOW_TYPE_NONE) { - window_type = tabs::Query::Params::QueryInfo::ToString( - params->query_info.window_type); - } + if (params->query_info.window_type != tabs::WINDOW_TYPE_NONE) + window_type = tabs::ToString(params->query_info.window_type); base::ListValue* result = new base::ListValue(); Browser* last_active_browser = chrome::FindAnyBrowser( @@ -1905,9 +1899,9 @@ bool TabsSetZoomSettingsFunction::RunAsync() { return false; // "per-origin" scope is only available in "automatic" mode. - if (params->zoom_settings.scope == ZoomSettings::SCOPE_PER_ORIGIN && - params->zoom_settings.mode != ZoomSettings::MODE_AUTOMATIC && - params->zoom_settings.mode != ZoomSettings::MODE_NONE) { + if (params->zoom_settings.scope == tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN && + params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_AUTOMATIC && + params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_NONE) { error_ = keys::kPerOriginOnlyInAutomaticError; return false; } @@ -1916,21 +1910,21 @@ bool TabsSetZoomSettingsFunction::RunAsync() { // user-specified |zoom_settings|. ZoomController::ZoomMode zoom_mode = ZoomController::ZOOM_MODE_DEFAULT; switch (params->zoom_settings.mode) { - case ZoomSettings::MODE_NONE: - case ZoomSettings::MODE_AUTOMATIC: + case tabs::ZOOM_SETTINGS_MODE_NONE: + case tabs::ZOOM_SETTINGS_MODE_AUTOMATIC: switch (params->zoom_settings.scope) { - case ZoomSettings::SCOPE_NONE: - case ZoomSettings::SCOPE_PER_ORIGIN: + case tabs::ZOOM_SETTINGS_SCOPE_NONE: + case tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN: zoom_mode = ZoomController::ZOOM_MODE_DEFAULT; break; - case ZoomSettings::SCOPE_PER_TAB: + case tabs::ZOOM_SETTINGS_SCOPE_PER_TAB: zoom_mode = ZoomController::ZOOM_MODE_ISOLATED; } break; - case ZoomSettings::MODE_MANUAL: + case tabs::ZOOM_SETTINGS_MODE_MANUAL: zoom_mode = ZoomController::ZOOM_MODE_MANUAL; break; - case ZoomSettings::MODE_DISABLED: + case tabs::ZOOM_SETTINGS_MODE_DISABLED: zoom_mode = ZoomController::ZOOM_MODE_DISABLED; } diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc index 865792cee8d7..1d2c821752d6 100644 --- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc +++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc @@ -23,7 +23,7 @@ #include "ui/keyboard/keyboard_switches.h" #include "ui/keyboard/keyboard_util.h" -namespace SetMode = extensions::core_api::virtual_keyboard_private::SetMode; +namespace keyboard_api = extensions::core_api::virtual_keyboard_private; namespace { @@ -37,13 +37,13 @@ std::string GenerateFeatureFlag(std::string feature, bool enabled) { return feature + (enabled ? "-enabled" : "-disabled"); } -keyboard::KeyboardMode getKeyboardModeEnum(SetMode::Params::Mode mode) { +keyboard::KeyboardMode getKeyboardModeEnum(keyboard_api::KeyboardMode mode) { switch (mode) { - case SetMode::Params::MODE_NONE: + case keyboard_api::KEYBOARD_MODE_NONE: return keyboard::NONE; - case SetMode::Params::MODE_FULL_WIDTH: + case keyboard_api::KEYBOARD_MODE_FULL_WIDTH: return keyboard::FULL_WIDTH; - case SetMode::Params::MODE_FLOATING: + case keyboard_api::KEYBOARD_MODE_FLOATING: return keyboard::FLOATING; } return keyboard::NONE; @@ -152,7 +152,7 @@ bool ChromeVirtualKeyboardDelegate::ShowLanguageSettings() { bool ChromeVirtualKeyboardDelegate::SetVirtualKeyboardMode(int mode_enum) { keyboard::KeyboardMode keyboard_mode = - getKeyboardModeEnum(static_cast(mode_enum)); + getKeyboardModeEnum(static_cast(mode_enum)); keyboard::KeyboardController* controller = keyboard::KeyboardController::GetInstance(); if (!controller) diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index 2ca253ea9a00..a3a58c760e47 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc @@ -769,8 +769,8 @@ ExtensionFunction::ResponseAction WebstorePrivateGetWebGLStatusFunction::Run() { void WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck( bool feature_allowed) { - Respond(ArgumentList(GetWebGLStatus::Results::Create( - GetWebGLStatus::Results::ParseWebgl_status( + Respond(ArgumentList( + GetWebGLStatus::Results::Create(api::webstore_private::ParseWebGlStatus( feature_allowed ? "webgl_allowed" : "webgl_blocked")))); } diff --git a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc index 0e486fd7f203..d999706b58b8 100644 --- a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc +++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc @@ -36,22 +36,23 @@ namespace { const char* kVirtualKeyboardExtensionID = "mppnpdlheglhdfmldimlhpnegondlapf"; -Context::Type TextInputTypeToGeneratedInputTypeEnum(ui::TextInputType type) { +virtual_keyboard_private::OnTextInputBoxFocusedType +TextInputTypeToGeneratedInputTypeEnum(ui::TextInputType type) { switch (type) { case ui::TEXT_INPUT_TYPE_NONE: - return Context::TYPE_NONE; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_NONE; case ui::TEXT_INPUT_TYPE_PASSWORD: - return Context::TYPE_PASSWORD; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_PASSWORD; case ui::TEXT_INPUT_TYPE_EMAIL: - return Context::TYPE_EMAIL; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_EMAIL; case ui::TEXT_INPUT_TYPE_NUMBER: - return Context::TYPE_NUMBER; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_NUMBER; case ui::TEXT_INPUT_TYPE_TELEPHONE: - return Context::TYPE_TEL; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_TEL; case ui::TEXT_INPUT_TYPE_URL: - return Context::TYPE_URL; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_URL; case ui::TEXT_INPUT_TYPE_DATE: - return Context::TYPE_DATE; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_DATE; case ui::TEXT_INPUT_TYPE_TEXT: case ui::TEXT_INPUT_TYPE_SEARCH: case ui::TEXT_INPUT_TYPE_DATE_TIME: @@ -62,10 +63,10 @@ Context::Type TextInputTypeToGeneratedInputTypeEnum(ui::TextInputType type) { case ui::TEXT_INPUT_TYPE_TEXT_AREA: case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE: case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD: - return Context::TYPE_TEXT; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_TEXT; } NOTREACHED(); - return Context::TYPE_NONE; + return virtual_keyboard_private::ON_TEXT_INPUT_BOX_FOCUSED_TYPE_NONE; } } // namespace @@ -171,7 +172,8 @@ void AshKeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) { scoped_ptr event_args(new base::ListValue()); scoped_ptr input_context(new base::DictionaryValue()); input_context->SetString("type", - Context::ToString(TextInputTypeToGeneratedInputTypeEnum(type))); + virtual_keyboard_private::ToString( + TextInputTypeToGeneratedInputTypeEnum(type))); event_args->Append(input_context.release()); scoped_ptr event(new extensions::Event( diff --git a/chrome/common/extensions/api/activity_log_private.json b/chrome/common/extensions/api/activity_log_private.json index 39b30868825e..685ac8258b2b 100644 --- a/chrome/common/extensions/api/activity_log_private.json +++ b/chrome/common/extensions/api/activity_log_private.json @@ -8,13 +8,29 @@ "description": "none", "types": [ { + "id": "ExtensionActivityType", + "type": "string", + "enum": ["api_call", "api_event", "content_script", "dom_access", "dom_event", "web_request"] + }, + { + "id": "ExtensionActivityFilter", + "type": "string", + "enum": ["api_call", "api_event", "content_script", "dom_access", "dom_event", "web_request", "any"], + "description": "Exact match or any" + }, + { + "id": "ExtensionActivityDomVerb", + "type": "string", + "enum": ["getter", "setter", "method", "inserted", "xhr", "webrequest", "modified"] + }, + { "id": "ExtensionActivity", "type": "object", "description": "This corresponds to a row from the ActivityLog database. Fields will be blank if they were specified precisely in a lookup filter.", "properties": { "activityId": {"type": "string", "optional": true, "description": "An ID of a row in the ActivityLog database that corresponds to the activity. ID is set only on activities retrieved from the database."}, "extensionId": {"type": "string", "optional": true}, - "activityType": {"type": "string", "enum": ["api_call", "api_event", "content_script", "dom_access", "dom_event", "web_request"]}, + "activityType": {"$ref": "ExtensionActivityType"}, "time": {"type": "number", "optional": true}, "apiCall": {"type": "string", "optional": true}, "args": {"type": "string", "optional": true}, @@ -27,7 +43,7 @@ "optional": true, "properties": { "prerender": {"type": "boolean", "optional": true}, - "domVerb": {"type": "string", "enum": ["getter", "setter", "method", "inserted", "xhr", "webrequest", "modified"], "optional": true}, + "domVerb": {"$ref": "ExtensionActivityDomVerb", "optional": true}, "webRequest": {"type": "string", "optional": true}, "extra": {"type": "string", "optional": true} } @@ -40,7 +56,7 @@ "description": "Used to specify values for a lookup.", "properties": { "extensionId": {"type": "string", "optional": true, "description": "Exact match"}, - "activityType": {"type": "string", "enum": ["api_call", "api_event", "content_script", "dom_access", "dom_event", "web_request", "any"], "description": "Exact match or any"}, + "activityType": {"$ref": "ExtensionActivityFilter"}, "apiCall": {"type": "string", "optional": true, "description": "Exact match"}, "pageUrl": {"type": "string", "optional": true, "description": "Treated as a prefix"}, "argUrl": {"type": "string", "optional": true, "description": "Treated as a prefix"}, diff --git a/chrome/common/extensions/api/bookmarks.json b/chrome/common/extensions/api/bookmarks.json index c0c98b84e010..81b3a2af0401 100644 --- a/chrome/common/extensions/api/bookmarks.json +++ b/chrome/common/extensions/api/bookmarks.json @@ -20,6 +20,12 @@ }, "types": [ { + "id": "BookmarkTreeNodeUnmodifiable", + "type": "string", + "enum": ["managed"], + "description": "Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)." + }, + { "id": "BookmarkTreeNode", "type": "object", "description": "A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.", @@ -60,8 +66,7 @@ "description": "When the contents of this folder last changed, in milliseconds since the epoch." }, "unmodifiable": { - "type": "string", - "enum": ["managed"], + "$ref": "BookmarkTreeNodeUnmodifiable", "optional": true, "description": "Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)." }, diff --git a/chrome/common/extensions/api/chrome_web_view_internal.json b/chrome/common/extensions/api/chrome_web_view_internal.json index 33e282c49b78..0797d47eca42 100644 --- a/chrome/common/extensions/api/chrome_web_view_internal.json +++ b/chrome/common/extensions/api/chrome_web_view_internal.json @@ -9,7 +9,7 @@ "compiler_options": { "implemented_in": "chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.h" }, - "dependencies": ["contextMenusInternal"], + "dependencies": ["contextMenusInternal", "contextMenus"], "types": [ { "id": "ContextMenuItem", @@ -50,8 +50,7 @@ "name": "createProperties", "properties": { "type": { - "type": "string", - "enum": ["normal", "checkbox", "radio", "separator"], + "$ref": "contextMenus.ItemType", "optional": true, "description": "The type of menu item. Defaults to 'normal' if not specified." }, @@ -73,13 +72,12 @@ "contexts": { "type": "array", "items": { - "type": "string", // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API. - "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"] + "$ref": "contextMenus.ContextType" }, "minItems": 1, "optional": true, - "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is not supported for ." + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified." }, "onclick": { "type": "function", @@ -152,8 +150,7 @@ "description": "The properties to update. Accepts the same values as the create function.", "properties": { "type": { - "type": "string", - "enum": ["normal", "checkbox", "radio", "separator"], + "$ref": "contextMenus.ItemType", "optional": true }, "title": { @@ -167,13 +164,12 @@ "contexts": { "type": "array", "items": { - "type": "string", // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API. - "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"] + "$ref": "contextMenus.ContextType" }, "minItems": 1, "optional": true, - "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is not supported for ." + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified." }, "onclick": { "type": "function", diff --git a/chrome/common/extensions/api/chromeos_info_private.json b/chrome/common/extensions/api/chromeos_info_private.json index a5dc0a4d0da0..d792908473ee 100644 --- a/chrome/common/extensions/api/chromeos_info_private.json +++ b/chrome/common/extensions/api/chromeos_info_private.json @@ -9,6 +9,22 @@ "compiler_options": { "implemented_in": "chrome/browser/chromeos/extensions/info_private_api.h" }, + "types": [ + { + "id": "PropertyName", + "type": "string", + "enum": ["timezone", + "a11yLargeCursorEnabled", + "a11yStickyKeysEnabled", + "a11ySpokenFeedbackEnabled", + "a11yHighContrastEnabled", + "a11yScreenMagnifierEnabled", + "a11yAutoClickEnabled", + "a11yVirtualKeyboardEnabled", + "sendFunctionKeys"], + "description": "Chrome OS system property name" + } + ], "functions": [ { "name": "get", @@ -68,16 +84,7 @@ "parameters": [ { "name": "propertyName", - "type": "string", - "enum": ["timezone", - "a11yLargeCursorEnabled", - "a11yStickyKeysEnabled", - "a11ySpokenFeedbackEnabled", - "a11yHighContrastEnabled", - "a11yScreenMagnifierEnabled", - "a11yAutoClickEnabled", - "a11yVirtualKeyboardEnabled", - "sendFunctionKeys"], + "$ref": "PropertyName", "description": "Chrome OS system property name" }, { diff --git a/chrome/common/extensions/api/content_settings.json b/chrome/common/extensions/api/content_settings.json index b44bff59f619..b4bde704ccd6 100644 --- a/chrome/common/extensions/api/content_settings.json +++ b/chrome/common/extensions/api/content_settings.json @@ -27,6 +27,12 @@ "description": "The only content type using resource identifiers is $(ref:contentSettings.plugins). For more information, see Resource Identifiers." }, { + "id": "Scope", + "type": "string", + "enum": ["regular", "incognito_session_only"], + "description": "The scope of the ContentSetting. One of
regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings)." + }, + { "id": "ContentSetting", "js_module": "ContentSetting", "type": "object", @@ -41,10 +47,9 @@ "type": "object", "properties": { "scope": { - "type": "string", - "enum": ["regular", "incognito_session_only"], + "$ref": "Scope", "optional": true, - "description": "Where to clear the setting (default: regular). One of
regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings)." + "description": "Where to clear the setting (default: regular)." } } }, @@ -132,10 +137,9 @@ "description": "The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values." }, "scope": { - "type": "string", - "enum": ["regular", "incognito_session_only"], + "$ref": "Scope", "optional": true, - "description": "Where to set the setting (default: regular). One of
regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings)." + "description": "Where to set the setting (default: regular)." } } }, @@ -170,6 +174,61 @@ ] } ] + }, + { + "id": "CookiesContentSetting", + "type": "string", + "enum": ["allow", "block", "session_only"] + }, + { + "id": "ImagesContentSetting", + "type": "string", + "enum": ["allow", "block"] + }, + { + "id": "JavascriptContentSetting", + "type": "string", + "enum": ["allow", "block"] + }, + { + "id": "LocationContentSetting", + "type": "string", + "enum": ["allow", "block", "ask"] + }, + { + "id": "PluginsContentSetting", + "type": "string", + "enum": ["allow", "block"] + }, + { + "id": "PopupsContentSetting", + "type": "string", + "enum": ["allow", "block"] + }, + { + "id": "NotificationsContentSetting", + "type": "string", + "enum": ["allow", "block", "ask"] + }, + { + "id": "FullscreenContentSetting", + "type": "string", + "enum": ["allow", "ask"] + }, + { + "id": "MouselockContentSetting", + "type": "string", + "enum": ["allow", "block", "ask"] + }, + { + "id": "PpapiBrokerContentSetting", + "type": "string", + "enum": ["allow", "block", "ask"] + }, + { + "id": "MultipleAutomaticDownloadsContentSetting", + "type": "string", + "enum": ["allow", "block", "ask"] } ], "properties": { @@ -178,7 +237,7 @@ "description": "Whether to allow cookies and other local data to be set by websites. One of
allow: Accept cookies,
block: Block cookies,
session_only: Accept cookies only for the current session.
Default is allow.
The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.", "value": [ "cookies", - {"type":"string", "enum": ["allow", "block", "session_only"]} + {"$ref":"CookiesContentSetting"} ] }, "images": { @@ -186,7 +245,7 @@ "description": "Whether to show images. One of
allow: Show images,
block: Don't show images.
Default is allow.
The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image.", "value": [ "images", - {"type":"string", "enum": ["allow", "block"]} + {"$ref":"ImagesContentSetting"} ] }, "javascript": { @@ -194,7 +253,7 @@ "description": "Whether to run JavaScript. One of
allow: Run JavaScript,
block: Don't run JavaScript.
Default is allow.
The primary URL is the URL of the top-level frame. The secondary URL is not used.", "value": [ "javascript", - {"type":"string", "enum": ["allow", "block"]} + {"$ref":"JavascriptContentSetting"} ] }, "location": { @@ -202,7 +261,7 @@ "description": "Whether to allow Geolocation. One of
allow: Allow sites to track your physical location,
block: Don't allow sites to track your physical location,
ask: Ask before allowing sites to track your physical location.
Default is ask.
The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).", "value": [ "location", - {"type":"string", "enum": ["allow", "block", "ask"]} + {"$ref":"LocationContentSetting"} ] }, "plugins": { @@ -210,7 +269,7 @@ "description": "Whether to run plugins. One of
allow: Run plugins automatically,
block: Don't run plugins automatically.
Default is allow.
The primary URL is the URL of the top-level frame. The secondary URL is not used.", "value": [ "plugins", - {"type":"string", "enum": ["allow", "block"]} + {"$ref":"PluginsContentSetting"} ] }, "popups": { @@ -218,7 +277,7 @@ "description": "Whether to allow sites to show pop-ups. One of
allow: Allow sites to show pop-ups,
block: Don't allow sites to show pop-ups.
Default is block.
The primary URL is the URL of the top-level frame. The secondary URL is not used.", "value": [ "popups", - {"type":"string", "enum": ["allow", "block"]} + {"$ref":"PopupsContentSetting"} ] }, "notifications": { @@ -226,7 +285,7 @@ "description": "Whether to allow sites to show desktop notifications. One of
allow: Allow sites to show desktop notifications,
block: Don't allow sites to show desktop notifications,
ask: Ask when a site wants to show desktop notifications.
Default is ask.
The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used.", "value": [ "notifications", - {"type":"string", "enum": ["allow", "block", "ask"]} + {"$ref":"NotificationsContentSetting"} ] }, "fullscreen": { @@ -234,7 +293,7 @@ "description": "Whether to allow sites to toggle the fullscreen mode. One of
allow: Allow sites to toggle the fullscreen mode,
ask: Ask when a site wants to toggle the fullscreen mode.
Default is ask.
The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).", "value": [ "fullscreen", - {"type":"string", "enum": ["allow", "ask"]} + {"$ref":"FullscreenContentSetting"} ] }, "mouselock": { @@ -242,7 +301,7 @@ "description": "Whether to allow sites to disable the mouse cursor. One of
allow: Allow sites to disable the mouse cursor,
block: Don't allow sites to disable the mouse cursor,
ask: Ask when a site wants to disable the mouse cursor.
Default is ask.
The primary URL is the URL of the top-level frame. The secondary URL is not used.", "value": [ "mouselock", - {"type":"string", "enum": ["allow", "block", "ask"]} + {"$ref":"MouselockContentSetting"} ] }, "unsandboxedPlugins": { @@ -250,7 +309,7 @@ "description": "Whether to allow sites to run plugins unsandboxed. One of
allow: Allow sites to run plugins unsandboxed,
block: Don't allow sites to run plugins unsandboxed,
ask: Ask when a site wants to run a plugin unsandboxed.
Default is ask.
The primary URL is the URL of the top-level frame. The secondary URL is not used.", "value": [ "ppapi-broker", - {"type":"string", "enum": ["allow", "block", "ask"]} + {"$ref":"PpapiBrokerContentSetting"} ] }, "automaticDownloads": { @@ -258,7 +317,7 @@ "description": "Whether to allow sites to download multiple files automatically. One of
allow: Allow sites to download multiple files automatically,
block: Don't allow sites to download multiple files automatically,
ask: Ask when a site wants to download files automatically after the first file.
Default is ask.
The primary URL is the URL of the top-level frame. The secondary URL is not used.", "value": [ "multiple-automatic-downloads", - {"type":"string", "enum": ["allow", "block", "ask"]} + {"$ref":"MultipleAutomaticDownloadsContentSetting"} ] } } diff --git a/chrome/common/extensions/api/context_menus.json b/chrome/common/extensions/api/context_menus.json index 3a8c2818663d..778d7a2783cb 100644 --- a/chrome/common/extensions/api/context_menus.json +++ b/chrome/common/extensions/api/context_menus.json @@ -12,6 +12,20 @@ "description": "The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored." } }, + "types": [ + { + "id": "ContextType", + "type": "string", + "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"], + "description": "The different contexts a menu can appear in. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is only supported by apps and is used to add menu items to the context menu that appears when clicking on the app icon in the launcher/taskbar/dock/etc. Different platforms might put limitations on what is actually supported in a launcher context menu." + }, + { + "id": "ItemType", + "type": "string", + "enum": ["normal", "checkbox", "radio", "separator"], + "description": "The type of menu item." + } + ], "functions": [ { "name": "create", @@ -30,8 +44,7 @@ "name": "createProperties", "properties": { "type": { - "type": "string", - "enum": ["normal", "checkbox", "radio", "separator"], + "$ref": "ItemType", "optional": true, "description": "The type of menu item. Defaults to 'normal' if not specified." }, @@ -53,12 +66,11 @@ "contexts": { "type": "array", "items": { - "type": "string", - "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"] + "$ref": "ContextType" }, "minItems": 1, "optional": true, - "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is only supported by apps and is used to add menu items to the context menu that appears when clicking on the app icon in the launcher/taskbar/dock/etc. Different platforms might put limitations on what is actually supported in a launcher context menu." + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified." }, "onclick": { "type": "function", @@ -133,8 +145,7 @@ "description": "The properties to update. Accepts the same values as the create function.", "properties": { "type": { - "type": "string", - "enum": ["normal", "checkbox", "radio", "separator"], + "$ref": "ItemType", "optional": true }, "title": { @@ -148,8 +159,7 @@ "contexts": { "type": "array", "items": { - "type": "string", - "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"] + "$ref": "ContextType" }, "minItems": 1, "optional": true diff --git a/chrome/common/extensions/api/cookies.json b/chrome/common/extensions/api/cookies.json index 8c083ac6d195..5629e95e4ab4 100644 --- a/chrome/common/extensions/api/cookies.json +++ b/chrome/common/extensions/api/cookies.json @@ -32,6 +32,12 @@ "id": {"type": "string", "description": "The unique identifier for the cookie store."}, "tabIds": {"type": "array", "items": {"type": "integer"}, "description": "Identifiers of all the browser tabs that share this cookie store."} } + }, + { + "id": "OnChangedCause", + "type": "string", + "enum": ["evicted", "expired", "explicit", "expired_overwrite", "overwrite"], + "description": "The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to \"chrome.cookies.remove\", \"cause\" will be \"explicit\". If a cookie was automatically removed due to expiry, \"cause\" will be \"expired\". If a cookie was removed due to being overwritten with an already-expired expiration date, \"cause\" will be set to \"expired_overwrite\". If a cookie was automatically removed due to garbage collection, \"cause\" will be \"evicted\". If a cookie was automatically removed due to a \"set\" call that overwrote it, \"cause\" will be \"overwrite\". Plan your response accordingly." } ], "functions": [ @@ -190,7 +196,7 @@ "properties": { "removed": {"type": "boolean", "description": "True if a cookie was removed."}, "cookie": {"$ref": "Cookie", "description": "Information about the cookie that was set or removed."}, - "cause": {"min_version": "12.0.707.0", "type": "string", "enum": ["evicted", "expired", "explicit", "expired_overwrite", "overwrite"], "description": "The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to \"chrome.cookies.remove\", \"cause\" will be \"explicit\". If a cookie was automatically removed due to expiry, \"cause\" will be \"expired\". If a cookie was removed due to being overwritten with an already-expired expiration date, \"cause\" will be set to \"expired_overwrite\". If a cookie was automatically removed due to garbage collection, \"cause\" will be \"evicted\". If a cookie was automatically removed due to a \"set\" call that overwrote it, \"cause\" will be \"overwrite\". Plan your response accordingly."} + "cause": {"min_version": "12.0.707.0", "$ref": "OnChangedCause", "description": "The underlying reason behind the cookie's change."} } } ] diff --git a/chrome/common/extensions/api/debugger.json b/chrome/common/extensions/api/debugger.json index b08635ee5b62..cf4e7b81d0e4 100644 --- a/chrome/common/extensions/api/debugger.json +++ b/chrome/common/extensions/api/debugger.json @@ -18,14 +18,25 @@ } }, { + "id": "TargetInfoType", + "type": "string", + "description": "Target type.", + "enum" : ["page", "background_page", "worker", "other" ] + }, + { + "id": "DetachReason", + "type": "string", + "description": "Connection termination reason.", + "enum": [ "target_closed", "canceled_by_user", "replaced_with_devtools" ] + }, + { "id": "TargetInfo", "type": "object", "description": "Debug target information", "properties": { "type": { - "type": "string", - "description": "Target type.", - "enum" : ["page", "background_page", "worker", "other" ] + "$ref": "TargetInfoType", + "description": "Target type." }, "id": { "type": "string", "description": "Target id." }, "tabId": { "type": "integer", "optional": true, "description": "The tab id, defined if type == 'page'." }, @@ -176,10 +187,9 @@ "description": "The debuggee that was detached." }, { - "type": "string", + "$ref": "DetachReason", "name": "reason", - "description": "Connection termination reason.", - "enum": [ "target_closed", "canceled_by_user", "replaced_with_devtools" ] + "description": "Connection termination reason." } ] } diff --git a/chrome/common/extensions/api/extension.json b/chrome/common/extensions/api/extension.json index b69b12e7c05f..c83f89eccaa6 100644 --- a/chrome/common/extensions/api/extension.json +++ b/chrome/common/extensions/api/extension.json @@ -24,6 +24,14 @@ "description": "True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior." } }, + "types": [ + { + "id": "ViewType", + "type": "string", + "enum": ["tab", "notification", "popup"], + "description": "The type of extension view." + } + ], "functions": [ { "name": "sendRequest", @@ -78,8 +86,7 @@ "optional": true, "properties": { "type": { - "type": "string", - "enum": ["tab", "notification", "popup"], + "$ref": "ViewType", "optional": true, "description": "The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'notification', 'popup'." }, diff --git a/chrome/common/extensions/api/history.json b/chrome/common/extensions/api/history.json index c4e11cc83859..946888ebaee8 100644 --- a/chrome/common/extensions/api/history.json +++ b/chrome/common/extensions/api/history.json @@ -8,6 +8,12 @@ "description": "Use the chrome.history API to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see Override Pages.", "types": [ { + "id": "TransitionType", + "type": "string", + "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "auto_toplevel", "form_submit", "reload", "keyword", "keyword_generated"], + "description": "The transition type for this visit from its referrer." + }, + { "id": "HistoryItem", "type": "object", "description": "An object encapsulating one result of a history query.", @@ -30,8 +36,7 @@ "visitTime": {"type": "number", "optional": true, "description": "When this visit occurred, represented in milliseconds since the epoch."}, "referringVisitId": {"type": "string", "description": "The visit ID of the referrer."}, "transition": { - "type": "string", - "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "auto_toplevel", "form_submit", "reload", "keyword", "keyword_generated"], + "$ref": "TransitionType", "description": "The transition type for this visit from its referrer." } } diff --git a/chrome/common/extensions/api/input_ime.json b/chrome/common/extensions/api/input_ime.json index cc186dc0b6d8..cb41d2934f73 100644 --- a/chrome/common/extensions/api/input_ime.json +++ b/chrome/common/extensions/api/input_ime.json @@ -8,11 +8,16 @@ "description": "Use the chrome.input.ime API to implement a custom IME for Chrome OS. This allows your extension to handle keystrokes, set the composition, and manage the candidate window.", "types": [ { + "id": "KeyboardEventType", + "type": "string", + "enum": ["keyup", "keydown"] + }, + { "id": "KeyboardEvent", "type": "object", "description": "See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent", "properties": { - "type": {"type": "string", "description": "One of keyup or keydown.", "enum": ["keyup", "keydown"]}, + "type": {"$ref": "KeyboardEventType", "description": "One of keyup or keydown."}, "requestId": {"type": "string", "description": "The ID of the request."}, "extensionId": {"type": "string", "optional": true, "description": "The extension ID of the sender of this keyevent."}, "key": {"type": "string", "description": "Value of the key being pressed"}, @@ -25,18 +30,30 @@ } }, { + "id": "InputContextType", + "type": "string", + "description": "Type of value this text field edits, (Text, Number, URL, etc)", + "enum": ["text", "search", "tel", "url", "email", "number", "password"] + }, + { "id": "InputContext", "type": "object", "description": "Describes an input Context", "properties": { "contextID": {"type": "integer", "description": "This is used to specify targets of text field operations. This ID becomes invalid as soon as onBlur is called."}, - "type": {"type": "string", "description": "Type of value this text field edits, (Text, Number, URL, etc)", "enum": ["text", "search", "tel", "url", "email", "number", "password"]}, + "type": {"$ref": "InputContextType", "description": "Type of value this text field edits, (Text, Number, URL, etc)"}, "autoCorrect": {"type": "boolean", "description": "Whether the text field wants auto-correct."}, "autoComplete": {"type": "boolean", "description": "Whether the text field wants auto-complete."}, "spellCheck": {"type": "boolean", "description": "Whether the text field wants spell-check."} } }, { + "id": "MenuItemStyle", + "type": "string", + "description": "The type of menu item. Radio buttons between separators are considered grouped.", + "enum": ["check", "radio", "separator"] + }, + { "id": "MenuItem", "type": "object", "description": "A menu item used by an input method to interact with the user from the language menu.", @@ -44,15 +61,43 @@ "id": {"type": "string", "description": "String that will be passed to callbacks referencing this MenuItem."}, "label": {"type": "string", "optional": true, "description": "Text displayed in the menu for this item."}, "style": { - "type": "string", + "$ref": "MenuItemStyle", "optional": true, - "description": "Enum representing if this item is: check, radio, or a separator. Radio buttons between separators are considered grouped.", - "enum": ["check", "radio", "separator"] + "description": "The type of menu item." }, "visible": {"type": "boolean", "optional": true, "description": "Indicates this item is visible."}, "checked": {"type": "boolean", "optional": true, "description": "Indicates this item should be drawn with a check."}, "enabled": {"type": "boolean", "optional": true, "description": "Indicates this item is enabled."} } + }, + { + "id": "UnderlineStyle", + "type": "string", + "description": "The type of the underline to modify this segment.", + "enum": ["underline", "doubleUnderline", "noUnderline"] + }, + { + "id": "WindowPosition", + "type": "string", + "description": "Where to display the candidate window. If set to 'cursor', the window follows the cursor. If set to 'composition', the window is locked to the beginning of the composition.", + "enum": ["cursor", "composition"] + }, + { + "id": "ScreenType", + "type": "string", + "enum": ["normal", "login", "lock", "secondary-login"], + "description": "The screen type under which the IME is activated." + }, + { + "id": "CallbackStyle", + "type": "string", + "enum": ["async"] + }, + { + "id": "MouseButton", + "type": "string", + "description": "Which mouse buttons was clicked.", + "enum": ["left", "middle", "right"] } ], "functions": [ @@ -103,9 +148,8 @@ "type": "integer" }, "style": { - "description": "The type of the underline to modify this segment.", - "enum": ["underline", "doubleUnderline", "noUnderline"], - "type": "string" + "$ref": "UnderlineStyle", + "description": "The type of the underline to modify this segment." } } } @@ -272,9 +316,8 @@ "description": "True to display the auxiliary text, false to hide it." }, "windowPosition": { - "type": "string", - "description": "Where to display the candidate window. If set to 'cursor', the window follows the cursor. If set to 'composition', the window is locked to the beginning of the composition.", - "enum": ["cursor", "composition"], + "$ref": "WindowPosition", + "description": "Where to display the candidate window.", "optional": true } } @@ -501,9 +544,8 @@ "description": "ID of the engine receiving the event" }, { - "type": "string", "name": "screen", - "enum": ["normal", "login", "lock", "secondary-login"], + "$ref": "ScreenType", "description": "The screen type under which the IME is activated." } ] @@ -585,8 +627,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that specifies how the callback is invoked.", "items": { - "type": "string", - "enum": ["async"] + "$ref": "CallbackStyle" } } ], @@ -612,10 +653,9 @@ "description": "ID of the candidate that was clicked." }, { - "type": "string", "name": "button", - "description": "Which mouse buttons was clicked.", - "enum": ["left", "middle", "right"] + "$ref": "MouseButton", + "description": "Which mouse buttons was clicked." } ] }, diff --git a/chrome/common/extensions/api/metrics_private.json b/chrome/common/extensions/api/metrics_private.json index 0778440b325d..ba8cc901228c 100644 --- a/chrome/common/extensions/api/metrics_private.json +++ b/chrome/common/extensions/api/metrics_private.json @@ -8,15 +8,19 @@ "description": "none", "types": [ { + "id": "MetricTypeType", + "type": "string", + "enum": ["histogram-log", "histogram-linear"], + "description": "The type of metric, such as 'histogram-log' or 'histogram-linear'." + }, + { "id": "MetricType", "type": "object", "description": "Describes the type of metric that is to be collected.", "properties": { "metricName": {"type": "string", "description": "A unique name within the extension for the metric."}, "type": { - "type": "string", - "enum": ["histogram-log", "histogram-linear"], - "description": "The type of metric, such as 'histogram-log' or 'histogram-linear'." + "$ref": "MetricTypeType" }, "min": {"type": "integer", "description": "The minimum sample value to be recoded. Must be greater than zero."}, "max": {"type": "integer", "description": "The maximum sample value to be recoded."}, diff --git a/chrome/common/extensions/api/omnibox.json b/chrome/common/extensions/api/omnibox.json index 9d552e5c88b5..614f5ec6f080 100644 --- a/chrome/common/extensions/api/omnibox.json +++ b/chrome/common/extensions/api/omnibox.json @@ -8,6 +8,18 @@ "description": "The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.", "types": [ { + "id": "DescriptionStyleType", + "type": "string", + "description": "The style type.", + "enum": ["url", "match", "dim"] + }, + { + "id": "OnInputEnteredDisposition", + "type": "string", + "enum": ["currentTab", "newForegroundTab", "newBackgroundTab"], + "description": "The window disposition for the omnibox query. This is the recommended context to display results. For example, if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should take place in a new selected tab." + }, + { "id": "SuggestResult", "type": "object", "description": "A suggest result.", @@ -33,7 +45,7 @@ "description": "The style ranges for the description, as provided by the extension.", "properties": { "offset": { "type": "integer" }, - "type": { "description": "The style type", "type": "string", "enum": ["url", "match", "dim"]}, + "type": { "description": "The style type", "$ref": "DescriptionStyleType"}, "length": { "type": "integer", "optional": true } } } @@ -77,7 +89,7 @@ "description": "The style ranges for the description, as provided by the extension.", "properties": { "offset": { "type": "integer" }, - "type": { "description": "The style type", "type": "string", "enum": ["url", "match", "dim"]}, + "type": { "description": "The style type", "$ref": "DescriptionStyleType"}, "length": { "type": "integer", "optional": true } } } @@ -175,9 +187,7 @@ }, { "name": "disposition", - "type": "string", - "enum": ["currentTab", "newForegroundTab", "newBackgroundTab"], - "description": "The window disposition for the omnibox query. This is the recommended context to display results. For example, if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should take place in a new selected tab." + "$ref": "OnInputEnteredDisposition" } ] }, diff --git a/chrome/common/extensions/api/system_private.json b/chrome/common/extensions/api/system_private.json index ea9ae38f8975..4f00e07b7ae9 100644 --- a/chrome/common/extensions/api/system_private.json +++ b/chrome/common/extensions/api/system_private.json @@ -8,14 +8,25 @@ "description": "none", "types": [ { + "id": "UpdateStatusState", + "type": "string", + "enum": ["NotAvailable", "Updating", "NeedRestart"], + "description": "State of system update. NotAvailable when there is no available update or the update system is in error state, Updating when a system update is in progress, NeedRestart when a system update is finished and restart is needed." + }, + { + "id": "GetIncognitoModeAvailabilityValue", + "type": "string", + "enum": ["enabled", "disabled", "forced"], + "description": "Exposes whether the incognito mode is available to windows. One of 'enabled', 'disabled' (user cannot browse pages in Incognito mode), 'forced' (all pages/sessions are forced into Incognito mode)." + }, + { "id": "UpdateStatus", "type": "object", "description": "Information about the system update.", "properties": { "state": { - "type": "string", - "enum": ["NotAvailable", "Updating", "NeedRestart"], - "description": "State of system update. NotAvailable when there is no available update or the update system is in error state, Updating when a system update is in progress, NeedRestart when a system update is finished and restart is needed." + "$ref": "UpdateStatusState", + "description": "State of system update." }, "downloadProgress": { "type": "number", @@ -61,9 +72,7 @@ "parameters": [ { "name": "value", - "type": "string", - "enum": ["enabled", "disabled", "forced"], - "description": "Exposes whether the incognito mode is available to windows. One of 'enabled', 'disabled' (user cannot browse pages in Incognito mode), 'forced' (all pages/sessions are forced into Incognito mode)." + "$ref": "GetIncognitoModeAvailabilityValue" } ] } diff --git a/chrome/common/extensions/api/tabs.json b/chrome/common/extensions/api/tabs.json index f187633f2727..583ff92f3388 100644 --- a/chrome/common/extensions/api/tabs.json +++ b/chrome/common/extensions/api/tabs.json @@ -31,43 +31,53 @@ } }, { + "id": "ZoomSettingsMode", + "type": "string", + "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to automatic.", + "enum": [ + { + "name": "automatic", + "description": "Zoom changes are handled automatically by the browser." + }, + { + "name": "manual", + "description": "Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support per-origin zooming, and will thus ignore the scope zoom setting and assume per-tab." + }, + { + "name": "disabled", + "description": "Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored." + } + ] + }, + { + "id": "ZoomSettingsScope", + "type": "string", + "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise.", + "enum": [ + { + "name": "per-origin", + "description": "Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The per-origin scope is only available in the automatic mode." + }, + { + "name": "per-tab", + "description": "Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, per-tab zoom changes are reset on navigation; navigating a tab will always load pages with their per-origin zoom factors." + } + ] + }, + { "id": "ZoomSettings", "type": "object", "description": "Defines how zoom changes in a tab are handled and at what scope.", "properties": { "mode": { - "type": "string", + "$ref": "ZoomSettingsMode", "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to automatic.", - "optional": true, - "enum": [ - { - "name": "automatic", - "description": "Zoom changes are handled automatically by the browser." - }, - { - "name": "manual", - "description": "Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support per-origin zooming, and will thus ignore the scope zoom setting and assume per-tab." - }, - { - "name": "disabled", - "description": "Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored." - } - ] + "optional": true }, "scope": { - "type": "string", + "$ref": "ZoomSettingsScope", "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise.", - "optional": true, - "enum": [ - { - "name": "per-origin", - "description": "Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The per-origin scope is only available in the automatic mode." - }, - { - "name": "per-tab", - "description": "Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, per-tab zoom changes are reset on navigation; navigating a tab will always load pages with their per-origin zoom factors." - } - ] + "optional": true }, "default_zoom_factor": { "type": "number", @@ -76,6 +86,18 @@ "description": "Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings." } } + }, + { + "id": "TabStatus", + "type": "string", + "enum": ["loading", "complete"], + "description": "Whether the tabs have completed loading." + }, + { + "id": "WindowType", + "type": "string", + "enum": ["normal", "popup", "panel", "app"], + "description": "The type of window." } ], "functions": [ @@ -388,9 +410,8 @@ "description": "Whether the tabs are in the last focused window." }, "status": { - "type": "string", + "$ref": "TabStatus", "optional": true, - "enum": ["loading", "complete"], "description": "Whether the tabs have completed loading." }, "title": { @@ -413,9 +434,8 @@ "description": "The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the current window." }, "windowType": { - "type": "string", + "$ref": "WindowType", "optional": true, - "enum": ["normal", "popup", "panel", "app"], "description": "The type of window the tabs are in." }, "index": { diff --git a/chrome/common/extensions/api/terminal_private.json b/chrome/common/extensions/api/terminal_private.json index 424db327aa67..452aab13e0b4 100644 --- a/chrome/common/extensions/api/terminal_private.json +++ b/chrome/common/extensions/api/terminal_private.json @@ -9,6 +9,14 @@ "implemented_in": "chrome/browser/extensions/api/terminal/terminal_private_api.h" }, "description": "none", + "types": [ + { + "id": "OutputType", + "type": "string", + "enum": ["stdout", "stderr", "exit"], + "description": "Type of the output stream from which output came. When process exits, output type will be set to exit" + } + ], "functions": [ { "name": "openTerminalProcess", @@ -136,9 +144,8 @@ }, { "name": "type", - "type": "string", - "description": "Type of the output stream from which output came. When process exits, output type will be set to exit", - "enum": ["stdout", "stderr", "exit"] + "$ref": "OutputType", + "description": "Type of the output stream from which output came. When process exits, output type will be set to exit" }, { "name": "text", diff --git a/chrome/common/extensions/api/types.json b/chrome/common/extensions/api/types.json index 1a7c3063dbb9..cc59b8ef4c24 100644 --- a/chrome/common/extensions/api/types.json +++ b/chrome/common/extensions/api/types.json @@ -8,6 +8,18 @@ "description": "The chrome.types API contains type declarations for Chrome.", "types": [ { + "id": "ChromeSettingScope", + "type": "string", + "enum": ["regular", "regular_only", "incognito_persistent", "incognito_session_only"], + "description": "The scope of the ChromeSetting. One of
  • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere),
  • regular_only: setting for the regular profile only (not inherited by the incognito profile),
  • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences),
  • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences).
" + }, + { + "id": "LevelOfControl", + "type": "string", + "enum": ["not_controllable", "controlled_by_other_extensions", "controllable_by_this_extension", "controlled_by_this_extension"], + "description": "One of
  • not_controllable: cannot be controlled by any extension
  • controlled_by_other_extensions: controlled by extensions with higher precedence
  • controllable_by_this_extension: can be controlled by this extension
  • controlled_by_this_extension: controlled by this extension
" + }, + { "id": "ChromeSetting", "type": "object", "js_module": "ChromeSetting", @@ -46,9 +58,8 @@ "type": "any" }, "levelOfControl": { - "description": "One of
  • not_controllable: cannot be controlled by any extension
  • controlled_by_other_extensions: controlled by extensions with higher precedence
  • controllable_by_this_extension: can be controlled by this extension
  • controlled_by_this_extension: controlled by this extension
", - "type": "string", - "enum": ["not_controllable", "controlled_by_other_extensions", "controllable_by_this_extension", "controlled_by_this_extension"] + "$ref": "LevelOfControl", + "description": "The level of control of the setting." }, "incognitoSpecific": { "description": "Whether the effective value is specific to the incognito session.
This property will only be present if the incognito property in the details parameter of get() was true.", @@ -77,10 +88,9 @@ "type": "any" }, "scope": { - "type": "string", - "enum": ["regular", "regular_only", "incognito_persistent", "incognito_session_only"], + "$ref": "ChromeSettingScope", "optional": true, - "description": "Where to set the setting (default: regular). One of
  • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere),
  • regular_only: setting for the regular profile only (not inherited by the incognito profile),
  • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences),
  • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences).
" + "description": "Where to set the setting (default: regular)." } } }, @@ -105,10 +115,9 @@ "description": "Which setting to clear.", "properties": { "scope": { - "type": "string", - "enum": ["regular", "regular_only", "incognito_persistent", "incognito_session_only"], + "$ref": "ChromeSettingScope", "optional": true, - "description": "Where to clear the setting (default: regular). One of
  • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere),
  • regular_only: setting for the regular profile only (not inherited by the incognito profile),
  • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences),
  • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences).
" + "description": "Where to clear the setting (default: regular)." } } }, @@ -136,9 +145,8 @@ "type": "any" }, "levelOfControl": { - "description": "One of
  • not_controllable: cannot be controlled by any extension
  • controlled_by_other_extensions: controlled by extensions with higher precedence
  • controllable_by_this_extension: can be controlled by this extension
  • controlled_by_this_extension: controlled by this extension
", - "type": "string", - "enum": ["not_controllable", "controlled_by_other_extensions", "controllable_by_this_extension", "controlled_by_this_extension"] + "$ref": "LevelOfControl", + "description": "The level of control of the setting." }, "incognitoSpecific": { "description": "Whether the value that has changed is specific to the incognito session.
This property will only be present if the user has enabled the extension in incognito mode.", diff --git a/chrome/common/extensions/api/wallpaper.json b/chrome/common/extensions/api/wallpaper.json index 3b32abdb2eb0..fef422ad7c30 100644 --- a/chrome/common/extensions/api/wallpaper.json +++ b/chrome/common/extensions/api/wallpaper.json @@ -9,6 +9,15 @@ "implemented_in": "chrome/browser/chromeos/extensions/wallpaper_api.h" }, "description": "Use the chrome.wallpaper API to change the ChromeOS wallpaper.", + "types": + [ + { + "id": "WallpaperLayout", + "type": "string", + "enum": [ "STRETCH", "CENTER", "CENTER_CROPPED" ], + "description": "The supported wallpaper layouts." + } + ], "functions": [ { "name": "setWallpaper", @@ -30,8 +39,7 @@ "description": "The URL of the wallpaper to be set." }, "layout": { - "type": "string", - "enum": [ "STRETCH", "CENTER", "CENTER_CROPPED" ], + "$ref": "WallpaperLayout", "description": "The supported wallpaper layouts." }, "filename": { diff --git a/chrome/common/extensions/api/wallpaper_private.json b/chrome/common/extensions/api/wallpaper_private.json index 6a8828081dbe..b2b6c933f47a 100644 --- a/chrome/common/extensions/api/wallpaper_private.json +++ b/chrome/common/extensions/api/wallpaper_private.json @@ -11,9 +11,9 @@ "description": "none", "types": [ { - "id": "WallpaperLayout", + "id": "WallpaperSource", "type": "string", - "enum": [ "STRETCH", "CENTER", "CENTER_CROPPED" ] + "enum": [ "ONLINE", "OEM" ] } ], "functions": [ @@ -67,7 +67,7 @@ }, { "name": "layout", - "$ref": "WallpaperLayout" + "$ref": "wallpaper.WallpaperLayout" }, { "type": "function", @@ -93,7 +93,7 @@ }, { "name": "layout", - "$ref": "WallpaperLayout" + "$ref": "wallpaper.WallpaperLayout" }, { "type": "string", @@ -125,7 +125,7 @@ }, { "name": "layout", - "$ref": "WallpaperLayout" + "$ref": "wallpaper.WallpaperLayout" }, { "type": "boolean", @@ -157,7 +157,7 @@ "parameters": [ { "name": "layout", - "$ref": "WallpaperLayout" + "$ref": "wallpaper.WallpaperLayout" }, { "type": "function", @@ -193,8 +193,7 @@ }, { "name": "source", - "type": "string", - "enum": [ "ONLINE", "OEM" ] + "$ref": "WallpaperSource" }, { "type": "function", diff --git a/chrome/common/extensions/api/web_navigation.json b/chrome/common/extensions/api/web_navigation.json index e27fb7c74779..fb79b82f2555 100644 --- a/chrome/common/extensions/api/web_navigation.json +++ b/chrome/common/extensions/api/web_navigation.json @@ -6,7 +6,19 @@ { "namespace": "webNavigation", "description": "Use the chrome.webNavigation API to receive notifications about the status of navigation requests in-flight.", - "types": [], + "types": [ + { + "id": "TransitionType", + "type": "string", + "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], + "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the history API except with \"start_page\" in place of \"auto_toplevel\" (for backwards compatibility)." + }, + { + "id": "TransitionQualifier", + "type": "string", + "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"] + } + ], "functions": [ { "name": "getFrame", @@ -149,8 +161,8 @@ "url": {"type": "string"}, "processId": {"type": "integer", "description": "The ID of the process runs the renderer for this tab."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, - "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the history API except with \"start_page\" in place of \"auto_toplevel\" (for backwards compatibility)."}, - "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"]}}, + "transitionType": {"$ref": "TransitionType", "description": "Cause of the navigation."}, + "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"$ref": "TransitionQualifier"}}, "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} } } @@ -283,8 +295,8 @@ "url": {"type": "string"}, "processId": {"type": "integer", "description": "The ID of the process runs the renderer for this tab."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, - "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the history API except with \"start_page\" in place of \"auto_toplevel\" (for backwards compatibility)."}, - "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"]}}, + "transitionType": {"$ref": "TransitionType", "description": "Cause of the navigation."}, + "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"$ref": "TransitionQualifier"}}, "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} } } @@ -327,8 +339,8 @@ "url": {"type": "string"}, "processId": {"type": "integer", "description": "The ID of the process runs the renderer for this tab."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, - "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the history API except with \"start_page\" in place of \"auto_toplevel\" (for backwards compatibility)."}, - "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"]}}, + "transitionType": {"$ref": "TransitionType", "description": "Cause of the navigation."}, + "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"$ref": "TransitionQualifier"}}, "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} } } diff --git a/chrome/common/extensions/api/webstore_private.json b/chrome/common/extensions/api/webstore_private.json index 43ccdd454e66..aa6642c139ef 100644 --- a/chrome/common/extensions/api/webstore_private.json +++ b/chrome/common/extensions/api/webstore_private.json @@ -66,6 +66,11 @@ "description": "The extension is already installed" }], "description": "Whether the API call succeeded, or the reason for failure." + }, + { + "id": "WebGlStatus", + "type": "string", + "enum": ["webgl_allowed", "webgl_blocked"] } ], "functions": [ @@ -366,8 +371,7 @@ "parameters": [ { "name": "webgl_status", - "type": "string", - "enum": ["webgl_allowed", "webgl_blocked"] + "$ref": "WebGlStatus" } ] } diff --git a/chrome/common/extensions/api/windows.json b/chrome/common/extensions/api/windows.json index 9d8bab2f3696..50edb7f64874 100644 --- a/chrome/common/extensions/api/windows.json +++ b/chrome/common/extensions/api/windows.json @@ -11,6 +11,18 @@ }, "types": [ { + "id": "WindowType", + "type": "string", + "description": "The type of browser window this is. Under some circumstances a Window may not be assigned type property, for example when querying closed windows from the $(ref:sessions) API.", + "enum": ["normal", "popup", "panel", "app"] + }, + { + "id": "WindowState", + "type": "string", + "description": "The state of this browser window. Under some circumstances a Window may not be assigned state property, for example when querying closed windows from the $(ref:sessions) API.", + "enum": ["normal", "minimized", "maximized", "fullscreen"] + }, + { "id": "Window", "type": "object", "properties": { @@ -23,20 +35,24 @@ "tabs": {"type": "array", "items": { "$ref": "tabs.Tab" }, "optional": true, "description": "Array of $(ref:tabs.Tab) objects representing the current tabs in the window."}, "incognito": {"type": "boolean", "description": "Whether the window is incognito."}, "type": { - "type": "string", + "$ref": "WindowType", "optional": true, - "description": "The type of browser window this is. Under some circumstances a Window may not be assigned type property, for example when querying closed windows from the $(ref:sessions) API.", - "enum": ["normal", "popup", "panel", "app"] + "description": "The type of browser window this is." }, "state": { - "type": "string", + "$ref": "WindowState", "optional": true, - "description": "The state of this browser window. Under some circumstances a Window may not be assigned state property, for example when querying closed windows from the $(ref:sessions) API.", - "enum": ["normal", "minimized", "maximized", "fullscreen"] + "description": "The state of this browser window." }, "alwaysOnTop": {"type": "boolean", "description": "Whether the window is set to be always on top."}, "sessionId": {"type": "string", "optional": true, "description": "The session ID used to uniquely identify a Window obtained from the $(ref:sessions) API."} } + }, + { + "id": "CreateType", + "type": "string", + "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set.", + "enum": ["normal", "popup", "panel", "detached_panel"] } ], "properties": { @@ -176,10 +192,9 @@ "focused": {"type": "boolean", "optional": true, "description": "If true, opens an active window. If false, opens an inactive window."}, "incognito": {"type": "boolean", "optional": true, "description": "Whether the new window should be an incognito window."}, "type": { - "type": "string", + "$ref": "CreateType", "optional": true, - "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set.", - "enum": ["normal", "popup", "panel", "detached_panel"] + "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set." } }, "optional": true @@ -214,10 +229,9 @@ "focused": {"type": "boolean", "optional": true, "description": "If true, brings the window to the front. If false, brings the next window in the z-order to the front."}, "drawAttention": {"type": "boolean", "optional": true, "description": "If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request."}, "state": { - "type": "string", + "$ref": "WindowState", "optional": true, - "description": "The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'.", - "enum": ["normal", "minimized", "maximized", "fullscreen"] + "description": "The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'." } } }, diff --git a/chrome/test/data/extensions/webui/runtime_last_error.js b/chrome/test/data/extensions/webui/runtime_last_error.js index 81fc571446ff..c2c0edb134be 100644 --- a/chrome/test/data/extensions/webui/runtime_last_error.js +++ b/chrome/test/data/extensions/webui/runtime_last_error.js @@ -6,20 +6,19 @@ var success = true; -if (!chrome.test.checkDeepEq({}, chrome.runtime)) { - console.error('Expected {}, Actual ' + JSON.stringify(chrome.runtime)); +if (!chrome.test.checkDeepEq(undefined, chrome.runtime.lastError)) { + console.error('Expected undefined, Actual ' + + JSON.stringify(chrome.runtime.lastError)); success = false; } chrome.test.sendMessage('ping', function(reply) { var expected = { - 'lastError': { - 'message': 'unknown host' - } + 'message': 'unknown host' }; - if (!chrome.test.checkDeepEq(expected, chrome.runtime)) { + if (!chrome.test.checkDeepEq(expected, chrome.runtime.lastError)) { console.error('Expected ' + JSON.stringify(expected) + ', ' + - 'Actual ' + JSON.stringify(chrome.runtime)); + 'Actual ' + JSON.stringify(chrome.runtime.lastError)); success = false; } chrome.test.sendMessage(success ? 'true' : 'false'); diff --git a/extensions/browser/api/capture_web_contents_function.cc b/extensions/browser/api/capture_web_contents_function.cc index 611af6fbfe2e..7fa61894d81a 100644 --- a/extensions/browser/api/capture_web_contents_function.cc +++ b/extensions/browser/api/capture_web_contents_function.cc @@ -23,6 +23,8 @@ using content::WebContents; namespace extensions { +using core_api::extension_types::ImageDetails; + bool CaptureWebContentsFunction::HasPermission() { return true; } @@ -48,14 +50,16 @@ bool CaptureWebContentsFunction::RunAsync() { return false; // The default format and quality setting used when encoding jpegs. - const ImageDetails::Format kDefaultFormat = ImageDetails::FORMAT_JPEG; + const core_api::extension_types::ImageFormat kDefaultFormat = + core_api::extension_types::IMAGE_FORMAT_JPEG; const int kDefaultQuality = 90; image_format_ = kDefaultFormat; image_quality_ = kDefaultQuality; if (image_details) { - if (image_details->format != ImageDetails::FORMAT_NONE) + if (image_details->format != + core_api::extension_types::IMAGE_FORMAT_NONE) image_format_ = image_details->format; if (image_details->quality.get()) image_quality_ = *image_details->quality; @@ -106,7 +110,7 @@ void CaptureWebContentsFunction::OnCaptureSuccess(const SkBitmap& bitmap) { bool encoded = false; std::string mime_type; switch (image_format_) { - case ImageDetails::FORMAT_JPEG: + case core_api::extension_types::IMAGE_FORMAT_JPEG: encoded = gfx::JPEGCodec::Encode( reinterpret_cast(bitmap.getAddr32(0, 0)), gfx::JPEGCodec::FORMAT_SkBitmap, @@ -117,7 +121,7 @@ void CaptureWebContentsFunction::OnCaptureSuccess(const SkBitmap& bitmap) { &data); mime_type = kMimeTypeJpeg; break; - case ImageDetails::FORMAT_PNG: + case core_api::extension_types::IMAGE_FORMAT_PNG: encoded = gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, // Discard transparency. diff --git a/extensions/browser/api/capture_web_contents_function.h b/extensions/browser/api/capture_web_contents_function.h index 9f60234104d0..37100a9ff368 100644 --- a/extensions/browser/api/capture_web_contents_function.h +++ b/extensions/browser/api/capture_web_contents_function.h @@ -41,7 +41,6 @@ class CaptureWebContentsFunction : public AsyncExtensionFunction { virtual void OnCaptureFailure(FailureReason reason) = 0; private: - typedef core_api::extension_types::ImageDetails ImageDetails; void CopyFromBackingStoreComplete(const SkBitmap& bitmap, content::ReadbackResponse response); @@ -54,7 +53,7 @@ class CaptureWebContentsFunction : public AsyncExtensionFunction { int context_id_; // The format (JPEG vs PNG) of the resulting image. Set in RunAsync(). - ImageDetails::Format image_format_; + core_api::extension_types::ImageFormat image_format_; // Quality setting to use when encoding jpegs. Set in RunAsync(). int image_quality_; diff --git a/extensions/browser/api/execute_code_function.cc b/extensions/browser/api/execute_code_function.cc index 8f3d616cfe79..f4a565c455d2 100644 --- a/extensions/browser/api/execute_code_function.cc +++ b/extensions/browser/api/execute_code_function.cc @@ -149,14 +149,14 @@ bool ExecuteCodeFunction::Execute(const std::string& code_string) { UserScript::RunLocation run_at = UserScript::UNDEFINED; switch (details_->run_at) { - case InjectDetails::RUN_AT_NONE: - case InjectDetails::RUN_AT_DOCUMENT_IDLE: + case core_api::extension_types::RUN_AT_NONE: + case core_api::extension_types::RUN_AT_DOCUMENT_IDLE: run_at = UserScript::DOCUMENT_IDLE; break; - case InjectDetails::RUN_AT_DOCUMENT_START: + case core_api::extension_types::RUN_AT_DOCUMENT_START: run_at = UserScript::DOCUMENT_START; break; - case InjectDetails::RUN_AT_DOCUMENT_END: + case core_api::extension_types::RUN_AT_DOCUMENT_END: run_at = UserScript::DOCUMENT_END; break; } diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc index cb685506fd1e..74c89c6346f9 100644 --- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc +++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc @@ -445,13 +445,13 @@ bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { // Set the StopFindAction. content::StopFindAction action; switch (params->action) { - case web_view_internal::StopFinding::Params::ACTION_CLEAR: + case web_view_internal::STOP_FINDING_ACTION_CLEAR: action = content::STOP_FIND_ACTION_CLEAR_SELECTION; break; - case web_view_internal::StopFinding::Params::ACTION_KEEP: + case web_view_internal::STOP_FINDING_ACTION_KEEP: action = content::STOP_FIND_ACTION_KEEP_SELECTION; break; - case web_view_internal::StopFinding::Params::ACTION_ACTIVATE: + case web_view_internal::STOP_FINDING_ACTION_ACTIVATE: action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION; break; default: @@ -529,13 +529,13 @@ bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { WebViewPermissionHelper::PermissionResponseAction action = WebViewPermissionHelper::DEFAULT; switch (params->action) { - case Params::ACTION_ALLOW: + case core_api::web_view_internal::SET_PERMISSION_ACTION_ALLOW: action = WebViewPermissionHelper::ALLOW; break; - case Params::ACTION_DENY: + case core_api::web_view_internal::SET_PERMISSION_ACTION_DENY: action = WebViewPermissionHelper::DENY; break; - case Params::ACTION_DEFAULT: + case core_api::web_view_internal::SET_PERMISSION_ACTION_DEFAULT: break; default: NOTREACHED(); diff --git a/extensions/browser/api/management/management_api.cc b/extensions/browser/api/management/management_api.cc index 4379464e0b56..c0fd390b7b28 100644 --- a/extensions/browser/api/management/management_api.cc +++ b/extensions/browser/api/management/management_api.cc @@ -112,27 +112,27 @@ scoped_ptr CreateExtensionInfo( info->is_app = extension.is_app(); if (info->is_app) { if (extension.is_legacy_packaged_app()) - info->type = management::ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; + info->type = management::EXTENSION_TYPE_LEGACY_PACKAGED_APP; else if (extension.is_hosted_app()) - info->type = management::ExtensionInfo::TYPE_HOSTED_APP; + info->type = management::EXTENSION_TYPE_HOSTED_APP; else - info->type = management::ExtensionInfo::TYPE_PACKAGED_APP; + info->type = management::EXTENSION_TYPE_PACKAGED_APP; } else if (extension.is_theme()) { - info->type = management::ExtensionInfo::TYPE_THEME; + info->type = management::EXTENSION_TYPE_THEME; } else { - info->type = management::ExtensionInfo::TYPE_EXTENSION; + info->type = management::EXTENSION_TYPE_EXTENSION; } if (info->enabled) { - info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE; + info->disabled_reason = management::EXTENSION_DISABLED_REASON_NONE; } else { ExtensionPrefs* prefs = ExtensionPrefs::Get(context); if (prefs->DidExtensionEscalatePermissions(extension.id())) { info->disabled_reason = - management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; + management::EXTENSION_DISABLED_REASON_PERMISSIONS_INCREASE; } else { info->disabled_reason = - management::ExtensionInfo::DISABLED_REASON_UNKNOWN; + management::EXTENSION_DISABLED_REASON_UNKNOWN; } } @@ -184,27 +184,27 @@ scoped_ptr CreateExtensionInfo( switch (extension.location()) { case Manifest::INTERNAL: - info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL; + info->install_type = management::EXTENSION_INSTALL_TYPE_NORMAL; break; case Manifest::UNPACKED: case Manifest::COMMAND_LINE: - info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT; + info->install_type = management::EXTENSION_INSTALL_TYPE_DEVELOPMENT; break; case Manifest::EXTERNAL_PREF: case Manifest::EXTERNAL_REGISTRY: case Manifest::EXTERNAL_PREF_DOWNLOAD: - info->install_type = management::ExtensionInfo::INSTALL_TYPE_SIDELOAD; + info->install_type = management::EXTENSION_INSTALL_TYPE_SIDELOAD; break; case Manifest::EXTERNAL_POLICY: case Manifest::EXTERNAL_POLICY_DOWNLOAD: - info->install_type = management::ExtensionInfo::INSTALL_TYPE_ADMIN; + info->install_type = management::EXTENSION_INSTALL_TYPE_ADMIN; break; case Manifest::NUM_LOCATIONS: NOTREACHED(); case Manifest::INVALID_LOCATION: case Manifest::COMPONENT: case Manifest::EXTERNAL_COMPONENT: - info->install_type = management::ExtensionInfo::INSTALL_TYPE_OTHER; + info->install_type = management::EXTENSION_INSTALL_TYPE_OTHER; break; } diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc index 6f0716a24898..cc90d3732c2e 100644 --- a/extensions/browser/api/runtime/runtime_api.cc +++ b/extensions/browser/api/runtime/runtime_api.cc @@ -371,7 +371,7 @@ void RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent( void RuntimeEventRouter::DispatchOnRestartRequiredEvent( content::BrowserContext* context, const std::string& app_id, - core_api::runtime::OnRestartRequired::Reason reason) { + core_api::runtime::OnRestartRequiredReason reason) { ExtensionSystem* system = ExtensionSystem::Get(context); if (!system) return; diff --git a/extensions/browser/api/runtime/runtime_api.h b/extensions/browser/api/runtime/runtime_api.h index 901bab4a0a83..eb60c303bb2e 100644 --- a/extensions/browser/api/runtime/runtime_api.h +++ b/extensions/browser/api/runtime/runtime_api.h @@ -142,7 +142,7 @@ class RuntimeEventRouter { static void DispatchOnRestartRequiredEvent( content::BrowserContext* context, const std::string& app_id, - core_api::runtime::OnRestartRequired::Reason reason); + core_api::runtime::OnRestartRequiredReason reason); // Does any work needed at extension uninstall (e.g. load uninstall url). static void OnExtensionUninstalled(content::BrowserContext* context, diff --git a/extensions/browser/test_runtime_api_delegate.cc b/extensions/browser/test_runtime_api_delegate.cc index 9394050dbcf1..900ef8559bb3 100644 --- a/extensions/browser/test_runtime_api_delegate.cc +++ b/extensions/browser/test_runtime_api_delegate.cc @@ -42,7 +42,7 @@ void TestRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { bool TestRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { // TODO(rockot): This probably isn't right. Maybe this delegate should just // support manual PlatformInfo override for tests if necessary. - info->os = PlatformInfo::OS_CROS_; + info->os = core_api::runtime::PLATFORM_OS_CROS; return true; } diff --git a/extensions/common/api/bluetooth_private.json b/extensions/common/api/bluetooth_private.json index 90c44530d0d5..1b3bb69ec018 100644 --- a/extensions/common/api/bluetooth_private.json +++ b/extensions/common/api/bluetooth_private.json @@ -220,14 +220,18 @@ } }, { + "id": "TransportType", + "type": "string", + "enum": [ "le", "bredr", "dual"] + }, + { "type": "object", "id": "DiscoveryFilter", "properties": { "transport": { + "$ref": "TransportType", "optional": true, "name": "transport", - "type": "string", - "enum": [ "le", "bredr", "dual"], "description": "Transport type." }, "uuids": { diff --git a/extensions/common/api/extension_types.json b/extensions/common/api/extension_types.json index 3efc2f23ae3e..29562ee0ed35 100644 --- a/extensions/common/api/extension_types.json +++ b/extensions/common/api/extension_types.json @@ -8,14 +8,19 @@ "description": "The chrome.extensionTypes API contains type declarations for Chrome extensions.", "types": [ { + "id": "ImageFormat", + "type": "string", + "enum": ["jpeg", "png"], + "description": "The format of an image." + }, + { "id": "ImageDetails", "type": "object", "description": "Details about the format and quality of an image.", "properties": { "format": { - "type": "string", + "$ref": "ImageFormat", "optional": true, - "enum": ["jpeg", "png"], "description": "The format of the resulting image. Default is \"jpeg\"." }, "quality": { @@ -28,6 +33,12 @@ } }, { + "id": "RunAt", + "type": "string", + "enum": ["document_start", "document_end", "document_idle"], + "description": "The soonest that the JavaScript or CSS will be injected into the tab." + }, + { "id": "InjectDetails", "type": "object", "description": "Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.", @@ -37,9 +48,8 @@ "allFrames": {"type": "boolean", "optional": true, "description": "If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame."}, "matchAboutBlank": {"type": "boolean", "optional": true, "description": "If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false."}, "runAt": { - "type": "string", + "$ref": "RunAt", "optional": true, - "enum": ["document_start", "document_end", "document_idle"], "description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"." } } diff --git a/extensions/common/api/idle.json b/extensions/common/api/idle.json index 153e931c4d0b..43a9d071b6a0 100644 --- a/extensions/common/api/idle.json +++ b/extensions/common/api/idle.json @@ -6,7 +6,13 @@ { "namespace": "idle", "description": "Use the chrome.idle API to detect when the machine's idle state changes.", - "types": [], + "types": [ + { + "id": "IdleState", + "type": "string", + "enum": ["active", "idle", "locked"] + } + ], "functions": [ { "name": "queryState", @@ -25,8 +31,7 @@ "parameters": [ { "name": "newState", - "type": "string", - "enum": ["active", "idle", "locked"] + "$ref": "IdleState" } ] } @@ -54,8 +59,7 @@ "parameters": [ { "name": "newState", - "type": "string", - "enum": ["active", "idle", "locked"] + "$ref": "IdleState" } ] } diff --git a/extensions/common/api/management.json b/extensions/common/api/management.json index 42976387c939..93f1f1faa570 100644 --- a/extensions/common/api/management.json +++ b/extensions/common/api/management.json @@ -23,6 +23,24 @@ "description": "These are all possible app launch types." }, { + "id": "ExtensionDisabledReason", + "description": "A reason the item is disabled.", + "type": "string", + "enum": ["unknown", "permissions_increase"] + }, + { + "id": "ExtensionType", + "description": "The type of this extension, app, or theme.", + "type": "string", + "enum": ["extension", "hosted_app", "packaged_app", "legacy_packaged_app", "theme"] + }, + { + "id": "ExtensionInstallType", + "description": "How the extension was installed. One of
admin: The extension was installed because of an administrative policy,
development: The extension was loaded unpacked in developer mode,
normal: The extension was installed normally via a .crx file,
sideload: The extension was installed by other software on the machine,
other: The extension was installed by other means.", + "type": "string", + "enum": ["admin", "development", "normal", "sideload", "other"] + }, + { "id": "ExtensionInfo", "description": "Information about an installed extension, app, or theme.", "type": "object", @@ -57,8 +75,7 @@ }, "disabledReason": { "description": "A reason the item is disabled.", - "type": "string", - "enum": ["unknown", "permissions_increase"], + "$ref": "ExtensionDisabledReason", "optional": true }, "isApp": { @@ -68,8 +85,7 @@ }, "type": { "description": "The type of this extension, app, or theme.", - "type": "string", - "enum": ["extension", "hosted_app", "packaged_app", "legacy_packaged_app", "theme"] + "$ref": "ExtensionType" }, "appLaunchUrl": { "description": "The launch url (only present for apps).", @@ -117,9 +133,8 @@ } }, "installType": { - "description": "How the extension was installed. One of
admin: The extension was installed because of an administrative policy,
development: The extension was loaded unpacked in developer mode,
normal: The extension was installed normally via a .crx file,
sideload: The extension was installed by other software on the machine,
other: The extension was installed by other means.", - "type": "string", - "enum": ["admin", "development", "normal", "sideload", "other"] + "description": "How the extension was installed.", + "$ref": "ExtensionInstallType" }, "launchType": { "description": "The app launch type (only present for apps).", diff --git a/extensions/common/api/runtime.json b/extensions/common/api/runtime.json index de6e5960d681..3e139d5f9095 100644 --- a/extensions/common/api/runtime.json +++ b/extensions/common/api/runtime.json @@ -44,26 +44,59 @@ } }, { + "id": "PlatformOs", + "type": "string", + "description": "The operating system chrome is running on.", + "enum": ["mac", "win", "android", "cros", "linux", "openbsd"] + }, + { + "id": "PlatformArch", + "type": "string", + "enum": ["arm", "x86-32", "x86-64"], + "description": "The machine's processor architecture." + }, + { + "id": "PlatformNaclArch", + "description": "The native client architecture. This may be different from arch on some platforms.", + "type": "string", + "enum": ["arm", "x86-32", "x86-64"] + }, + { "id": "PlatformInfo", "type": "object", "description": "An object containing information about the current platform.", "properties": { "os": { - "type": "string", - "description": "The operating system chrome is running on.", - "enum": ["mac", "win", "android", "cros", "linux", "openbsd"] + "$ref": "PlatformOs", + "description": "The operating system chrome is running on." }, "arch": { - "type": "string", - "enum": ["arm", "x86-32", "x86-64"], + "$ref": "PlatformArch", "description": "The machine's processor architecture." }, "nacl_arch" : { "description": "The native client architecture. This may be different from arch on some platforms.", - "type": "string", - "enum": ["arm", "x86-32", "x86-64"] + "$ref": "PlatformNaclArch" } } + }, + { + "id": "RequestUpdateCheckStatus", + "type": "string", + "enum": ["throttled", "no_update", "update_available"], + "description": "Result of the update check." + }, + { + "id": "OnInstalledReason", + "type": "string", + "enum": ["install", "update", "chrome_update", "shared_module_update"], + "description": "The reason that this event is being dispatched." + }, + { + "id": "OnRestartRequiredReason", + "type": "string", + "description": "The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.", + "enum": ["app_update", "os_update", "periodic"] } ], "properties": { @@ -178,8 +211,7 @@ "parameters": [ { "name": "status", - "type": "string", - "enum": ["throttled", "no_update", "update_available"], + "$ref": "RequestUpdateCheckStatus", "description": "Result of the update check." }, { @@ -364,8 +396,7 @@ "name": "details", "properties": { "reason": { - "type": "string", - "enum": ["install", "update", "chrome_update", "shared_module_update"], + "$ref": "OnInstalledReason", "description": "The reason that this event is being dispatched." }, "previousVersion": { @@ -482,10 +513,9 @@ "description": "Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps.", "parameters": [ { - "type": "string", + "$ref": "OnRestartRequiredReason", "name": "reason", - "description": "The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.", - "enum": ["app_update", "os_update", "periodic"] + "description": "The reason that the event is being dispatched." } ] } diff --git a/extensions/common/api/virtual_keyboard_private.json b/extensions/common/api/virtual_keyboard_private.json index 6bce48c778df..d79e76a5984e 100644 --- a/extensions/common/api/virtual_keyboard_private.json +++ b/extensions/common/api/virtual_keyboard_private.json @@ -12,16 +12,34 @@ "description": "none", "types": [ { + "id": "VirtualKeyboardEventType", + "type": "string", + "description": "One of keyup or keydown.", + "enum": ["keyup", "keydown"] + }, + { "id": "VirtualKeyboardEvent", "type": "object", "properties": { - "type": {"type": "string", "description": "One of keyup or keydown.", "enum": ["keyup", "keydown"]}, + "type": {"$ref": "VirtualKeyboardEventType"}, "charValue": {"type": "integer", "description": "Unicode value of the key."}, "keyCode": {"type": "integer", "description": "Virtual key code, which is independent of the keyboard layout or modifier state."}, "keyName": {"type": "string", "description": "Name of the key, which is independent of modifier state."}, "modifiers": {"type": "integer", "optional": true, "description": "Flag for modifiers that are active. None = 0, Shift = 2, Control = 4, Alt = 8."} } - } + }, + { + "id": "KeyboardMode", + "type": "string", + "enum": [ "FULL_WIDTH", "FLOATING" ], + "description": "The value of the virtual keyboard mode to set to." + }, + { + "id": "OnTextInputBoxFocusedType", + "type": "string", + "description": "The value of type attribute of the focused text input box.", + "enum": ["text", "number", "password", "date", "url", "tel", "email"] + } ], "functions": [ { @@ -168,8 +186,7 @@ "description": "Sets the virtual keyboard mode.", "parameters": [ { - "type": "string", - "enum": [ "FULL_WIDTH", "FLOATING" ], + "$ref": "KeyboardMode", "name": "mode", "description": "The value of the virtual keyboard mode to set to." } @@ -189,9 +206,8 @@ "description": "Describes the text input box that has acquired focus. Note only the type of text input box is passed. This API is intended to be used by non-ime virtual keyboard only. Normal ime virtual keyboard should use chrome.input.ime.onFocus to get the more detailed InputContext.", "properties": { "type": { - "type": "string", - "description": "The value of type attribute of the focused text input box.", - "enum": ["text", "number", "password", "date", "url", "tel", "email"] + "$ref": "OnTextInputBoxFocusedType", + "description": "The value of type attribute of the focused text input box." } } } diff --git a/extensions/common/api/web_request.json b/extensions/common/api/web_request.json index 200bfa9f9a34..f76e9411d390 100644 --- a/extensions/common/api/web_request.json +++ b/extensions/common/api/web_request.json @@ -14,6 +14,51 @@ }, "types": [ { + "id": "ResourceType", + "type": "string", + "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"] + }, + { + "id": "OnBeforeRequestOptions", + "type": "string", + "enum": ["blocking", "requestBody"] + }, + { + "id": "OnBeforeSendHeadersOptions", + "type": "string", + "enum": ["requestHeaders", "blocking"] + }, + { + "id": "OnSendHeadersOptions", + "type": "string", + "enum": ["requestHeaders"] + }, + { + "id": "OnHeadersReceivedOptions", + "type": "string", + "enum": ["blocking", "responseHeaders"] + }, + { + "id": "OnAuthRequiredOptions", + "type": "string", + "enum": ["responseHeaders", "blocking", "asyncBlocking"] + }, + { + "id": "OnResponseStartedOptions", + "type": "string", + "enum": ["responseHeaders"] + }, + { + "id": "OnBeforeRedirectOptions", + "type": "string", + "enum": ["responseHeaders"] + }, + { + "id": "OnCompletedOptions", + "type": "string", + "enum": ["responseHeaders"] + }, + { "id": "RequestFilter", "type": "object", "description": "An object describing filters to apply to webRequest events.", @@ -27,7 +72,7 @@ "type": "array", "optional": true, "description": "A list of request types. Requests that cannot match any of the types will be filtered out.", - "items": { "type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"] } + "items": { "$ref": "ResourceType" } }, "tabId": { "type": "integer", "optional": true }, "windowId": { "type": "integer", "optional": true } @@ -157,7 +202,7 @@ } }, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."} } } @@ -174,8 +219,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["blocking", "requestBody"] + "$ref": "OnBeforeRequestOptions" } } ], @@ -201,7 +245,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that are going to be sent out with this request."} } @@ -219,8 +263,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["requestHeaders", "blocking"] + "$ref": "OnBeforeSendHeadersOptions" } } ], @@ -246,7 +289,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that have been sent out with this request."} } @@ -264,8 +307,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["requestHeaders"] + "$ref": "OnSendHeadersOptions" } } ] @@ -286,7 +328,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line)."}, "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that have been received with this response."}, @@ -306,8 +348,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["blocking", "responseHeaders"] + "$ref": "OnHeadersReceivedOptions" } } ], @@ -333,7 +374,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "scheme": {"type": "string", "description": "The authentication scheme, e.g. Basic or Digest."}, "realm": {"type": "string", "description": "The authentication realm provided by the server, if there is one.", "optional": true}, @@ -365,8 +406,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["responseHeaders", "blocking", "asyncBlocking"] + "$ref": "OnAuthRequiredOptions" } } ], @@ -392,7 +432,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."}, "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."}, @@ -414,8 +454,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["responseHeaders"] + "$ref": "OnResponseStartedOptions" } } ] @@ -436,7 +475,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."}, "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."}, @@ -459,8 +498,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["responseHeaders"] + "$ref": "OnBeforeRedirectOptions" } } ] @@ -481,7 +519,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."}, "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."}, @@ -503,8 +541,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["responseHeaders"] + "$ref": "OnCompletedOptions" } } ] @@ -524,7 +561,7 @@ "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, - "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, + "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."}, "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."}, diff --git a/extensions/common/api/web_request_internal.json b/extensions/common/api/web_request_internal.json index 6861f5db17e9..4adcd06dacb9 100644 --- a/extensions/common/api/web_request_internal.json +++ b/extensions/common/api/web_request_internal.json @@ -9,6 +9,13 @@ "compiler_options": { "implemented_in": "extensions/browser/api/web_request/web_request_api.h" }, + "types": [ + { + "id": "AddEventListenerOptions", + "type": "string", + "enum": ["requestHeaders", "responseHeaders", "blocking", "asyncBlocking", "requestBody"] + } + ], "functions": [ { "name": "addEventListener", @@ -27,8 +34,7 @@ "name": "extraInfoSpec", "description": "Array of extra information that should be passed to the listener function.", "items": { - "type": "string", - "enum": ["requestHeaders", "responseHeaders", "blocking", "asyncBlocking", "requestBody"] + "$ref": "AddEventListenerOptions" } }, {"type": "string", "name": "eventName"}, diff --git a/extensions/common/api/web_view_internal.json b/extensions/common/api/web_view_internal.json index c81940800fb8..671808929055 100644 --- a/extensions/common/api/web_view_internal.json +++ b/extensions/common/api/web_view_internal.json @@ -82,6 +82,17 @@ "description": "Disables all zooming in the webview. The content will revert to the default zoom level, and all attempted zoom changes will be ignored." } ] + }, + { + "id": "StopFindingAction", + "type": "string", + "description": "Determines what to do with the active match after the find session has ended. 'clear' will clear the highlighting over the active match; 'keep' will keep the active match highlighted; 'activate' will keep the active match highlighted and simulate a user click on that match.", + "enum": ["clear", "keep", "activate"] + }, + { + "id": "SetPermissionAction", + "type": "string", + "enum": ["allow", "deny", "default"] } ], "functions": [ @@ -335,11 +346,10 @@ "description": "The instance ID of the guest process." }, { - "type": "string", + "$ref": "StopFindingAction", "name": "action", - "description": "Determines what to do with the active match after the find session has ended. 'clear' will clear the highlighting over the active match; 'keep' will keep the active match highlighted; 'activate' will keep the active match highlighted and simulate a user click on that match.", - "optional": true, - "enum": ["clear", "keep", "activate"] + "description": "Determines what to do with the active match after the find session has ended.", + "optional": true } ] }, @@ -482,9 +492,8 @@ "name": "requestId" }, { - "type": "string", - "name": "action", - "enum": ["allow", "deny", "default"] + "$ref": "SetPermissionAction", + "name": "action" }, { "type": "string", diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js index 22ccb7bdc212..7d418866249b 100644 --- a/extensions/renderer/resources/binding.js +++ b/extensions/renderer/resources/binding.js @@ -289,17 +289,17 @@ Binding.prototype = { if (enumValues) { // Type IDs are qualified with the namespace during compilation, // unfortunately, so remove it here. - logging.DCHECK( - t.id.substr(0, schema.namespace.length) == schema.namespace); + logging.DCHECK($String.substr(t.id, 0, schema.namespace.length) == + schema.namespace); // Note: + 1 because it ends in a '.', e.g., 'fooApi.Type'. - var id = t.id.substr(schema.namespace.length + 1); + var id = $String.substr(t.id, schema.namespace.length + 1); mod[id] = {}; $Array.forEach(enumValues, function(enumValue) { // Note: enums can be declared either as a list of strings // ['foo', 'bar'] or as a list of objects // [{'name': 'foo'}, {'name': 'bar'}]. - enumValue = - enumValue.hasOwnProperty('name') ? enumValue.name : enumValue; + enumValue = $Object.hasOwnProperty(enumValue, 'name') ? + enumValue.name : enumValue; if (enumValue) // Avoid setting any empty enums. mod[id][enumValue] = enumValue; }); diff --git a/extensions/renderer/safe_builtins.cc b/extensions/renderer/safe_builtins.cc index c7296b7391c0..171878fa4fc7 100644 --- a/extensions/renderer/safe_builtins.cc +++ b/extensions/renderer/safe_builtins.cc @@ -74,7 +74,7 @@ const char kScript[] = " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n" " 'splice', 'map', 'filter']);\n" "saveBuiltin(String,\n" - " ['indexOf', 'slice', 'split']);\n" + " ['indexOf', 'slice', 'split', 'substr']);\n" "saveBuiltin(RegExp,\n" " ['test']);\n" "saveBuiltin(Error,\n" diff --git a/extensions/shell/browser/shell_runtime_api_delegate.cc b/extensions/shell/browser/shell_runtime_api_delegate.cc index 3c63da7b438b..668fcce82dfa 100644 --- a/extensions/shell/browser/shell_runtime_api_delegate.cc +++ b/extensions/shell/browser/shell_runtime_api_delegate.cc @@ -46,9 +46,9 @@ void ShellRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { #if defined(OS_CHROMEOS) - info->os = PlatformInfo::OS_CROS_; + info->os = core_api::runtime::PLATFORM_OS_CROS; #elif defined(OS_LINUX) - info->os = PlatformInfo::OS_LINUX_; + info->os = core_api::runtime::PLATFORM_OS_LINUX; #endif return true; } diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 3e2a1be6eff9..73413efaeadf 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -148,9 +148,12 @@ class _Generator(object): real_t = self._type_helper.FollowRef(t) if real_t.property_type == PropertyType.ENUM: - items.append('%s(%s)' % ( - prop.unix_name, - self._type_helper.GetEnumNoneValue(t))) + namespace_prefix = ('%s::' % real_t.namespace.unix_name + if real_t.namespace != self._namespace + else '') + items.append('%s(%s%s)' % (prop.unix_name, + namespace_prefix, + self._type_helper.GetEnumNoneValue(t))) elif prop.optional: continue elif t.property_type == PropertyType.INTEGER: @@ -289,9 +292,13 @@ class _Generator(object): prop, value_var, dst, 'false'))) underlying_type = self._type_helper.FollowRef(prop.type_) if underlying_type.property_type == PropertyType.ENUM: + namespace_prefix = ('%s::' % underlying_type.namespace.unix_name + if underlying_type.namespace != self._namespace + else '') (c.Append('} else {') - .Append('%%(dst)s->%%(name)s = %s;' % - self._type_helper.GetEnumNoneValue(prop.type_))) + .Append('%%(dst)s->%%(name)s = %s%s;' % + (namespace_prefix, + self._type_helper.GetEnumNoneValue(prop.type_)))) c.Eblock('}') else: (c.Sblock( @@ -1027,9 +1034,13 @@ class _Generator(object): underlying_type = self._type_helper.FollowRef(prop.type_) if (underlying_type.property_type == PropertyType.ENUM and prop.optional): - c.Append('%s->%s = %s;' % ( + namespace_prefix = ('%s::' % underlying_type.namespace.unix_name + if underlying_type.namespace != self._namespace + else '') + c.Append('%s->%s = %s%s;' % ( dst, prop.unix_name, + namespace_prefix, self._type_helper.GetEnumNoneValue(prop.type_))) return c diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py index e09366b24360..f3c4009f8c5b 100755 --- a/tools/json_schema_compiler/compiler.py +++ b/tools/json_schema_compiler/compiler.py @@ -57,7 +57,7 @@ def GenerateSchema(generator_name, api_def = json_schema.DeleteNodes(api_def, 'nocompile') api_defs.extend(api_def) - api_model = Model() + api_model = Model(allow_inline_enums=False) # For single-schema compilation make sure that the first (i.e. only) schema # is the default one. diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py index 3f7b2fe69343..642e818492b6 100644 --- a/tools/json_schema_compiler/model.py +++ b/tools/json_schema_compiler/model.py @@ -24,7 +24,8 @@ class Model(object): Properties: - |namespaces| a map of a namespace name to its model.Namespace """ - def __init__(self): + def __init__(self, allow_inline_enums=True): + self._allow_inline_enums = allow_inline_enums self.namespaces = {} def AddNamespace(self, @@ -37,7 +38,8 @@ class Model(object): namespace = Namespace(json, source_file, include_compiler_options=include_compiler_options, - environment=environment) + environment=environment, + allow_inline_enums=self._allow_inline_enums) self.namespaces[namespace.name] = namespace return namespace @@ -104,7 +106,8 @@ class Namespace(object): json, source_file, include_compiler_options=False, - environment=None): + environment=None, + allow_inline_enums=True): self.name = json['namespace'] if 'description' not in json: # TODO(kalman): Go back to throwing an error here. @@ -118,6 +121,7 @@ class Namespace(object): self.source_file_dir, self.source_file_filename = os.path.split(source_file) self.short_filename = os.path.basename(source_file).split('.')[0] self.parent = None + self.allow_inline_enums = allow_inline_enums self.platforms = _GetPlatforms(json) toplevel_origin = Origin(from_client=True, from_json=True) self.types = _GetTypes(self, json, self, toplevel_origin) @@ -198,6 +202,11 @@ class Type(object): self.property_type = PropertyType.REF self.ref_type = json['$ref'] elif 'enum' in json and json_type == 'string': + if not namespace.allow_inline_enums and not isinstance(parent, Namespace): + raise ParseException( + self, + 'Inline enum "%s" found in namespace "%s". These are not allowed. ' + 'See crbug.com/472279' % (name, namespace.name)) self.property_type = PropertyType.ENUM self.enum_values = [EnumValue(value) for value in json['enum']] self.cpp_enum_prefix_override = json.get('cpp_enum_prefix_override', None) diff --git a/tools/json_schema_compiler/test/arrays.json b/tools/json_schema_compiler/test/arrays.json index 23314e92f872..3dfeeb890aeb 100644 --- a/tools/json_schema_compiler/test/arrays.json +++ b/tools/json_schema_compiler/test/arrays.json @@ -4,19 +4,6 @@ "description": "The arrays API.", "types": [ { - "id": "EnumArrayType", - "type": "object", - "properties": { - "types": { - "type": "array", - "items": { - "type": "string", - "enum": ["one", "two", "three"] - } - } - } - }, - { "id": "Enumeration", "type": "string", "enum": ["one", "two", "three"] @@ -37,13 +24,6 @@ "id": "EnumArrayMixed", "type": "object", "properties": { - "inline_enums": { - "type": "array", - "items": { - "type": "string", - "enum": ["one", "two", "three"] - } - }, "infile_enums": { "type": "array", "items": { @@ -65,8 +45,7 @@ "types": { "type": "array", "items": { - "type": "string", - "enum": ["one", "two", "three"] + "$ref": "Enumeration" }, "optional": true } diff --git a/tools/json_schema_compiler/test/arrays_unittest.cc b/tools/json_schema_compiler/test/arrays_unittest.cc index 79ebfb2360e8..f0d3ab111291 100644 --- a/tools/json_schema_compiler/test/arrays_unittest.cc +++ b/tools/json_schema_compiler/test/arrays_unittest.cc @@ -52,35 +52,6 @@ TEST(JsonSchemaCompilerArrayTest, BasicArrayType) { } } -TEST(JsonSchemaCompilerArrayTest, EnumArrayType) { - // { "types": ["one", "two", "three"] } - base::ListValue* types = new base::ListValue(); - types->AppendString("one"); - types->AppendString("two"); - types->AppendString("three"); - base::DictionaryValue value; - value.Set("types", types); - - EnumArrayType enum_array_type; - - // Test Populate. - ASSERT_TRUE(EnumArrayType::Populate(value, &enum_array_type)); - { - EnumArrayType::TypesType enums[] = { - EnumArrayType::TYPES_TYPE_ONE, - EnumArrayType::TYPES_TYPE_TWO, - EnumArrayType::TYPES_TYPE_THREE, - }; - std::vector enums_vector( - enums, enums + arraysize(enums)); - EXPECT_EQ(enums_vector, enum_array_type.types); - } - - // Test ToValue. - scoped_ptr as_value(enum_array_type.ToValue()); - EXPECT_TRUE(value.Equals(as_value.get())) << value << " != " << *as_value; -} - TEST(JsonSchemaCompilerArrayTest, EnumArrayReference) { // { "types": ["one", "two", "three"] } base::ListValue* types = new base::ListValue(); @@ -108,11 +79,6 @@ TEST(JsonSchemaCompilerArrayTest, EnumArrayReference) { TEST(JsonSchemaCompilerArrayTest, EnumArrayMixed) { // { "types": ["one", "two", "three"] } - base::ListValue* inline_enums = new base::ListValue(); - inline_enums->AppendString("one"); - inline_enums->AppendString("two"); - inline_enums->AppendString("three"); - base::ListValue* infile_enums = new base::ListValue(); infile_enums->AppendString("one"); infile_enums->AppendString("two"); @@ -124,7 +90,6 @@ TEST(JsonSchemaCompilerArrayTest, EnumArrayMixed) { external_enums->AppendString("three"); base::DictionaryValue value; - value.Set("inline_enums", inline_enums); value.Set("infile_enums", infile_enums); value.Set("external_enums", external_enums); @@ -133,15 +98,6 @@ TEST(JsonSchemaCompilerArrayTest, EnumArrayMixed) { // Test Populate. ASSERT_TRUE(EnumArrayMixed::Populate(value, &enum_array_mixed)); - EnumArrayMixed::Inline_enumsType expected_inline_types[] = { - EnumArrayMixed::INLINE_ENUMS_TYPE_ONE, - EnumArrayMixed::INLINE_ENUMS_TYPE_TWO, - EnumArrayMixed::INLINE_ENUMS_TYPE_THREE}; - EXPECT_EQ(std::vector( - expected_inline_types, - expected_inline_types + arraysize(expected_inline_types)), - enum_array_mixed.inline_enums); - Enumeration expected_infile_types[] = {ENUMERATION_ONE, ENUMERATION_TWO, ENUMERATION_THREE}; EXPECT_EQ(std::vector( @@ -164,16 +120,14 @@ TEST(JsonSchemaCompilerArrayTest, EnumArrayMixed) { TEST(JsonSchemaCompilerArrayTest, OptionalEnumArrayType) { { - std::vector enums; - enums.push_back(OptionalEnumArrayType::TYPES_TYPE_ONE); - enums.push_back(OptionalEnumArrayType::TYPES_TYPE_TWO); - enums.push_back(OptionalEnumArrayType::TYPES_TYPE_THREE); + std::vector enums; + enums.push_back(ENUMERATION_ONE); + enums.push_back(ENUMERATION_TWO); + enums.push_back(ENUMERATION_THREE); scoped_ptr types(new base::ListValue()); - for (size_t i = 0; i < enums.size(); ++i) { - types->Append(new base::StringValue( - OptionalEnumArrayType::ToString(enums[i]))); - } + for (size_t i = 0; i < enums.size(); ++i) + types->Append(new base::StringValue(ToString(enums[i]))); base::DictionaryValue value; value.Set("types", types.release()); diff --git a/tools/json_schema_compiler/test/callbacks.json b/tools/json_schema_compiler/test/callbacks.json index 2f86c26e15e0..dbd03c30aa55 100644 --- a/tools/json_schema_compiler/test/callbacks.json +++ b/tools/json_schema_compiler/test/callbacks.json @@ -2,7 +2,13 @@ { "namespace": "callbacks", "description": "The callbacks API.", - "types": [], + "types": [ + { + "id": "Enumeration", + "type": "string", + "enum": ["foo", "bar", "baz"] + } + ], "functions": [ { "name": "returnsNothing", @@ -30,8 +36,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" } } } @@ -57,8 +62,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" } } } diff --git a/tools/json_schema_compiler/test/callbacks_unittest.cc b/tools/json_schema_compiler/test/callbacks_unittest.cc index 001e977bf07a..a12584da2cf4 100644 --- a/tools/json_schema_compiler/test/callbacks_unittest.cc +++ b/tools/json_schema_compiler/test/callbacks_unittest.cc @@ -10,7 +10,7 @@ using namespace test::api::callbacks; TEST(JsonSchemaCompilerCallbacksTest, ReturnsObjectResultCreate) { ReturnsObject::Results::SomeObject some_object; - some_object.state = ReturnsObject::Results::SomeObject::STATE_FOO; + some_object.state = ENUMERATION_FOO; scoped_ptr results = ReturnsObject::Results::Create(some_object); @@ -23,7 +23,7 @@ TEST(JsonSchemaCompilerCallbacksTest, ReturnsObjectResultCreate) { TEST(JsonSchemaCompilerCallbacksTest, ReturnsMultipleResultCreate) { ReturnsMultiple::Results::SomeObject some_object; - some_object.state = ReturnsMultiple::Results::SomeObject::STATE_FOO; + some_object.state = ENUMERATION_FOO; scoped_ptr results = ReturnsMultiple::Results::Create(5, some_object); diff --git a/tools/json_schema_compiler/test/enums.json b/tools/json_schema_compiler/test/enums.json index c776313627a0..97237677a78d 100644 --- a/tools/json_schema_compiler/test/enums.json +++ b/tools/json_schema_compiler/test/enums.json @@ -9,12 +9,16 @@ "enum": ["one", "two", "three"] }, { + "id": "OtherEnumeration", + "type": "string", + "enum": ["spam", "ham", "eggs"] + }, + { "id": "EnumType", "type": "object", "properties": { "type": { - "type": "string", - "enum": ["one", "two", "three"] + "$ref": "Enumeration" } } }, @@ -32,13 +36,9 @@ } }, { - "id": "InlineAndReferenceEnum", + "id": "ReferenceEnum", "type": "object", "properties": { - "inline_enum": { - "type": "string", - "enum": ["test1", "test2", "test3"] - }, "reference_enum": { "$ref": "Enumeration" } @@ -49,8 +49,7 @@ "type": "object", "properties": { "type": { - "type": "string", - "enum": ["one", "two", "three"], + "$ref": "Enumeration", "optional": true } } @@ -64,8 +63,7 @@ "parameters": [ { "name": "state", - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" }, { "name": "callback", @@ -83,8 +81,7 @@ "name": "values", "type": "array", "items": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" } }, { @@ -140,8 +137,7 @@ "parameters": [ { "name": "state", - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" } ] } @@ -175,13 +171,11 @@ "parameters": [ { "name": "firstState", - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" }, { "name": "secondState", - "type": "string", - "enum": ["spam", "ham", "eggs"] + "$ref": "OtherEnumeration" } ] } @@ -194,8 +188,7 @@ "parameters": [ { "name": "state", - "type": "string", - "enum": ["foo", "bar", "baz"], + "$ref": "Enumeration", "optional": true }, { @@ -212,14 +205,12 @@ "parameters": [ { "name": "state", - "type": "string", - "enum": ["foo", "bar", "baz"], + "$ref": "Enumeration", "optional": true }, { "name": "type", - "type": "string", - "enum": ["foo", "ding", "dong"], + "$ref": "OtherEnumeration", "optional": true }, { @@ -238,8 +229,7 @@ "parameters": [ { "name": "someEnum", - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" } ] }, @@ -250,13 +240,11 @@ "parameters": [ { "name": "firstEnum", - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "Enumeration" }, { "name": "secondEnum", - "type": "string", - "enum": ["spam", "ham", "eggs"] + "$ref": "OtherEnumeration" } ] } diff --git a/tools/json_schema_compiler/test/enums_unittest.cc b/tools/json_schema_compiler/test/enums_unittest.cc index 7f1addb7c6fb..2eee09601984 100644 --- a/tools/json_schema_compiler/test/enums_unittest.cc +++ b/tools/json_schema_compiler/test/enums_unittest.cc @@ -16,7 +16,7 @@ TEST(JsonSchemaCompilerEnumsTest, EnumTypePopulate) { base::DictionaryValue value; value.Set("type", new base::StringValue("one")); EXPECT_TRUE(EnumType::Populate(value, &enum_type)); - EXPECT_EQ(EnumType::TYPE_ONE, enum_type.type); + EXPECT_EQ(ENUMERATION_ONE, enum_type.type); EXPECT_TRUE(value.Equals(enum_type.ToValue().get())); } { @@ -59,15 +59,12 @@ TEST(JsonSchemaCompilerEnumsTest, EnumsAsTypes) { EXPECT_TRUE(value.Equals(enumeration.ToValue().get())); } { - InlineAndReferenceEnum enumeration; + ReferenceEnum enumeration; base::DictionaryValue value; - ASSERT_FALSE(InlineAndReferenceEnum::Populate(value, &enumeration)); - - value.Set("inline_enum", new base::StringValue("test2")); - ASSERT_FALSE(InlineAndReferenceEnum::Populate(value, &enumeration)); + ASSERT_FALSE(ReferenceEnum::Populate(value, &enumeration)); value.Set("reference_enum", new base::StringValue("one")); - ASSERT_TRUE(InlineAndReferenceEnum::Populate(value, &enumeration)); + ASSERT_TRUE(ReferenceEnum::Populate(value, &enumeration)); EXPECT_TRUE(value.Equals(enumeration.ToValue().get())); } } @@ -95,17 +92,16 @@ TEST(JsonSchemaCompilerEnumsTest, EnumsArrayAsType) { TEST(JsonSchemaCompilerEnumsTest, ReturnsEnumCreate) { { - ReturnsEnum::Results::State state = ReturnsEnum::Results::STATE_FOO; - scoped_ptr result( - new base::StringValue(ReturnsEnum::Results::ToString(state))); - scoped_ptr expected(new base::StringValue("foo")); + Enumeration state = ENUMERATION_ONE; + scoped_ptr result(new base::StringValue(ToString(state))); + scoped_ptr expected(new base::StringValue("one")); EXPECT_TRUE(result->Equals(expected.get())); } { - ReturnsEnum::Results::State state = ReturnsEnum::Results::STATE_FOO; + Enumeration state = ENUMERATION_ONE; scoped_ptr results = ReturnsEnum::Results::Create(state); base::ListValue expected; - expected.Append(new base::StringValue("foo")); + expected.Append(new base::StringValue("one")); EXPECT_TRUE(results->Equals(&expected)); } } @@ -113,10 +109,9 @@ TEST(JsonSchemaCompilerEnumsTest, ReturnsEnumCreate) { TEST(JsonSchemaCompilerEnumsTest, ReturnsTwoEnumsCreate) { { scoped_ptr results = ReturnsTwoEnums::Results::Create( - ReturnsTwoEnums::Results::FIRST_STATE_FOO, - ReturnsTwoEnums::Results::SECOND_STATE_HAM); + ENUMERATION_ONE, OTHER_ENUMERATION_HAM); base::ListValue expected; - expected.Append(new base::StringValue("foo")); + expected.Append(new base::StringValue("one")); expected.Append(new base::StringValue("ham")); EXPECT_TRUE(results->Equals(&expected)); } @@ -128,14 +123,14 @@ TEST(JsonSchemaCompilerEnumsTest, OptionalEnumTypePopulate) { base::DictionaryValue value; value.Set("type", new base::StringValue("two")); EXPECT_TRUE(OptionalEnumType::Populate(value, &enum_type)); - EXPECT_EQ(OptionalEnumType::TYPE_TWO, enum_type.type); + EXPECT_EQ(ENUMERATION_TWO, enum_type.type); EXPECT_TRUE(value.Equals(enum_type.ToValue().get())); } { OptionalEnumType enum_type; base::DictionaryValue value; EXPECT_TRUE(OptionalEnumType::Populate(value, &enum_type)); - EXPECT_EQ(OptionalEnumType::TYPE_NONE, enum_type.type); + EXPECT_EQ(ENUMERATION_NONE, enum_type.type); EXPECT_TRUE(value.Equals(enum_type.ToValue().get())); } { @@ -149,11 +144,11 @@ TEST(JsonSchemaCompilerEnumsTest, OptionalEnumTypePopulate) { TEST(JsonSchemaCompilerEnumsTest, TakesEnumParamsCreate) { { base::ListValue params_value; - params_value.Append(new base::StringValue("baz")); + params_value.Append(new base::StringValue("two")); scoped_ptr params( TakesEnum::Params::Create(params_value)); EXPECT_TRUE(params.get()); - EXPECT_EQ(TakesEnum::Params::STATE_BAZ, params->state); + EXPECT_EQ(ENUMERATION_TWO, params->state); } { base::ListValue params_value; @@ -167,14 +162,14 @@ TEST(JsonSchemaCompilerEnumsTest, TakesEnumParamsCreate) { TEST(JsonSchemaCompilerEnumsTest, TakesEnumArrayParamsCreate) { { base::ListValue params_value; - params_value.Append(List(new base::StringValue("foo"), - new base::StringValue("bar")).release()); + params_value.Append(List(new base::StringValue("one"), + new base::StringValue("two")).release()); scoped_ptr params( TakesEnumArray::Params::Create(params_value)); ASSERT_TRUE(params); EXPECT_EQ(2U, params->values.size()); - EXPECT_EQ(TakesEnumArray::Params::VALUES_TYPE_FOO, params->values[0]); - EXPECT_EQ(TakesEnumArray::Params::VALUES_TYPE_BAR, params->values[1]); + EXPECT_EQ(ENUMERATION_ONE, params->values[0]); + EXPECT_EQ(ENUMERATION_TWO, params->values[1]); } { base::ListValue params_value; @@ -188,18 +183,18 @@ TEST(JsonSchemaCompilerEnumsTest, TakesEnumArrayParamsCreate) { TEST(JsonSchemaCompilerEnumsTest, TakesOptionalEnumParamsCreate) { { base::ListValue params_value; - params_value.Append(new base::StringValue("baz")); + params_value.Append(new base::StringValue("three")); scoped_ptr params( TakesOptionalEnum::Params::Create(params_value)); EXPECT_TRUE(params.get()); - EXPECT_EQ(TakesOptionalEnum::Params::STATE_BAZ, params->state); + EXPECT_EQ(ENUMERATION_THREE, params->state); } { base::ListValue params_value; scoped_ptr params( TakesOptionalEnum::Params::Create(params_value)); EXPECT_TRUE(params.get()); - EXPECT_EQ(TakesOptionalEnum::Params::STATE_NONE, params->state); + EXPECT_EQ(ENUMERATION_NONE, params->state); } { base::ListValue params_value; @@ -213,34 +208,34 @@ TEST(JsonSchemaCompilerEnumsTest, TakesOptionalEnumParamsCreate) { TEST(JsonSchemaCompilerEnumsTest, TakesMultipleOptionalEnumsParamsCreate) { { base::ListValue params_value; - params_value.Append(new base::StringValue("foo")); - params_value.Append(new base::StringValue("foo")); + params_value.Append(new base::StringValue("one")); + params_value.Append(new base::StringValue("ham")); scoped_ptr params( TakesMultipleOptionalEnums::Params::Create(params_value)); EXPECT_TRUE(params.get()); - EXPECT_EQ(TakesMultipleOptionalEnums::Params::STATE_FOO, params->state); - EXPECT_EQ(TakesMultipleOptionalEnums::Params::TYPE_FOO, params->type); + EXPECT_EQ(ENUMERATION_ONE, params->state); + EXPECT_EQ(OTHER_ENUMERATION_HAM, params->type); } { base::ListValue params_value; - params_value.Append(new base::StringValue("foo")); + params_value.Append(new base::StringValue("one")); scoped_ptr params( TakesMultipleOptionalEnums::Params::Create(params_value)); EXPECT_TRUE(params.get()); - EXPECT_EQ(TakesMultipleOptionalEnums::Params::STATE_FOO, params->state); - EXPECT_EQ(TakesMultipleOptionalEnums::Params::TYPE_NONE, params->type); + EXPECT_EQ(ENUMERATION_ONE, params->state); + EXPECT_EQ(OTHER_ENUMERATION_NONE, params->type); } { base::ListValue params_value; scoped_ptr params( TakesMultipleOptionalEnums::Params::Create(params_value)); EXPECT_TRUE(params.get()); - EXPECT_EQ(TakesMultipleOptionalEnums::Params::STATE_NONE, params->state); - EXPECT_EQ(TakesMultipleOptionalEnums::Params::TYPE_NONE, params->type); + EXPECT_EQ(ENUMERATION_NONE, params->state); + EXPECT_EQ(OTHER_ENUMERATION_NONE, params->type); } { base::ListValue params_value; - params_value.Append(new base::StringValue("baz")); + params_value.Append(new base::StringValue("three")); params_value.Append(new base::StringValue("invalid")); scoped_ptr params( TakesMultipleOptionalEnums::Params::Create(params_value)); @@ -250,28 +245,26 @@ TEST(JsonSchemaCompilerEnumsTest, TakesMultipleOptionalEnumsParamsCreate) { TEST(JsonSchemaCompilerEnumsTest, OnEnumFiredCreate) { { - OnEnumFired::SomeEnum some_enum = OnEnumFired::SOME_ENUM_FOO; - scoped_ptr result( - new base::StringValue(OnEnumFired::ToString(some_enum))); - scoped_ptr expected(new base::StringValue("foo")); + Enumeration some_enum = ENUMERATION_ONE; + scoped_ptr result(new base::StringValue(ToString(some_enum))); + scoped_ptr expected(new base::StringValue("one")); EXPECT_TRUE(result->Equals(expected.get())); } { - OnEnumFired::SomeEnum some_enum = OnEnumFired::SOME_ENUM_FOO; + Enumeration some_enum = ENUMERATION_ONE; scoped_ptr results(OnEnumFired::Create(some_enum)); base::ListValue expected; - expected.Append(new base::StringValue("foo")); + expected.Append(new base::StringValue("one")); EXPECT_TRUE(results->Equals(&expected)); } } TEST(JsonSchemaCompilerEnumsTest, OnTwoEnumsFiredCreate) { { - scoped_ptr results(OnTwoEnumsFired::Create( - OnTwoEnumsFired::FIRST_ENUM_FOO, - OnTwoEnumsFired::SECOND_ENUM_HAM)); + scoped_ptr results( + OnTwoEnumsFired::Create(ENUMERATION_ONE, OTHER_ENUMERATION_HAM)); base::ListValue expected; - expected.Append(new base::StringValue("foo")); + expected.Append(new base::StringValue("one")); expected.Append(new base::StringValue("ham")); EXPECT_TRUE(results->Equals(&expected)); } diff --git a/tools/json_schema_compiler/test/objects.json b/tools/json_schema_compiler/test/objects.json index e76e229900a1..dd0bb2072049 100644 --- a/tools/json_schema_compiler/test/objects.json +++ b/tools/json_schema_compiler/test/objects.json @@ -2,7 +2,18 @@ { "namespace": "objects", "description": "The objects API.", - "types": [], + "types": [ + { + "id": "firstState", + "type": "string", + "enum": ["foo", "bar", "baz"] + }, + { + "id": "secondState", + "type": "string", + "enum": ["spam", "ham", "eggs"] + } + ], "functions": [ { "name": "objectParam", @@ -46,8 +57,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "firstState" } } } @@ -69,8 +79,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "firstState" } } }, @@ -79,8 +88,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["spam", "ham", "eggs"] + "$ref": "secondState" } } } @@ -100,8 +108,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "firstState" } } } @@ -117,8 +124,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["foo", "bar", "baz"] + "$ref": "firstState" } } }, @@ -127,8 +133,7 @@ "type": "object", "properties": { "state": { - "type": "string", - "enum": ["spam", "ham", "eggs"] + "$ref": "secondState" } } } diff --git a/tools/json_schema_compiler/test/objects_unittest.cc b/tools/json_schema_compiler/test/objects_unittest.cc index 6dc2c4548d2e..f57300f35e00 100644 --- a/tools/json_schema_compiler/test/objects_unittest.cc +++ b/tools/json_schema_compiler/test/objects_unittest.cc @@ -48,7 +48,7 @@ TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) { TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { ReturnsObject::Results::Info info; - info.state = ReturnsObject::Results::Info::STATE_FOO; + info.state = FIRST_STATE_FOO; scoped_ptr results = ReturnsObject::Results::Create(info); base::DictionaryValue expected; @@ -60,7 +60,7 @@ TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) { OnObjectFired::SomeObject object; - object.state = OnObjectFired::SomeObject::STATE_BAR; + object.state = FIRST_STATE_BAR; scoped_ptr results(OnObjectFired::Create(object)); base::DictionaryValue expected; -- 2.11.4.GIT