0

Generate all extension schema namespaces as "api" and instead vary the generated bundle names.

At the moment the 3 modules that use extension API schemas, those in
extensions/common/api, chrome/common/extensions/api, and extensions/shell/api,
are generated with different C++ namespaces: "core_api", "api", and
"shell::api" respectively.

This is a pointless distinction to make since as far as JS is concerned they
must all go on the window.chrome object, therefore namespace conflicts are
impossible. It just ends up adding code noise.

The only problem it solves is that all bundle compiles are generated to the
same name, "GeneratedSchemas" and "GeneratedFunctionRegistry". This patch
solves that a different way, by adding a JSON schema compiler option to give
those generated classes a prefix such that they are "GeneratedSchemas",
"ChromeGeneratedSchemas", and "ShellGeneratedSchemas" respectively.
This lets us to a global substitution from "core_api" to just "api".

R=rockot@chromium.org, dpranke@chromium.org
TBR=ben@chromium.org

Review URL: https://codereview.chromium.org/1226353004

Cr-Commit-Position: refs/heads/master@{#340119}
This commit is contained in:
kalman
2015-07-23 11:27:22 -07:00
committed by Commit bot
parent f340ae7cfd
commit e58e622314
271 changed files with 1033 additions and 1038 deletions
apps
build
chrome
extensions
browser
api
alarms
api_resource_manager.h
app_current_window_internal
app_runtime
app_window
audio
bluetooth
bluetooth_low_energy
bluetooth_socket
capture_web_contents_function.cccapture_web_contents_function.h
cast_channel
declarative
declarative_webrequest
diagnostics
dns
document_scan
execute_code_function.ccexecute_code_function.h
guest_view
hid
idle
management
networking_config
networking_private
power
printer_provider
printer_provider_internal
runtime
serial
socket
sockets_tcp
sockets_tcp_server
sockets_udp
storage
system_cpu
system_display
system_info
system_memory
system_network
system_storage
test
usb
virtual_keyboard_private
vpn_provider
web_request
webcam_private
browser_context_keyed_service_factories.cc
guest_view
test_runtime_api_delegate.cctest_runtime_api_delegate.h
common
shell
test
tools/json_schema_compiler

@ -42,7 +42,7 @@
#include "components/user_manager/user_manager.h"
#endif
namespace app_runtime = extensions::core_api::app_runtime;
namespace app_runtime = extensions::api::app_runtime;
using content::BrowserThread;
using extensions::AppRuntimeEventRouter;

@ -31,6 +31,11 @@
# bundle_registration [optional, default = false]
# Boolean indicating if the API registration bundle files should be generated.
#
# bundle_name [required if bundle or bundle_registrations]:
# A string to prepend to generated bundle class names, so that multiple
# bundle rules can be used without conflicting. Only used with one of
# the cpp-bundle generators.
#
# impl_dir [required if bundle_registration = true, otherwise unused]
# The path containing C++ implementations of API functions. This path is
# used as the root path when looking for {schema}/{schema}_api.h headers
@ -86,6 +91,7 @@ template("json_schema_api") {
"$compiler_root/cc_generator.py",
"$compiler_root/code.py",
"$compiler_root/compiler.py",
"$compiler_root/cpp_bundle_generator.py",
"$compiler_root/cpp_generator.py",
"$compiler_root/cpp_type_generator.py",
"$compiler_root/cpp_util.py",
@ -122,6 +128,9 @@ template("json_schema_api") {
}
if (bundle) {
assert(defined(invoker.bundle_name),
"\"bundle_name\" must be defined for bundles")
uncompiled_sources = []
if (defined(invoker.uncompiled_sources)) {
uncompiled_sources = invoker.uncompiled_sources
@ -139,6 +148,7 @@ template("json_schema_api") {
"--root=" + rebase_path("//", root_build_dir),
"--destdir=" + rebase_path(root_gen_dir, root_build_dir),
"--namespace=$root_namespace",
"--bundle-name=" + invoker.bundle_name,
"--generator=cpp-bundle-schema",
"--include-rules=$schema_include_rules",
] + rebase_path(invoker.sources, root_build_dir) +
@ -147,6 +157,9 @@ template("json_schema_api") {
}
if (bundle_registration) {
assert(defined(invoker.bundle_name),
"\"bundle_name\" must be defined for bundle registrations")
uncompiled_sources = []
if (defined(invoker.uncompiled_sources)) {
uncompiled_sources = invoker.uncompiled_sources
@ -171,6 +184,7 @@ template("json_schema_api") {
"--root=" + rebase_path("//", root_build_dir),
"--destdir=" + rebase_path(root_gen_dir, root_build_dir),
"--namespace=$root_namespace",
"--bundle-name=" + invoker.bundle_name,
"--generator=cpp-bundle-registration",
"--impl-dir=$gen_child_dir",
"--include-rules=$schema_include_rules",

@ -18,6 +18,10 @@
# A Python string substituion pattern used to generate the C++
# namespace for each API. Use %(namespace)s to replace with the API
# namespace, like "toplevel::%(namespace)s_api".
# bundle_name:
# A string to prepend to generated bundle class names, so that multiple
# bundle rules can be used without conflicting. Only used with one of
# the cpp-bundle generators.
#
# Functions and namespaces can be excluded by setting "nocompile" to true.
# The default root path of API implementation sources is
@ -57,6 +61,7 @@
'--root=<(DEPTH)',
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
'--namespace=<(root_namespace)',
'--bundle-name=<(bundle_name)',
'--generator=cpp-bundle-schema',
'--include-rules=<(schema_include_rules)',
'<@(schema_files)',

@ -15,6 +15,10 @@
# A Python string substituion pattern used to generate the C++
# namespace for each API. Use %(namespace)s to replace with the API
# namespace, like "toplevel::%(namespace)s_api".
# bundle_name:
# A string to prepend to generated bundle class names, so that multiple
# bundle rules can be used without conflicting. Only used with one of
# the cpp-bundle generators.
#
# Functions and namespaces can be excluded by setting "nocompile" to true.
'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
@ -52,6 +56,7 @@
'--root=<(DEPTH)',
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
'--namespace=<(root_namespace)',
'--bundle-name=<(bundle_name)',
'--generator=cpp-bundle-registration',
'--impl-dir=<(impl_dir_)',
'<@(schema_files)',

@ -63,7 +63,7 @@
using content::WebContents;
using web_modal::WebContentsModalDialogManager;
namespace app_runtime = extensions::core_api::app_runtime;
namespace app_runtime = extensions::api::app_runtime;
namespace extensions {

@ -58,7 +58,7 @@ using extensions::ResultCatcher;
namespace {
namespace alarms = extensions::core_api::alarms;
namespace alarms = extensions::api::alarms;
const char kPowerTestApp[] = "ephemeral_apps/power";

@ -97,24 +97,23 @@ void KioskAppUpdateService::OnAppUpdateAvailable(
app_id_, profile_, extension);
extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent(
profile_,
app_id_,
extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE);
profile_, app_id_,
extensions::api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE);
StartAppUpdateRestartTimer();
}
void KioskAppUpdateService::OnRebootRequested(Reason reason) {
extensions::core_api::runtime::OnRestartRequiredReason restart_reason =
extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_NONE;
extensions::api::runtime::OnRestartRequiredReason restart_reason =
extensions::api::runtime::ON_RESTART_REQUIRED_REASON_NONE;
switch (reason) {
case REBOOT_REASON_OS_UPDATE:
restart_reason =
extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_OS_UPDATE;
extensions::api::runtime::ON_RESTART_REQUIRED_REASON_OS_UPDATE;
break;
case REBOOT_REASON_PERIODIC:
restart_reason =
extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_PERIODIC;
extensions::api::runtime::ON_RESTART_REQUIRED_REASON_PERIODIC;
break;
default:
NOTREACHED() << "Unknown reboot reason=" << reason;
@ -135,9 +134,8 @@ void KioskAppUpdateService::OnKioskAppCacheUpdated(const std::string& app_id) {
return;
extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent(
profile_,
app_id_,
extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE);
profile_, app_id_,
extensions::api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE);
StartAppUpdateRestartTimer();
}

@ -483,7 +483,7 @@ IN_PROC_BROWSER_TEST_F(PowerPolicyInSessionBrowserTest, AllowScreenWakeLocks) {
// Pretend an extension grabs a screen wake lock.
const char kExtensionId[] = "abcdefghijklmnopabcdefghijlkmnop";
extensions::PowerAPI::Get(browser()->profile())
->AddRequest(kExtensionId, extensions::core_api::power::LEVEL_DISPLAY);
->AddRequest(kExtensionId, extensions::api::power::LEVEL_DISPLAY);
base::RunLoop().RunUntilIdle();
// Check that the lock is in effect (ignoring ac_idle_action,

@ -113,7 +113,7 @@ class DeclarativeApiTest : public ExtensionApiTest {
RulesRegistryService::kDefaultRulesRegistryID,
extensions::declarative_webrequest_constants::kOnRequest);
std::vector<linked_ptr<core_api::events::Rule>> rules;
std::vector<linked_ptr<api::events::Rule>> rules;
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,

@ -20,8 +20,8 @@ const char kExtensionId[] = "foo";
void InsertRule(scoped_refptr<extensions::RulesRegistry> registry,
const std::string& id) {
std::vector<linked_ptr<extensions::core_api::events::Rule> > add_rules;
add_rules.push_back(make_linked_ptr(new extensions::core_api::events::Rule));
std::vector<linked_ptr<extensions::api::events::Rule>> add_rules;
add_rules.push_back(make_linked_ptr(new extensions::api::events::Rule));
add_rules[0]->id.reset(new std::string(id));
std::string error = registry->AddRules(kExtensionId, add_rules);
EXPECT_TRUE(error.empty());
@ -29,7 +29,7 @@ void InsertRule(scoped_refptr<extensions::RulesRegistry> registry,
void VerifyNumberOfRules(scoped_refptr<extensions::RulesRegistry> registry,
size_t expected_number_of_rules) {
std::vector<linked_ptr<extensions::core_api::events::Rule> > get_rules;
std::vector<linked_ptr<extensions::api::events::Rule>> get_rules;
registry->GetAllRules(kExtensionId, &get_rules);
EXPECT_EQ(expected_number_of_rules, get_rules.size());
}

@ -71,8 +71,8 @@ class RulesRegistryWithCacheTest : public testing::Test {
std::string AddRule(const std::string& extension_id,
const std::string& rule_id,
TestRulesRegistry* registry) {
std::vector<linked_ptr<core_api::events::Rule>> add_rules;
add_rules.push_back(make_linked_ptr(new core_api::events::Rule));
std::vector<linked_ptr<api::events::Rule>> add_rules;
add_rules.push_back(make_linked_ptr(new api::events::Rule));
add_rules[0]->id.reset(new std::string(rule_id));
return registry->AddRules(extension_id, add_rules);
}
@ -91,7 +91,7 @@ class RulesRegistryWithCacheTest : public testing::Test {
int GetNumberOfRules(const std::string& extension_id,
TestRulesRegistry* registry) {
std::vector<linked_ptr<core_api::events::Rule>> get_rules;
std::vector<linked_ptr<api::events::Rule>> get_rules;
registry->GetAllRules(extension_id, &get_rules);
return get_rules.size();
}
@ -187,7 +187,7 @@ TEST_F(RulesRegistryWithCacheTest, GetRules) {
std::vector<std::string> rules_to_get;
rules_to_get.push_back(kRuleId);
rules_to_get.push_back("unknown_rule");
std::vector<linked_ptr<core_api::events::Rule>> gotten_rules;
std::vector<linked_ptr<api::events::Rule>> gotten_rules;
registry_->GetRules(extension1_->id(), rules_to_get, &gotten_rules);
ASSERT_EQ(1u, gotten_rules.size());
ASSERT_TRUE(gotten_rules[0]->id.get());
@ -201,7 +201,7 @@ TEST_F(RulesRegistryWithCacheTest, GetAllRules) {
EXPECT_EQ("", AddRule(extension2_->id(), kRuleId));
// Check that we get the correct rules.
std::vector<linked_ptr<core_api::events::Rule>> gotten_rules;
std::vector<linked_ptr<api::events::Rule>> gotten_rules;
registry_->GetAllRules(extension1_->id(), &gotten_rules);
EXPECT_EQ(2u, gotten_rules.size());
ASSERT_TRUE(gotten_rules[0]->id.get());

@ -175,7 +175,7 @@ ChromeContentRulesRegistry::ContentRule::~ContentRule() {}
scoped_ptr<const ChromeContentRulesRegistry::ContentRule>
ChromeContentRulesRegistry::CreateRule(const Extension* extension,
const core_api::events::Rule& api_rule,
const api::events::Rule& api_rule,
std::string* error) {
ScopedVector<const ContentCondition> conditions;
for (const linked_ptr<base::Value>& value : api_rule.conditions) {
@ -260,7 +260,7 @@ ChromeContentRulesRegistry::GetMatches(
std::string ChromeContentRulesRegistry::AddRulesImpl(
const std::string& extension_id,
const std::vector<linked_ptr<core_api::events::Rule>>& rules) {
const std::vector<linked_ptr<api::events::Rule>>& rules) {
EvaluationScope evaluation_scope(this);
const Extension* extension = ExtensionRegistry::Get(browser_context())
->GetInstalledExtension(extension_id);
@ -269,7 +269,7 @@ std::string ChromeContentRulesRegistry::AddRulesImpl(
std::string error;
RulesMap new_content_rules;
for (const linked_ptr<core_api::events::Rule>& rule : rules) {
for (const linked_ptr<api::events::Rule>& rule : rules) {
ExtensionRuleIdPair rule_id(extension, *rule->id);
DCHECK(content_rules_.find(rule_id) == content_rules_.end());

@ -50,7 +50,7 @@ namespace extensions {
//
// Here is the high level overview of this functionality:
//
// core_api::events::Rule consists of conditions and actions, these are
// api::events::Rule consists of conditions and actions, these are
// represented as a ContentRule with ContentConditions and ContentRuleActions.
//
// The evaluation of URL related condition attributes (host_suffix, path_prefix)
@ -84,7 +84,7 @@ class ChromeContentRulesRegistry
// RulesRegistry:
std::string AddRulesImpl(
const std::string& extension_id,
const std::vector<linked_ptr<core_api::events::Rule>>& rules) override;
const std::vector<linked_ptr<api::events::Rule>>& rules) override;
std::string RemoveRulesImpl(
const std::string& extension_id,
const std::vector<std::string>& rule_identifiers) override;
@ -156,10 +156,9 @@ class ChromeContentRulesRegistry
// and ContentAction. |extension| may be NULL in tests. If |error| is empty,
// the translation was successful and the returned rule is internally
// consistent.
scoped_ptr<const ContentRule> CreateRule(
const Extension* extension,
const core_api::events::Rule& api_rule,
std::string* error);
scoped_ptr<const ContentRule> CreateRule(const Extension* extension,
const api::events::Rule& api_rule,
std::string* error);
// True if this object is managing the rules for |context|.
bool ManagingRulesForBrowserContext(content::BrowserContext* context);

@ -51,8 +51,8 @@ TEST_F(DeclarativeChromeContentRulesRegistryTest, ActiveRulesDoesntGrow) {
EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting());
// Add a rule.
linked_ptr<core_api::events::Rule> rule(new core_api::events::Rule);
core_api::events::Rule::Populate(
linked_ptr<api::events::Rule> rule(new api::events::Rule);
api::events::Rule::Populate(
*base::test::ParseJson(
"{\n"
" \"id\": \"rule1\",\n"
@ -67,7 +67,7 @@ TEST_F(DeclarativeChromeContentRulesRegistryTest, ActiveRulesDoesntGrow) {
" ]\n"
"}"),
rule.get());
std::vector<linked_ptr<core_api::events::Rule>> rules;
std::vector<linked_ptr<api::events::Rule>> rules;
rules.push_back(rule);
const Extension* extension = env()->MakeExtension(*base::test::ParseJson(

@ -96,7 +96,7 @@ class WebRequestRulesRegistryTest : public testing::Test {
// Returns a rule that roughly matches http://*.example.com and
// https://www.example.com and cancels it
linked_ptr<core_api::events::Rule> CreateRule1() {
linked_ptr<api::events::Rule> CreateRule1() {
base::ListValue* scheme_http = new base::ListValue();
scheme_http->Append(new base::StringValue("http"));
base::DictionaryValue* http_condition_dict = new base::DictionaryValue();
@ -121,7 +121,7 @@ class WebRequestRulesRegistryTest : public testing::Test {
base::DictionaryValue action_dict;
action_dict.SetString(keys::kInstanceTypeKey, keys::kCancelRequestType);
linked_ptr<core_api::events::Rule> rule(new core_api::events::Rule);
linked_ptr<api::events::Rule> rule(new api::events::Rule);
rule->id.reset(new std::string(kRuleId1));
rule->priority.reset(new int(100));
rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy()));
@ -133,14 +133,14 @@ class WebRequestRulesRegistryTest : public testing::Test {
}
// Returns a rule that matches anything and cancels it.
linked_ptr<core_api::events::Rule> CreateRule2() {
linked_ptr<api::events::Rule> CreateRule2() {
base::DictionaryValue condition_dict;
condition_dict.SetString(keys::kInstanceTypeKey, keys::kRequestMatcherType);
base::DictionaryValue action_dict;
action_dict.SetString(keys::kInstanceTypeKey, keys::kCancelRequestType);
linked_ptr<core_api::events::Rule> rule(new core_api::events::Rule);
linked_ptr<api::events::Rule> rule(new api::events::Rule);
rule->id.reset(new std::string(kRuleId2));
rule->priority.reset(new int(100));
rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy()));
@ -149,7 +149,7 @@ class WebRequestRulesRegistryTest : public testing::Test {
return rule;
}
linked_ptr<core_api::events::Rule> CreateRedirectRule(
linked_ptr<api::events::Rule> CreateRedirectRule(
const std::string& destination) {
base::DictionaryValue condition_dict;
condition_dict.SetString(keys::kInstanceTypeKey, keys::kRequestMatcherType);
@ -158,7 +158,7 @@ class WebRequestRulesRegistryTest : public testing::Test {
action_dict.SetString(keys::kInstanceTypeKey, keys::kRedirectRequestType);
action_dict.SetString(keys::kRedirectUrlKey, destination);
linked_ptr<core_api::events::Rule> rule(new core_api::events::Rule);
linked_ptr<api::events::Rule> rule(new api::events::Rule);
rule->id.reset(new std::string(kRuleId3));
rule->priority.reset(new int(100));
rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy()));
@ -169,7 +169,7 @@ class WebRequestRulesRegistryTest : public testing::Test {
// Create a rule to ignore all other rules for a destination that
// contains index.html.
linked_ptr<core_api::events::Rule> CreateIgnoreRule() {
linked_ptr<api::events::Rule> CreateIgnoreRule() {
base::DictionaryValue condition_dict;
base::DictionaryValue* http_condition_dict = new base::DictionaryValue();
http_condition_dict->SetString(keys2::kPathContainsKey, "index.html");
@ -180,7 +180,7 @@ class WebRequestRulesRegistryTest : public testing::Test {
action_dict.SetString(keys::kInstanceTypeKey, keys::kIgnoreRulesType);
action_dict.SetInteger(keys::kLowerPriorityThanKey, 150);
linked_ptr<core_api::events::Rule> rule(new core_api::events::Rule);
linked_ptr<api::events::Rule> rule(new api::events::Rule);
rule->id.reset(new std::string(kRuleId4));
rule->priority.reset(new int(200));
rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy()));
@ -205,13 +205,13 @@ class WebRequestRulesRegistryTest : public testing::Test {
// Create a rule with the ID |rule_id| and with conditions created from the
// |attributes| specified (one entry one condition). An example value of a
// string from |attributes| is: "\"resourceType\": [\"stylesheet\"], \n".
linked_ptr<core_api::events::Rule> CreateCancellingRule(
linked_ptr<api::events::Rule> CreateCancellingRule(
const char* rule_id,
const std::vector<const std::string*>& attributes) {
base::DictionaryValue action_dict;
action_dict.SetString(keys::kInstanceTypeKey, keys::kCancelRequestType);
linked_ptr<core_api::events::Rule> rule(new core_api::events::Rule);
linked_ptr<api::events::Rule> rule(new api::events::Rule);
rule->id.reset(new std::string(rule_id));
rule->priority.reset(new int(1));
rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy()));
@ -270,7 +270,7 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) {
new TestWebRequestRulesRegistry(extension_info_map_));
std::string error;
std::vector<linked_ptr<core_api::events::Rule>> rules;
std::vector<linked_ptr<api::events::Rule>> rules;
rules.push_back(CreateRule1());
rules.push_back(CreateRule2());
@ -312,7 +312,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveRulesImpl) {
std::string error;
// Setup RulesRegistry to contain two rules.
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add;
std::vector<linked_ptr<api::events::Rule>> rules_to_add;
rules_to_add.push_back(CreateRule1());
rules_to_add.push_back(CreateRule2());
error = registry->AddRules(kExtensionId, rules_to_add);
@ -320,7 +320,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveRulesImpl) {
EXPECT_EQ(1, registry->num_clear_cache_calls());
// Verify initial state.
std::vector<linked_ptr<core_api::events::Rule>> registered_rules;
std::vector<linked_ptr<api::events::Rule>> registered_rules;
registry->GetAllRules(kExtensionId, &registered_rules);
EXPECT_EQ(2u, registered_rules.size());
EXPECT_EQ(1u, registry->RulesWithoutTriggers());
@ -360,7 +360,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveAllRulesImpl) {
std::string error;
// Setup RulesRegistry to contain two rules, one for each extension.
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add(1);
std::vector<linked_ptr<api::events::Rule>> rules_to_add(1);
rules_to_add[0] = CreateRule1();
error = registry->AddRules(kExtensionId, rules_to_add);
EXPECT_EQ("", error);
@ -372,7 +372,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveAllRulesImpl) {
EXPECT_EQ(2, registry->num_clear_cache_calls());
// Verify initial state.
std::vector<linked_ptr<core_api::events::Rule>> registered_rules;
std::vector<linked_ptr<api::events::Rule>> registered_rules;
registry->GetAllRules(kExtensionId, &registered_rules);
EXPECT_EQ(1u, registered_rules.size());
registered_rules.clear();
@ -411,12 +411,12 @@ TEST_F(WebRequestRulesRegistryTest, Precedences) {
new TestWebRequestRulesRegistry(extension_info_map_));
std::string error;
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add_1(1);
std::vector<linked_ptr<api::events::Rule>> rules_to_add_1(1);
rules_to_add_1[0] = CreateRedirectRule("http://www.foo.com");
error = registry->AddRules(kExtensionId, rules_to_add_1);
EXPECT_EQ("", error);
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add_2(1);
std::vector<linked_ptr<api::events::Rule>> rules_to_add_2(1);
rules_to_add_2[0] = CreateRedirectRule("http://www.bar.com");
error = registry->AddRules(kExtensionId2, rules_to_add_2);
EXPECT_EQ("", error);
@ -455,17 +455,17 @@ TEST_F(WebRequestRulesRegistryTest, Priorities) {
new TestWebRequestRulesRegistry(extension_info_map_));
std::string error;
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add_1(1);
std::vector<linked_ptr<api::events::Rule>> rules_to_add_1(1);
rules_to_add_1[0] = CreateRedirectRule("http://www.foo.com");
error = registry->AddRules(kExtensionId, rules_to_add_1);
EXPECT_EQ("", error);
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add_2(1);
std::vector<linked_ptr<api::events::Rule>> rules_to_add_2(1);
rules_to_add_2[0] = CreateRedirectRule("http://www.bar.com");
error = registry->AddRules(kExtensionId2, rules_to_add_2);
EXPECT_EQ("", error);
std::vector<linked_ptr<core_api::events::Rule>> rules_to_add_3(1);
std::vector<linked_ptr<api::events::Rule>> rules_to_add_3(1);
rules_to_add_3[0] = CreateIgnoreRule();
error = registry->AddRules(kExtensionId, rules_to_add_3);
EXPECT_EQ("", error);
@ -532,11 +532,11 @@ TEST_F(WebRequestRulesRegistryTest, IgnoreRulesByTag) {
scoped_ptr<base::Value> value2 = base::JSONReader::Read(kRule2);
ASSERT_TRUE(value2.get());
std::vector<linked_ptr<core_api::events::Rule>> rules;
rules.push_back(make_linked_ptr(new core_api::events::Rule));
rules.push_back(make_linked_ptr(new core_api::events::Rule));
ASSERT_TRUE(core_api::events::Rule::Populate(*value1, rules[0].get()));
ASSERT_TRUE(core_api::events::Rule::Populate(*value2, rules[1].get()));
std::vector<linked_ptr<api::events::Rule>> rules;
rules.push_back(make_linked_ptr(new api::events::Rule));
rules.push_back(make_linked_ptr(new api::events::Rule));
ASSERT_TRUE(api::events::Rule::Populate(*value1, rules[0].get()));
ASSERT_TRUE(api::events::Rule::Populate(*value2, rules[1].get()));
scoped_refptr<WebRequestRulesRegistry> registry(
new TestWebRequestRulesRegistry(extension_info_map_));
@ -571,7 +571,7 @@ TEST_F(WebRequestRulesRegistryTest, GetMatchesCheckFulfilled) {
kNonMatchingNonUrlAttribute);
std::string error;
std::vector<const std::string*> attributes;
std::vector<linked_ptr<core_api::events::Rule>> rules;
std::vector<linked_ptr<api::events::Rule>> rules;
// Rules 1 and 2 have one condition, neither of them should fire.
attributes.push_back(&kNonMatchingNonUrlAttribute);
@ -618,7 +618,7 @@ TEST_F(WebRequestRulesRegistryTest, GetMatchesDifferentUrls) {
"\"firstPartyForCookiesUrl\": { \"hostContains\": \"fpfc\" }, \n");
std::string error;
std::vector<const std::string*> attributes;
std::vector<linked_ptr<core_api::events::Rule>> rules;
std::vector<linked_ptr<api::events::Rule>> rules;
// Rule 1 has one condition, with a url attribute
attributes.push_back(&kUrlAttribute);
@ -699,8 +699,8 @@ TEST(WebRequestRulesRegistrySimpleTest, StageChecker) {
scoped_ptr<base::Value> value = base::JSONReader::Read(kRule);
ASSERT_TRUE(value);
core_api::events::Rule rule;
ASSERT_TRUE(core_api::events::Rule::Populate(*value, &rule));
api::events::Rule rule;
ASSERT_TRUE(api::events::Rule::Populate(*value, &rule));
std::string error;
URLMatcher matcher;
@ -789,9 +789,9 @@ TEST_F(WebRequestRulesRegistryTest, CheckOriginAndPathRegEx) {
scoped_ptr<base::Value> value = base::JSONReader::Read(kRule);
ASSERT_TRUE(value.get());
std::vector<linked_ptr<core_api::events::Rule>> rules;
rules.push_back(make_linked_ptr(new core_api::events::Rule));
ASSERT_TRUE(core_api::events::Rule::Populate(*value, rules.back().get()));
std::vector<linked_ptr<api::events::Rule>> rules;
rules.push_back(make_linked_ptr(new api::events::Rule));
ASSERT_TRUE(api::events::Rule::Populate(*value, rules.back().get()));
scoped_refptr<WebRequestRulesRegistry> registry(
new TestWebRequestRulesRegistry(extension_info_map_));

@ -166,7 +166,7 @@ class EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction
};
class EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction
: public core_api::BluetoothSocketAbstractConnectFunction {
: public api::BluetoothSocketAbstractConnectFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"easyUnlockPrivate.connectToBluetoothServiceInsecurely",
@ -328,7 +328,7 @@ class EasyUnlockPrivateGetUserInfoFunction : public SyncExtensionFunction {
};
class EasyUnlockPrivateGetConnectionInfoFunction
: public core_api::BluetoothExtensionFunction {
: public api::BluetoothExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getConnectionInfo",
EASYUNLOCKPRIVATE_GETCONNECTIONINFO)

@ -152,10 +152,10 @@ class TestDelegate : public NetworkingPrivateDelegate {
if (fail_)
return result.Pass();
result.reset(new DeviceStateList);
scoped_ptr<core_api::networking_private::DeviceStateProperties> properties(
new core_api::networking_private::DeviceStateProperties);
properties->type = core_api::networking_private::NETWORK_TYPE_ETHERNET;
properties->state = core_api::networking_private::DEVICE_STATE_TYPE_ENABLED;
scoped_ptr<api::networking_private::DeviceStateProperties> properties(
new api::networking_private::DeviceStateProperties);
properties->type = api::networking_private::NETWORK_TYPE_ETHERNET;
properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED;
result->push_back(properties.Pass());
return result.Pass();
}

@ -37,7 +37,7 @@ using extensions::Extension;
using extensions::ExtensionSystem;
using extensions::ExtensionUpdater;
using extensions::core_api::runtime::PlatformInfo;
using extensions::api::runtime::PlatformInfo;
namespace {
@ -183,15 +183,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 = extensions::core_api::runtime::PLATFORM_OS_MAC;
info->os = extensions::api::runtime::PLATFORM_OS_MAC;
} else if (strcmp(os, "win") == 0) {
info->os = extensions::core_api::runtime::PLATFORM_OS_WIN;
info->os = extensions::api::runtime::PLATFORM_OS_WIN;
} else if (strcmp(os, "cros") == 0) {
info->os = extensions::core_api::runtime::PLATFORM_OS_CROS;
info->os = extensions::api::runtime::PLATFORM_OS_CROS;
} else if (strcmp(os, "linux") == 0) {
info->os = extensions::core_api::runtime::PLATFORM_OS_LINUX;
info->os = extensions::api::runtime::PLATFORM_OS_LINUX;
} else if (strcmp(os, "openbsd") == 0) {
info->os = extensions::core_api::runtime::PLATFORM_OS_OPENBSD;
info->os = extensions::api::runtime::PLATFORM_OS_OPENBSD;
} else {
NOTREACHED();
return false;
@ -199,11 +199,11 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
const char* arch = update_client::UpdateQueryParams::GetArch();
if (strcmp(arch, "arm") == 0) {
info->arch = extensions::core_api::runtime::PLATFORM_ARCH_ARM;
info->arch = extensions::api::runtime::PLATFORM_ARCH_ARM;
} else if (strcmp(arch, "x86") == 0) {
info->arch = extensions::core_api::runtime::PLATFORM_ARCH_X86_32;
info->arch = extensions::api::runtime::PLATFORM_ARCH_X86_32;
} else if (strcmp(arch, "x64") == 0) {
info->arch = extensions::core_api::runtime::PLATFORM_ARCH_X86_64;
info->arch = extensions::api::runtime::PLATFORM_ARCH_X86_64;
} else {
NOTREACHED();
return false;
@ -211,14 +211,11 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch();
if (strcmp(nacl_arch, "arm") == 0) {
info->nacl_arch =
extensions::core_api::runtime::PLATFORM_NACL_ARCH_ARM;
info->nacl_arch = extensions::api::runtime::PLATFORM_NACL_ARCH_ARM;
} else if (strcmp(nacl_arch, "x86-32") == 0) {
info->nacl_arch =
extensions::core_api::runtime::PLATFORM_NACL_ARCH_X86_32;
info->nacl_arch = extensions::api::runtime::PLATFORM_NACL_ARCH_X86_32;
} else if (strcmp(nacl_arch, "x86-64") == 0) {
info->nacl_arch =
extensions::core_api::runtime::PLATFORM_NACL_ARCH_X86_64;
info->nacl_arch = extensions::api::runtime::PLATFORM_NACL_ARCH_X86_64;
} else {
NOTREACHED();
return false;

@ -47,8 +47,7 @@ class ChromeRuntimeAPIDelegate : public extensions::RuntimeAPIDelegate,
bool CheckForUpdates(const std::string& extension_id,
const UpdateCheckCallback& callback) override;
void OpenURL(const GURL& uninstall_url) override;
bool GetPlatformInfo(
extensions::core_api::runtime::PlatformInfo* info) override;
bool GetPlatformInfo(extensions::api::runtime::PlatformInfo* info) override;
bool RestartDevice(std::string* error_message) override;
bool OpenOptionsPage(const extensions::Extension* extension) override;

@ -17,7 +17,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace core_api {
namespace api {
static scoped_ptr<KeyedService> ApiResourceManagerTestFactory(
content::BrowserContext* context) {
@ -66,5 +66,5 @@ TEST_F(SocketsTcpServerUnitTest, Create) {
ASSERT_TRUE(result.get());
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -43,7 +43,7 @@ using content::BrowserThread;
namespace extensions {
class ExtensionRegistry;
namespace storage = core_api::storage;
namespace storage = api::storage;
namespace {

@ -27,10 +27,9 @@ namespace {
// extensions/common/api/storage.json.
SettingsStorageQuotaEnforcer::Limits GetSyncQuotaLimits() {
SettingsStorageQuotaEnforcer::Limits limits = {
static_cast<size_t>(core_api::storage::sync::QUOTA_BYTES),
static_cast<size_t>(core_api::storage::sync::QUOTA_BYTES_PER_ITEM),
static_cast<size_t>(core_api::storage::sync::MAX_ITEMS)
};
static_cast<size_t>(api::storage::sync::QUOTA_BYTES),
static_cast<size_t>(api::storage::sync::QUOTA_BYTES_PER_ITEM),
static_cast<size_t>(api::storage::sync::MAX_ITEMS)};
return limits;
}

@ -112,7 +112,7 @@ namespace windows = api::windows;
namespace keys = tabs_constants;
namespace tabs = api::tabs;
using core_api::extension_types::InjectDetails;
using api::extension_types::InjectDetails;
namespace {

@ -23,7 +23,7 @@
#include "ui/keyboard/keyboard_switches.h"
#include "ui/keyboard/keyboard_util.h"
namespace keyboard_api = extensions::core_api::virtual_keyboard_private;
namespace keyboard_api = extensions::api::virtual_keyboard_private;
namespace {

@ -31,7 +31,7 @@ namespace chromeos {
namespace {
namespace api_vpn = extensions::core_api::vpn_provider;
namespace api_vpn = extensions::api::vpn_provider;
const char kNetworkProfilePath[] = "/network/test";
const char kTestConfig[] = "testconfig";

@ -57,7 +57,7 @@
namespace helpers = extension_web_request_api_helpers;
namespace keys = extension_web_request_api_constants;
namespace web_request = extensions::core_api::web_request;
namespace web_request = extensions::api::web_request;
using base::BinaryValue;
using base::DictionaryValue;

@ -128,7 +128,7 @@ bool ChromeExtensionsBrowserClient::IsExtensionIncognitoEnabled(
}
bool ChromeExtensionsBrowserClient::CanExtensionCrossIncognito(
const extensions::Extension* extension,
const Extension* extension,
content::BrowserContext* context) const {
return IsGuestSession(context)
|| util::CanCrossIncognito(extension, context);
@ -243,23 +243,20 @@ ChromeExtensionsBrowserClient::GetExtensionSystemFactory() {
void ChromeExtensionsBrowserClient::RegisterExtensionFunctions(
ExtensionFunctionRegistry* registry) const {
// Preferences.
registry->RegisterFunction<extensions::GetPreferenceFunction>();
registry->RegisterFunction<extensions::SetPreferenceFunction>();
registry->RegisterFunction<extensions::ClearPreferenceFunction>();
registry->RegisterFunction<GetPreferenceFunction>();
registry->RegisterFunction<SetPreferenceFunction>();
registry->RegisterFunction<ClearPreferenceFunction>();
// Direct Preference Access for Component Extensions.
registry->RegisterFunction<
extensions::chromedirectsetting::GetDirectSettingFunction>();
registry->RegisterFunction<
extensions::chromedirectsetting::SetDirectSettingFunction>();
registry->RegisterFunction<
extensions::chromedirectsetting::ClearDirectSettingFunction>();
registry->RegisterFunction<chromedirectsetting::GetDirectSettingFunction>();
registry->RegisterFunction<chromedirectsetting::SetDirectSettingFunction>();
registry->RegisterFunction<chromedirectsetting::ClearDirectSettingFunction>();
// Generated APIs from lower-level modules.
extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry);
api::GeneratedFunctionRegistry::RegisterAll(registry);
// Generated APIs from Chrome.
extensions::api::GeneratedFunctionRegistry::RegisterAll(registry);
api::ChromeGeneratedFunctionRegistry::RegisterAll(registry);
}
void ChromeExtensionsBrowserClient::RegisterMojoServices(
@ -269,11 +266,10 @@ void ChromeExtensionsBrowserClient::RegisterMojoServices(
RegisterChromeServicesForFrame(render_frame_host, extension);
}
scoped_ptr<extensions::RuntimeAPIDelegate>
scoped_ptr<RuntimeAPIDelegate>
ChromeExtensionsBrowserClient::CreateRuntimeAPIDelegate(
content::BrowserContext* context) const {
return scoped_ptr<extensions::RuntimeAPIDelegate>(
new ChromeRuntimeAPIDelegate(context));
return scoped_ptr<RuntimeAPIDelegate>(new ChromeRuntimeAPIDelegate(context));
}
const ComponentExtensionResourceManager*
@ -332,7 +328,7 @@ ChromeExtensionsBrowserClient::GetExtensionWebContentsObserver(
void ChromeExtensionsBrowserClient::ReportError(
content::BrowserContext* context,
scoped_ptr<ExtensionError> error) {
extensions::ErrorConsole::Get(context)->ReportError(error.Pass());
ErrorConsole::Get(context)->ReportError(error.Pass());
}
void ChromeExtensionsBrowserClient::CleanUpWebView(int embedder_process_id,

@ -29,7 +29,7 @@ class ChromeExtensionsAPIClient;
class ChromeProcessManagerDelegate;
class ContentSettingsPrefsObserver;
// Implementation of extensions::BrowserClient for Chrome, which includes
// Implementation of BrowserClient for Chrome, which includes
// knowledge of Profiles, BrowserContexts and incognito.
//
// NOTE: Methods that do not require knowledge of browser concepts should be
@ -61,7 +61,7 @@ class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient {
const std::string& extension_id,
content::BrowserContext* context) const override;
bool CanExtensionCrossIncognito(
const extensions::Extension* extension,
const Extension* extension,
content::BrowserContext* context) const override;
net::URLRequestJob* MaybeCreateResourceBundleRequestJob(
net::URLRequest* request,
@ -91,7 +91,7 @@ class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient {
ExtensionFunctionRegistry* registry) const override;
void RegisterMojoServices(content::RenderFrameHost* render_frame_host,
const Extension* extension) const override;
scoped_ptr<extensions::RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
content::BrowserContext* context) const override;
const ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() override;

@ -16,7 +16,7 @@ DisplayInfoProviderAura::~DisplayInfoProviderAura() {
bool DisplayInfoProviderAura::SetInfo(
const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) {
*error = "Not implemented";
return false;
@ -24,7 +24,7 @@ bool DisplayInfoProviderAura::SetInfo(
void DisplayInfoProviderAura::UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
extensions::core_api::system_display::DisplayUnitInfo* unit) {
extensions::api::system_display::DisplayUnitInfo* unit) {
static bool logged_once = false;
if (!logged_once) {
NOTIMPLEMENTED();

@ -16,11 +16,11 @@ class DisplayInfoProviderAura : public DisplayInfoProvider {
// DisplayInfoProvider implementation.
bool SetInfo(const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) override;
void UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
core_api::system_display::DisplayUnitInfo* unit) override;
api::system_display::DisplayUnitInfo* unit) override;
gfx::Screen* GetActiveScreen() override;
private:

@ -17,10 +17,10 @@ using ash::DisplayManager;
namespace extensions {
using core_api::system_display::Bounds;
using core_api::system_display::DisplayUnitInfo;
using core_api::system_display::DisplayProperties;
using core_api::system_display::Insets;
using api::system_display::Bounds;
using api::system_display::DisplayUnitInfo;
using api::system_display::DisplayProperties;
using api::system_display::Insets;
namespace {
@ -357,7 +357,7 @@ bool DisplayInfoProviderChromeOS::SetInfo(const std::string& display_id_str,
void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
extensions::core_api::system_display::DisplayUnitInfo* unit) {
extensions::api::system_display::DisplayUnitInfo* unit) {
ash::DisplayManager* display_manager =
ash::Shell::GetInstance()->display_manager();
unit->name = display_manager->GetDisplayNameForId(display.id());

@ -16,11 +16,11 @@ class DisplayInfoProviderChromeOS : public DisplayInfoProvider {
// DisplayInfoProvider implementation.
bool SetInfo(const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) override;
void UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
core_api::system_display::DisplayUnitInfo* unit) override;
api::system_display::DisplayUnitInfo* unit) override;
gfx::Screen* GetActiveScreen() override;
private:

@ -38,7 +38,7 @@ class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase {
protected:
void CallSetDisplayUnitInfo(
const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
bool* success,
std::string* error) {
// Reset error messsage.
@ -61,14 +61,14 @@ class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase {
}
std::string SystemInfoDisplayInsetsToString(
const core_api::system_display::Insets& insets) const {
const api::system_display::Insets& insets) const {
// Order to match gfx::Insets::ToString().
return base::StringPrintf(
"%d,%d,%d,%d", insets.top, insets.left, insets.bottom, insets.right);
}
std::string SystemInfoDisplayBoundsToString(
const core_api::system_display::Bounds& bounds) const {
const api::system_display::Bounds& bounds) const {
// Order to match gfx::Rect::ToString().
return base::StringPrintf(
"%d,%d %dx%d", bounds.left, bounds.top, bounds.width, bounds.height);
@ -328,7 +328,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftExact) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-520));
info.bounds_origin_y.reset(new int(50));
@ -347,7 +347,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginRightExact) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(1200));
info.bounds_origin_y.reset(new int(100));
@ -366,7 +366,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopExact) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(1100));
info.bounds_origin_y.reset(new int(-400));
@ -385,7 +385,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginBottomExact) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-350));
info.bounds_origin_y.reset(new int(600));
@ -404,7 +404,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginSameCenter) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(340));
info.bounds_origin_y.reset(new int(100));
@ -423,7 +423,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftOutside) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-1040));
info.bounds_origin_y.reset(new int(100));
@ -442,7 +442,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopOutside) {
UpdateDisplay("1200x600,520x400");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-360));
info.bounds_origin_y.reset(new int(-301));
@ -462,7 +462,7 @@ TEST_F(DisplayInfoProviderChromeosTest,
UpdateDisplay("1200x600,1000x100");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-650));
info.bounds_origin_y.reset(new int(700));
@ -481,7 +481,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginRightButSharesTopSide) {
UpdateDisplay("1200x600,1000x100");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(850));
info.bounds_origin_y.reset(new int(-150));
@ -500,7 +500,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopButSharesLeftSide) {
UpdateDisplay("1200x600,1000x100/l");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-150));
info.bounds_origin_y.reset(new int(-650));
@ -520,7 +520,7 @@ TEST_F(DisplayInfoProviderChromeosTest,
UpdateDisplay("1200x600,1000x100/l");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(1350));
info.bounds_origin_y.reset(new int(450));
@ -539,7 +539,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginPrimaryHiDPI) {
UpdateDisplay("1200x600*2,500x500");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(250));
info.bounds_origin_y.reset(new int(-100));
@ -558,7 +558,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginSecondaryHiDPI) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(450));
info.bounds_origin_y.reset(new int(-100));
@ -577,7 +577,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOutOfBounds) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(0x200001));
info.bounds_origin_y.reset(new int(-100));
@ -596,7 +596,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOutOfBoundsNegative) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(300));
info.bounds_origin_y.reset(new int(-0x200001));
@ -615,7 +615,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginMaxValues) {
UpdateDisplay("1200x4600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(200000));
info.bounds_origin_y.reset(new int(10));
@ -634,7 +634,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOnPrimary) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(300));
info.is_primary.reset(new bool(true));
@ -658,7 +658,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginWithMirroring) {
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
const gfx::Display& primary = ash::Shell::GetScreen()->GetPrimaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(300));
info.mirroring_source_id.reset(
new std::string(base::Int64ToString(primary.id())));
@ -677,7 +677,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotation) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.rotation.reset(new int(90));
bool success = false;
@ -731,7 +731,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotation) {
TEST_F(DisplayInfoProviderChromeosTest, SetRotationBeforeMaximizeMode) {
ash::ScreenOrientationController* screen_orientation_controller =
ash::Shell::GetInstance()->screen_orientation_controller();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.rotation.reset(new int(90));
bool success = false;
@ -775,7 +775,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) {
->screen_orientation_controller()
->rotation_locked());
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.rotation.reset(new int(90));
bool success = false;
@ -794,7 +794,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetInvalidRotation) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
api::system_display::DisplayProperties info;
info.rotation.reset(new int(91));
bool success = false;
@ -810,8 +810,8 @@ TEST_F(DisplayInfoProviderChromeosTest, SetNegativeOverscan) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
info.overscan.reset(new core_api::system_display::Insets);
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
info.overscan->left = -10;
bool success = false;
@ -873,8 +873,8 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscanLargerThanHorizontalBounds) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
info.overscan.reset(new core_api::system_display::Insets);
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
// Horizontal overscan is 151, which would make the bounds width 149.
info.overscan->left = 50;
info.overscan->top = 10;
@ -895,8 +895,8 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscanLargerThanVerticalBounds) {
UpdateDisplay("1200x600,600x1000");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
info.overscan.reset(new core_api::system_display::Insets);
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
// Vertical overscan is 501, which would make the bounds height 499.
info.overscan->left = 20;
info.overscan->top = 250;
@ -916,8 +916,8 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscan) {
UpdateDisplay("1200x600,600x1000*2");
const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
core_api::system_display::DisplayProperties info;
info.overscan.reset(new core_api::system_display::Insets);
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
info.overscan->left = 20;
info.overscan->top = 199;
info.overscan->right = 130;
@ -947,8 +947,8 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscanForInternal) {
ash::test::DisplayManagerTestApi(GetDisplayManager())
.SetFirstDisplayAsInternalDisplay();
core_api::system_display::DisplayProperties info;
info.overscan.reset(new core_api::system_display::Insets);
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
// Vertical overscan is 501, which would make the bounds height 499.
info.overscan->left = 20;
info.overscan->top = 20;

@ -16,7 +16,7 @@ DisplayInfoProviderMac::~DisplayInfoProviderMac() {
bool DisplayInfoProviderMac::SetInfo(
const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) {
*error = "Not implemented";
return false;
@ -24,7 +24,7 @@ bool DisplayInfoProviderMac::SetInfo(
void DisplayInfoProviderMac::UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
extensions::core_api::system_display::DisplayUnitInfo* unit) {
extensions::api::system_display::DisplayUnitInfo* unit) {
static bool logged_once = false;
if (!logged_once) {
NOTIMPLEMENTED();

@ -16,11 +16,11 @@ class DisplayInfoProviderMac : public DisplayInfoProvider {
// DisplayInfoProvider implementation.
bool SetInfo(const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) override;
void UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
core_api::system_display::DisplayUnitInfo* unit) override;
api::system_display::DisplayUnitInfo* unit) override;
gfx::Screen* GetActiveScreen() override;
private:

@ -17,7 +17,7 @@
namespace extensions {
using core_api::system_display::DisplayUnitInfo;
using api::system_display::DisplayUnitInfo;
namespace {
@ -59,7 +59,7 @@ DisplayInfoProviderWin::~DisplayInfoProviderWin() {
bool DisplayInfoProviderWin::SetInfo(
const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) {
*error = "Not implemented";
return false;
@ -67,7 +67,7 @@ bool DisplayInfoProviderWin::SetInfo(
void DisplayInfoProviderWin::UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
extensions::core_api::system_display::DisplayUnitInfo* unit) {
extensions::api::system_display::DisplayUnitInfo* unit) {
DisplayInfo all_displays;
EnumDisplayMonitors(
NULL, NULL, EnumMonitorCallback, reinterpret_cast<LPARAM>(&all_displays));

@ -16,11 +16,11 @@ class DisplayInfoProviderWin : public DisplayInfoProvider {
// DisplayInfoProvider implementation.
bool SetInfo(const std::string& display_id,
const core_api::system_display::DisplayProperties& info,
const api::system_display::DisplayProperties& info,
std::string* error) override;
void UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
core_api::system_display::DisplayUnitInfo* unit) override;
api::system_display::DisplayUnitInfo* unit) override;
gfx::Screen* GetActiveScreen() override;
private:

@ -22,7 +22,7 @@
namespace extensions {
namespace OnMessage = core_api::test::OnMessage;
namespace OnMessage = api::test::OnMessage;
namespace {

@ -39,7 +39,7 @@
namespace easy_unlock_private_api = extensions::api::easy_unlock_private;
namespace screenlock_private_api = extensions::api::screenlock_private;
namespace app_runtime_api = extensions::core_api::app_runtime;
namespace app_runtime_api = extensions::api::app_runtime;
namespace {

@ -27,8 +27,7 @@
#include "ui/keyboard/keyboard_controller.h"
#include "ui/keyboard/keyboard_controller_observer.h"
namespace virtual_keyboard_private =
extensions::core_api::virtual_keyboard_private;
namespace virtual_keyboard_private = extensions::api::virtual_keyboard_private;
typedef virtual_keyboard_private::OnTextInputBoxFocused::Context Context;

@ -11,6 +11,7 @@ assert(enable_extensions)
json_schema_api("api") {
schemas = true
bundle = true
bundle_name = "Chrome"
deps = schema_dependencies
}
@ -19,6 +20,7 @@ json_schema_api("api") {
json_schema_api("api_registration") {
impl_dir = "//chrome/browser/extensions/api"
bundle_registration = true
bundle_name = "Chrome"
deps = [
# Different APIs include headers from these targets.

@ -12,7 +12,7 @@
namespace {
namespace cast_crypto = ::extensions::core_api::cast_crypto;
namespace cast_crypto = ::extensions::api::cast_crypto;
} // namespace

@ -11,7 +11,7 @@
namespace {
namespace cast_crypto = ::extensions::core_api::cast_crypto;
namespace cast_crypto = ::extensions::api::cast_crypto;
} // namespace

@ -24,6 +24,5 @@ if (enable_webrtc) {
uncompiled_sources = gypi_values.main_non_compiled_schema_files
root_namespace = "extensions::api::%(namespace)s"
schema_include_rules =
"extensions/common/api:extensions::core_api::%(namespace)s"
schema_include_rules = "extensions/common/api:extensions::api::%(namespace)s"
schema_dependencies = [ "//extensions/common/api" ]

@ -92,7 +92,7 @@
'windows.json',
],
'main_schema_include_rules': [
'extensions/common/api:extensions::core_api::%(namespace)s',
'extensions/common/api:extensions::api::%(namespace)s',
],
'main_non_compiled_schema_files': [
'browsing_data.json',
@ -170,6 +170,7 @@
],
'cc_dir': 'chrome/common/extensions/api',
'root_namespace': 'extensions::api::%(namespace)s',
'bundle_name': 'Chrome',
'impl_dir_': 'chrome/browser/extensions/api',
},
}

@ -288,17 +288,17 @@ bool ChromeExtensionsClient::IsScriptableURL(
bool ChromeExtensionsClient::IsAPISchemaGenerated(
const std::string& name) const {
// Test from most common to least common.
return api::GeneratedSchemas::IsGenerated(name) ||
core_api::GeneratedSchemas::IsGenerated(name);
return api::ChromeGeneratedSchemas::IsGenerated(name) ||
api::GeneratedSchemas::IsGenerated(name);
}
base::StringPiece ChromeExtensionsClient::GetAPISchema(
const std::string& name) const {
// Test from most common to least common.
if (api::GeneratedSchemas::IsGenerated(name))
return api::GeneratedSchemas::Get(name);
if (api::ChromeGeneratedSchemas::IsGenerated(name))
return api::ChromeGeneratedSchemas::Get(name);
return core_api::GeneratedSchemas::Get(name);
return api::GeneratedSchemas::Get(name);
}
void ChromeExtensionsClient::RegisterAPISchemaResources(

@ -21,7 +21,7 @@
namespace extensions {
namespace alarms = core_api::alarms;
namespace alarms = api::alarms;
namespace {

@ -34,12 +34,12 @@ class ExtensionRegistry;
struct Alarm {
Alarm();
Alarm(const std::string& name,
const core_api::alarms::AlarmCreateInfo& create_info,
const api::alarms::AlarmCreateInfo& create_info,
base::TimeDelta min_granularity,
base::Time now);
~Alarm();
linked_ptr<core_api::alarms::Alarm> js_alarm;
linked_ptr<api::alarms::Alarm> js_alarm;
// The granularity isn't exposed to the extension's javascript, but we poll at
// least as often as the shortest alarm's granularity. It's initialized as
// the relative delay requested in creation, even if creation uses an absolute

@ -14,7 +14,7 @@
namespace extensions {
namespace alarms = core_api::alarms;
namespace alarms = api::alarms;
namespace {

@ -17,7 +17,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
typedef extensions::core_api::alarms::Alarm JsAlarm;
typedef extensions::api::alarms::Alarm JsAlarm;
namespace extensions {

@ -24,7 +24,7 @@
namespace extensions {
namespace core_api {
namespace api {
class BluetoothSocketApiFunction;
class BluetoothSocketEventDispatcher;
class SerialEventDispatcher;
@ -192,12 +192,12 @@ class ApiResourceManager : public BrowserContextKeyedAPI,
// TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and
// we could avoid maintaining a friends list here.
friend class BluetoothAPI;
friend class core_api::BluetoothSocketApiFunction;
friend class core_api::BluetoothSocketEventDispatcher;
friend class core_api::SerialEventDispatcher;
friend class core_api::TCPServerSocketEventDispatcher;
friend class core_api::TCPSocketEventDispatcher;
friend class core_api::UDPSocketEventDispatcher;
friend class api::BluetoothSocketApiFunction;
friend class api::BluetoothSocketEventDispatcher;
friend class api::SerialEventDispatcher;
friend class api::TCPServerSocketEventDispatcher;
friend class api::TCPSocketEventDispatcher;
friend class api::UDPSocketEventDispatcher;
friend class BrowserContextKeyedAPIFactory<ApiResourceManager<T> >;
static const bool kServiceHasOwnInstanceInIncognito = true;

@ -17,7 +17,7 @@
#include "third_party/skia/include/core/SkRegion.h"
namespace app_current_window_internal =
extensions::core_api::app_current_window_internal;
extensions::api::app_current_window_internal;
namespace Show = app_current_window_internal::Show;
namespace SetBounds = app_current_window_internal::SetBounds;

@ -20,7 +20,7 @@ using content::BrowserContext;
namespace extensions {
namespace app_runtime = core_api::app_runtime;
namespace app_runtime = api::app_runtime;
namespace {

@ -32,7 +32,7 @@
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"
namespace app_window = extensions::core_api::app_window;
namespace app_window = extensions::api::app_window;
namespace Create = app_window::Create;
namespace extensions {

@ -10,7 +10,7 @@
namespace extensions {
namespace core_api {
namespace api {
namespace app_window {
struct CreateWindowOptions;
}
@ -27,13 +27,13 @@ class AppWindowCreateFunction : public AsyncExtensionFunction {
private:
bool GetBoundsSpec(
const extensions::core_api::app_window::CreateWindowOptions& options,
const extensions::api::app_window::CreateWindowOptions& options,
AppWindow::CreateParams* params,
std::string* error);
AppWindow::Frame GetFrameFromString(const std::string& frame_string);
bool GetFrameOptions(
const extensions::core_api::app_window::CreateWindowOptions& options,
const extensions::api::app_window::CreateWindowOptions& options,
AppWindow::CreateParams* create_params);
void UpdateFrameOptionsForChannel(AppWindow::CreateParams* create_params);

@ -11,7 +11,7 @@
namespace extensions {
namespace audio = core_api::audio;
namespace audio = api::audio;
static base::LazyInstance<BrowserContextKeyedAPIFactory<AudioAPI> > g_factory =
LAZY_INSTANCE_INITIALIZER;

@ -15,11 +15,10 @@
namespace extensions {
using OutputInfo = std::vector<linked_ptr<core_api::audio::OutputDeviceInfo>>;
using InputInfo = std::vector<linked_ptr<core_api::audio::InputDeviceInfo>>;
using OutputInfo = std::vector<linked_ptr<api::audio::OutputDeviceInfo>>;
using InputInfo = std::vector<linked_ptr<api::audio::InputDeviceInfo>>;
using DeviceIdList = std::vector<std::string>;
using DeviceInfoList =
std::vector<linked_ptr<core_api::audio::AudioDeviceInfo>>;
using DeviceInfoList = std::vector<linked_ptr<api::audio::AudioDeviceInfo>>;
class AudioService {
public:

@ -15,9 +15,9 @@ using content::BrowserThread;
namespace extensions {
using core_api::audio::OutputDeviceInfo;
using core_api::audio::InputDeviceInfo;
using core_api::audio::AudioDeviceInfo;
using api::audio::OutputDeviceInfo;
using api::audio::InputDeviceInfo;
using api::audio::AudioDeviceInfo;
class AudioServiceImpl : public AudioService,
public chromeos::CrasAudioHandler::AudioObserver {

@ -23,9 +23,9 @@ using content::BrowserThread;
using device::BluetoothAdapter;
using device::BluetoothDevice;
namespace bluetooth = extensions::core_api::bluetooth;
namespace GetDevice = extensions::core_api::bluetooth::GetDevice;
namespace GetDevices = extensions::core_api::bluetooth::GetDevices;
namespace bluetooth = extensions::api::bluetooth;
namespace GetDevice = extensions::api::bluetooth::GetDevice;
namespace GetDevices = extensions::api::bluetooth::GetDevices;
namespace {
@ -96,7 +96,7 @@ void BluetoothAPI::OnListenerRemoved(const EventListenerInfo& details) {
event_router()->OnListenerRemoved();
}
namespace core_api {
namespace api {
BluetoothGetAdapterStateFunction::~BluetoothGetAdapterStateFunction() {}
@ -199,5 +199,5 @@ bool BluetoothStopDiscoveryFunction::DoWork(
return true;
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -64,7 +64,7 @@ class BluetoothAPI : public BrowserContextKeyedAPI,
scoped_ptr<BluetoothEventRouter> event_router_;
};
namespace core_api {
namespace api {
class BluetoothGetAdapterStateFunction : public BluetoothExtensionFunction {
public:
@ -131,7 +131,7 @@ class BluetoothStopDiscoveryFunction : public BluetoothExtensionFunction {
void OnErrorCallback();
};
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_H_

@ -15,14 +15,14 @@
namespace extensions {
namespace bt_private = core_api::bluetooth_private;
namespace bt_private = api::bluetooth_private;
namespace {
void PopulatePairingEvent(const device::BluetoothDevice* device,
bt_private::PairingEventType type,
bt_private::PairingEvent* out) {
core_api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device);
api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device);
out->pairing = type;
}

@ -38,7 +38,7 @@ class BluetoothApiPairingDelegate
private:
// Dispatches a pairing event to the extension.
void DispatchPairingEvent(
const core_api::bluetooth_private::PairingEvent& pairing_event);
const api::bluetooth_private::PairingEvent& pairing_event);
std::string extension_id_;
content::BrowserContext* browser_context_;

@ -10,7 +10,7 @@
#include "device/bluetooth/bluetooth_device.h"
#include "extensions/common/api/bluetooth.h"
namespace bluetooth = extensions::core_api::bluetooth;
namespace bluetooth = extensions::api::bluetooth;
using device::BluetoothDevice;
using bluetooth::VendorIdSource;
@ -88,7 +88,7 @@ bool ConvertDeviceTypeToApi(const BluetoothDevice::DeviceType& input,
} // namespace
namespace extensions {
namespace core_api {
namespace api {
namespace bluetooth {
void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device,
@ -140,5 +140,5 @@ void PopulateAdapterState(const device::BluetoothAdapter& adapter,
}
} // namespace bluetooth
} // namespace core_api
} // namespace api
} // namespace extensions

@ -11,7 +11,7 @@
#include "extensions/common/api/bluetooth.h"
namespace extensions {
namespace core_api {
namespace api {
namespace bluetooth {
// Fill in a Device object from a BluetoothDevice.
@ -24,7 +24,7 @@ void PopulateAdapterState(const device::BluetoothAdapter& adapter,
AdapterState* out);
} // namespace bluetooth
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_

@ -34,7 +34,7 @@ using extensions::Extension;
using extensions::ResultCatcher;
namespace utils = extension_function_test_utils;
namespace api = extensions::core_api;
namespace api = extensions::api;
namespace {

@ -33,8 +33,8 @@
namespace extensions {
namespace bluetooth = core_api::bluetooth;
namespace bt_private = core_api::bluetooth_private;
namespace bluetooth = api::bluetooth;
namespace bt_private = api::bluetooth_private;
BluetoothEventRouter::BluetoothEventRouter(content::BrowserContext* context)
: browser_context_(context),
@ -327,7 +327,7 @@ void BluetoothEventRouter::OnListenerRemoved() {
void BluetoothEventRouter::DispatchAdapterStateEvent() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
core_api::bluetooth::AdapterState state;
api::bluetooth::AdapterState state;
PopulateAdapterState(*adapter_.get(), &state);
scoped_ptr<base::ListValue> args =

@ -34,7 +34,7 @@ MATCHER_P(IsFilterEqual, a, "") {
namespace extensions {
namespace bluetooth = core_api::bluetooth;
namespace bluetooth = api::bluetooth;
class BluetoothEventRouterTest : public ExtensionsTest {
public:

@ -38,7 +38,7 @@ void GetAdapter(const device::BluetoothAdapterFactory::AdapterCallback callback,
} // namespace
namespace extensions {
namespace core_api {
namespace api {
BluetoothExtensionFunction::BluetoothExtensionFunction() {
}
@ -65,5 +65,5 @@ void BluetoothExtensionFunction::RunOnAdapterReady(
DoWork(adapter);
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -16,7 +16,7 @@ class BluetoothAdapter;
} // namespace device
namespace extensions {
namespace core_api {
namespace api {
// Base class for bluetooth extension functions. This class initializes
// bluetooth adapter and calls (on the UI thread) DoWork() implemented by
@ -41,7 +41,7 @@ class BluetoothExtensionFunction : public AsyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction);
};
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_

@ -14,7 +14,7 @@
#include "extensions/browser/api/bluetooth/bluetooth_event_router.h"
#include "extensions/common/api/bluetooth_private.h"
namespace bt_private = extensions::core_api::bluetooth_private;
namespace bt_private = extensions::api::bluetooth_private;
namespace SetDiscoveryFilter = bt_private::SetDiscoveryFilter;
namespace extensions {
@ -60,7 +60,7 @@ void BluetoothPrivateAPI::OnListenerRemoved(const EventListenerInfo& details) {
details.extension_id);
}
namespace core_api {
namespace api {
namespace {
@ -415,6 +415,6 @@ bool BluetoothPrivateSetDiscoveryFilterFunction::DoWork(
return true;
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -46,7 +46,7 @@ class BluetoothPrivateAPI : public BrowserContextKeyedAPI,
content::BrowserContext* browser_context_;
};
namespace core_api {
namespace api {
class BluetoothPrivateSetAdapterStateFunction
: public BluetoothExtensionFunction {
@ -127,7 +127,7 @@ class BluetoothPrivateSetDiscoveryFilterFunction
void OnErrorCallback();
};
} // namespace core_api
} // namespace api
} // namespace extensions

@ -30,8 +30,8 @@ using testing::ReturnPointee;
using testing::WithArgs;
using testing::WithoutArgs;
namespace bt = extensions::core_api::bluetooth;
namespace bt_private = extensions::core_api::bluetooth_private;
namespace bt = extensions::api::bluetooth;
namespace bt_private = extensions::api::bluetooth_private;
namespace extensions {

@ -16,7 +16,7 @@ namespace device {
class BluetoothAdvertisement;
} // namespace device
namespace apibtle = extensions::core_api::bluetooth_low_energy;
namespace apibtle = extensions::api::bluetooth_low_energy;
namespace extensions {

@ -20,7 +20,7 @@
using content::BrowserContext;
using content::BrowserThread;
namespace apibtle = extensions::core_api::bluetooth_low_energy;
namespace apibtle = extensions::api::bluetooth_low_energy;
namespace extensions {
@ -163,7 +163,7 @@ void BluetoothLowEnergyAPI::Shutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
namespace core_api {
namespace api {
BluetoothLowEnergyExtensionFunction::BluetoothLowEnergyExtensionFunction() {
}
@ -1011,5 +1011,5 @@ void BluetoothLowEnergyUnregisterAdvertisementFunction::ErrorCallback(
SendResponse(false);
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -50,7 +50,7 @@ class BluetoothLowEnergyAPI : public BrowserContextKeyedAPI {
DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyAPI);
};
namespace core_api {
namespace api {
// Base class for bluetoothLowEnergy API functions. This class handles some of
// the common logic involved in all API functions, such as checking for
@ -397,7 +397,7 @@ class BluetoothLowEnergyUnregisterAdvertisementFunction
std::string instance_id_;
};
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_

@ -29,7 +29,7 @@ using device::BluetoothGattConnection;
using device::BluetoothGattDescriptor;
using device::BluetoothGattService;
namespace apibtle = extensions::core_api::bluetooth_low_energy;
namespace apibtle = extensions::api::bluetooth_low_energy;
namespace {
@ -546,7 +546,7 @@ BluetoothLowEnergyEventRouter::Status
BluetoothLowEnergyEventRouter::GetDescriptor(
const Extension* extension,
const std::string& instance_id,
core_api::bluetooth_low_energy::Descriptor* out_descriptor) const {
api::bluetooth_low_energy::Descriptor* out_descriptor) const {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(extension);
DCHECK(out_descriptor);

@ -113,14 +113,14 @@ class BluetoothLowEnergyEventRouter
const base::Closure& callback,
const ErrorCallback& error_callback);
// Returns the list of core_api::bluetooth_low_energy::Service objects
// Returns the list of api::bluetooth_low_energy::Service objects
// associated with the Bluetooth device with address |device_address| in
// |out_services|.
// Returns false, if no device with the given address is known. If the device
// is found but it has no GATT services, then returns true and leaves
// |out_services| empty. Returns true, on success. |out_services| must not
// be NULL. If it is non-empty, then its contents will be cleared.
typedef std::vector<linked_ptr<core_api::bluetooth_low_energy::Service> >
typedef std::vector<linked_ptr<api::bluetooth_low_energy::Service>>
ServiceList;
bool GetServices(const std::string& device_address,
ServiceList* out_services) const;
@ -128,7 +128,7 @@ class BluetoothLowEnergyEventRouter
// Populates |out_service| based on GATT service with instance ID
// |instance_id|. |out_service| must not be NULL.
Status GetService(const std::string& instance_id,
core_api::bluetooth_low_energy::Service* out_service) const;
api::bluetooth_low_energy::Service* out_service) const;
// Populates |out_services| with the list of GATT services that are included
// by the GATT service with instance ID |instance_id|. Returns false, if not
@ -138,7 +138,7 @@ class BluetoothLowEnergyEventRouter
Status GetIncludedServices(const std::string& instance_id,
ServiceList* out_services) const;
// Returns the list of core_api::bluetooth_low_energy::Characteristic objects
// Returns the list of api::bluetooth_low_energy::Characteristic objects
// associated with the GATT service with instance ID |instance_id| in
// |out_characteristics|. Returns false, if no service with the given instance
// ID is known. If the service is found but it has no characteristics, then
@ -146,8 +146,7 @@ class BluetoothLowEnergyEventRouter
// |out_characteristics| must not be NULL and if it is non-empty,
// then its contents will be cleared. |extension| is the extension that made
// the call.
typedef std::vector<
linked_ptr<core_api::bluetooth_low_energy::Characteristic> >
typedef std::vector<linked_ptr<api::bluetooth_low_energy::Characteristic>>
CharacteristicList;
Status GetCharacteristics(const Extension* extension,
const std::string& instance_id,
@ -159,16 +158,16 @@ class BluetoothLowEnergyEventRouter
Status GetCharacteristic(
const Extension* extension,
const std::string& instance_id,
core_api::bluetooth_low_energy::Characteristic* out_characteristic) const;
api::bluetooth_low_energy::Characteristic* out_characteristic) const;
// Returns the list of core_api::bluetooth_low_energy::Descriptor objects
// Returns the list of api::bluetooth_low_energy::Descriptor objects
// associated with the GATT characteristic with instance ID |instance_id| in
// |out_descriptors|. If the characteristic is found but it has no
// descriptors, then returns true and leaves |out_descriptors| empty.
// |out_descriptors| must not be NULL and if it is non-empty,
// then its contents will be cleared. |extension| is the extension that made
// the call.
typedef std::vector<linked_ptr<core_api::bluetooth_low_energy::Descriptor> >
typedef std::vector<linked_ptr<api::bluetooth_low_energy::Descriptor>>
DescriptorList;
Status GetDescriptors(const Extension* extension,
const std::string& instance_id,
@ -180,7 +179,7 @@ class BluetoothLowEnergyEventRouter
Status GetDescriptor(
const Extension* extension,
const std::string& instance_id,
core_api::bluetooth_low_energy::Descriptor* out_descriptor) const;
api::bluetooth_low_energy::Descriptor* out_descriptor) const;
// Sends a request to read the value of the characteristic with intance ID
// |instance_id|. Invokes |callback| on success and |error_callback| on

@ -5,7 +5,7 @@
#include "extensions/browser/api/bluetooth_low_energy/utils.h"
namespace extensions {
namespace core_api {
namespace api {
namespace bluetooth_low_energy {
namespace {
@ -52,5 +52,5 @@ scoped_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from) {
}
} // namespace bluetooth_low_energy
} // namespace core_api
} // namespace api
} // namespace extensions

@ -10,7 +10,7 @@
#include "extensions/common/api/bluetooth_low_energy.h"
namespace extensions {
namespace core_api {
namespace api {
namespace bluetooth_low_energy {
// TODO(armansito): Remove these functions once the described bug is fixed.
@ -28,7 +28,7 @@ scoped_ptr<base::DictionaryValue> CharacteristicToValue(Characteristic* from);
scoped_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from);
} // namespace bluetooth_low_energy
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_UTILS_H_

@ -20,12 +20,12 @@
using content::BrowserThread;
using extensions::BluetoothApiSocket;
using extensions::core_api::bluetooth_socket::ListenOptions;
using extensions::core_api::bluetooth_socket::SocketInfo;
using extensions::core_api::bluetooth_socket::SocketProperties;
using extensions::api::bluetooth_socket::ListenOptions;
using extensions::api::bluetooth_socket::SocketInfo;
using extensions::api::bluetooth_socket::SocketProperties;
namespace extensions {
namespace core_api {
namespace api {
namespace {
@ -674,5 +674,5 @@ void BluetoothSocketGetSocketsFunction::Work() {
results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos);
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -28,7 +28,7 @@ class IOBuffer;
namespace extensions {
namespace core_api {
namespace api {
class BluetoothSocketEventDispatcher;
@ -346,7 +346,7 @@ class BluetoothSocketGetSocketsFunction
void Work() override;
};
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_

@ -30,7 +30,7 @@ using device::MockBluetoothSocket;
using extensions::Extension;
using extensions::ResultCatcher;
namespace api = extensions::core_api;
namespace api = extensions::api;
namespace {

@ -14,7 +14,7 @@
namespace {
namespace bluetooth_socket = extensions::core_api::bluetooth_socket;
namespace bluetooth_socket = extensions::api::bluetooth_socket;
using extensions::BluetoothApiSocket;
int kDefaultBufferSize = 4096;
@ -54,7 +54,7 @@ bluetooth_socket::AcceptError MapAcceptErrorReason(
} // namespace
namespace extensions {
namespace core_api {
namespace api {
using content::BrowserThread;
@ -371,5 +371,5 @@ void BluetoothSocketEventDispatcher::DispatchEvent(
router->DispatchEventToExtension(extension_id, event.Pass());
}
} // namespace core_api
} // namespace api
} // namespace extensions

@ -24,7 +24,7 @@ class BluetoothApiSocket;
}
namespace extensions {
namespace core_api {
namespace api {
// Dispatch events related to "bluetooth" sockets from callback on native socket
// instances. There is one instance per browser context.
@ -113,7 +113,7 @@ class BluetoothSocketEventDispatcher
scoped_refptr<SocketData> sockets_;
};
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_

@ -23,7 +23,7 @@ using content::WebContents;
namespace extensions {
using core_api::extension_types::ImageDetails;
using api::extension_types::ImageDetails;
bool CaptureWebContentsFunction::HasPermission() {
return true;
@ -50,16 +50,15 @@ bool CaptureWebContentsFunction::RunAsync() {
return false;
// The default format and quality setting used when encoding jpegs.
const core_api::extension_types::ImageFormat kDefaultFormat =
core_api::extension_types::IMAGE_FORMAT_JPEG;
const api::extension_types::ImageFormat kDefaultFormat =
api::extension_types::IMAGE_FORMAT_JPEG;
const int kDefaultQuality = 90;
image_format_ = kDefaultFormat;
image_quality_ = kDefaultQuality;
if (image_details) {
if (image_details->format !=
core_api::extension_types::IMAGE_FORMAT_NONE)
if (image_details->format != api::extension_types::IMAGE_FORMAT_NONE)
image_format_ = image_details->format;
if (image_details->quality.get())
image_quality_ = *image_details->quality;
@ -110,7 +109,7 @@ void CaptureWebContentsFunction::OnCaptureSuccess(const SkBitmap& bitmap) {
bool encoded = false;
std::string mime_type;
switch (image_format_) {
case core_api::extension_types::IMAGE_FORMAT_JPEG:
case api::extension_types::IMAGE_FORMAT_JPEG:
encoded = gfx::JPEGCodec::Encode(
reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
gfx::JPEGCodec::FORMAT_SkBitmap,
@ -121,7 +120,7 @@ void CaptureWebContentsFunction::OnCaptureSuccess(const SkBitmap& bitmap) {
&data);
mime_type = kMimeTypeJpeg;
break;
case core_api::extension_types::IMAGE_FORMAT_PNG:
case api::extension_types::IMAGE_FORMAT_PNG:
encoded =
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap,
true, // Discard transparency.

@ -53,7 +53,7 @@ class CaptureWebContentsFunction : public AsyncExtensionFunction {
int context_id_;
// The format (JPEG vs PNG) of the resulting image. Set in RunAsync().
core_api::extension_types::ImageFormat image_format_;
api::extension_types::ImageFormat image_format_;
// Quality setting to use when encoding jpegs. Set in RunAsync().
int image_quality_;

@ -13,7 +13,7 @@
#include "net/cert/x509_certificate.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
namespace {
@ -162,5 +162,5 @@ base::StringPiece GetDefaultTrustedICAPublicKey() {
}
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -15,7 +15,7 @@
#include "net/base/hash_value.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
typedef std::map<net::SHA256HashValue,
@ -77,7 +77,7 @@ base::StringPiece GetTrustedICAPublicKey(const base::StringPiece& data);
base::StringPiece GetDefaultTrustedICAPublicKey();
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_ICA_H_

@ -11,7 +11,7 @@
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
@ -146,6 +146,6 @@ TEST_F(CastChannelAuthorityKeysTest, TestSetTrustedCertificateAuthorities) {
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -14,7 +14,7 @@
#include "extensions/common/cast/cast_cert_validator.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
namespace {
@ -23,7 +23,7 @@ const char* const kParseErrorPrefix = "Failed to parse auth message: ";
const unsigned char kAudioOnlyPolicy[] =
{0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xD6, 0x79, 0x02, 0x05, 0x02};
namespace cast_crypto = ::extensions::core_api::cast_crypto;
namespace cast_crypto = ::extensions::api::cast_crypto;
// Extracts an embedded DeviceAuthMessage payload from an auth challenge reply
// message.
@ -174,5 +174,5 @@ AuthResult VerifyCredentials(const AuthResponse& response,
}
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -8,7 +8,7 @@
#include <string>
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
class AuthResponse;
@ -71,7 +71,7 @@ AuthResult VerifyCredentials(const AuthResponse& response,
const std::string& peer_cert);
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_

@ -12,7 +12,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
namespace {
@ -412,5 +412,5 @@ TEST_F(CastAuthUtilTest, VerifyBadPeerCert) {
} // namespace
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -320,14 +320,14 @@ void CastChannelOpenFunction::AsyncWorkStart() {
api_->GetLogger()->LogNewSocketEvent(*socket);
// Construct read delegates.
scoped_ptr<core_api::cast_channel::CastTransport::Delegate> delegate(
scoped_ptr<api::cast_channel::CastTransport::Delegate> delegate(
make_scoped_ptr(new CastMessageHandler(
base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr()), socket,
api_->GetLogger())));
if (socket->keep_alive()) {
// Wrap read delegate in a KeepAliveDelegate for timeout handling.
core_api::cast_channel::KeepAliveDelegate* keep_alive =
new core_api::cast_channel::KeepAliveDelegate(
api::cast_channel::KeepAliveDelegate* keep_alive =
new api::cast_channel::KeepAliveDelegate(
socket, api_->GetLogger(), delegate.Pass(), ping_interval_,
liveness_timeout_);
scoped_ptr<base::Timer> injected_timer =

@ -31,13 +31,13 @@ namespace extensions {
struct Event;
namespace core_api {
namespace api {
namespace cast_channel {
class Logger;
} // namespace cast_channel
} // namespace core_api
} // namespace api
namespace cast_channel = core_api::cast_channel;
namespace cast_channel = api::cast_channel;
class CastChannelAPI : public BrowserContextKeyedAPI,
public base::SupportsWeakPtr<CastChannelAPI> {
@ -167,7 +167,7 @@ class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
public:
CastMessageHandler(const EventDispatchCallback& ui_dispatch_cb,
cast_channel::CastSocket* socket,
scoped_refptr<core_api::cast_channel::Logger> logger);
scoped_refptr<api::cast_channel::Logger> logger);
~CastMessageHandler() override;
// CastTransport::Delegate implementation.
@ -182,7 +182,7 @@ class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
EventDispatchCallback const ui_dispatch_cb_;
cast_channel::CastSocket* const socket_;
// Logger object for reporting error details.
scoped_refptr<core_api::cast_channel::Logger> logger_;
scoped_refptr<api::cast_channel::Logger> logger_;
DISALLOW_COPY_AND_ASSIGN(CastMessageHandler);
};

@ -9,7 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
// Tests parsing of ConnectInfo.
@ -29,5 +29,5 @@ TEST(CastChannelOpenFunctionTest, TestParseConnectInfo) {
}
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -30,7 +30,7 @@
// TODO(mfoltz): Mock out the ApiResourceManager to resolve threading issues
// (crbug.com/398242) and simulate unloading of the extension.
namespace cast_channel = extensions::core_api::cast_channel;
namespace cast_channel = extensions::api::cast_channel;
using cast_channel::CastMessage;
using cast_channel::CastSocket;
using cast_channel::CastTransport;

@ -12,7 +12,7 @@
#include "extensions/common/api/cast_channel/cast_channel.pb.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
MessageFramer::MessageFramer(scoped_refptr<net::GrowableIOBuffer> input_buffer)
: input_buffer_(input_buffer), error_(false) {
@ -175,5 +175,5 @@ void MessageFramer::Reset() {
}
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -12,7 +12,7 @@
#include "net/base/io_buffer.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
class CastMessage;
@ -94,6 +94,6 @@ class MessageFramer {
DISALLOW_COPY_AND_ASSIGN(MessageFramer);
};
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_

@ -11,7 +11,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
class CastFramerTest : public testing::Test {
public:
@ -134,5 +134,5 @@ TEST_F(CastFramerTest, TestUnparsableBodyProto) {
EXPECT_EQ(cast_channel::CHANNEL_ERROR_INVALID_MESSAGE, error);
}
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

@ -20,7 +20,7 @@ static const char kPlatformReceiverId[] = "receiver-0";
} // namespace
namespace extensions {
namespace core_api {
namespace api {
namespace cast_channel {
bool MessageInfoToCastMessage(const MessageInfo& message,
@ -157,5 +157,5 @@ bool IsAuthMessage(const CastMessage& message) {
}
} // namespace cast_channel
} // namespace core_api
} // namespace api
} // namespace extensions

Some files were not shown because too many files have changed in this diff Show More