summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-12 18:17:44 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-12 18:17:44 +0000
commitc9fa3e6cd7b52c74697906f1da3afc287e588ecb (patch)
tree5e5350db5b2e10bfc0a48196c7ecc578cbf12cfe
parent28e282c556c3fa106012c089badb6af7eb42be2c (diff)
downloadchromium_src-c9fa3e6cd7b52c74697906f1da3afc287e588ecb.zip
chromium_src-c9fa3e6cd7b52c74697906f1da3afc287e588ecb.tar.gz
chromium_src-c9fa3e6cd7b52c74697906f1da3afc287e588ecb.tar.bz2
Chromium side changes to add the ledger API.
R=isherman@chromium.org, kalman@chromium.org BUG=346488 Review URL: https://codereview.chromium.org/232183002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269820 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/json_schema_compile.gypi8
-rw-r--r--chrome/chrome_browser_extensions.gypi5
-rw-r--r--chrome/common/chrome_switches.cc6
-rw-r--r--chrome/common/chrome_switches.h2
-rw-r--r--chrome/common/extensions/api/_api_features.json5
-rw-r--r--chrome/common/extensions/api/_permission_features.json4
-rw-r--r--chrome/common/extensions/api/api.gyp5
-rw-r--r--chrome/common/extensions/permissions/chrome_api_permissions.cc1
-rw-r--r--chrome/common/extensions/permissions/permission_set_unittest.cc1
-rw-r--r--extensions/browser/extension_function_histogram_value.h1
-rw-r--r--extensions/common/permissions/api_permission.h1
-rwxr-xr-xtools/json_schema_compiler/compiler.py25
-rw-r--r--tools/metrics/histograms/histograms.xml1
13 files changed, 54 insertions, 11 deletions
diff --git a/build/json_schema_compile.gypi b/build/json_schema_compile.gypi
index c446603..1ab8b7b 100644
--- a/build/json_schema_compile.gypi
+++ b/build/json_schema_compile.gypi
@@ -39,8 +39,8 @@
# '<@(schema_files)',
],
'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).cc',
- '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).h',
+ '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc',
+ '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).h',
],
'action': [
'python',
@@ -78,8 +78,8 @@
# '<@(schema_files)',
],
'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).cc',
- '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).h',
+ '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc',
+ '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).h',
],
'action': [
'python',
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 1ebbefc..1c2388f 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -979,6 +979,11 @@
'browser/extensions/api/tabs/ash_panel_contents.h',
],
}],
+ ['branding=="Chrome" and chromeos==1', {
+ 'dependencies': [
+ 'browser/extensions/api/ledger/ledger.gyp:ledger_api',
+ ],
+ }],
['enable_extensions==0', {
'sources!': [
'browser/extensions/browser_context_keyed_service_factories.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 5a09394..8395a22 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -839,6 +839,12 @@ const char kKioskMode[] = "kiosk";
// See http://crbug.com/31395.
const char kKioskModePrinting[] = "kiosk-printing";
+// Use this server address ledger.
+const char kLedgerServer[] = "ledger-server";
+
+// Use this tracing token for ledger.
+const char kLedgerTracingToken[] = "ledger-tracing-token";
+
// Causes Chrome to attempt to get metadata from the webstore for the
// given item, and then prompt the user to download and install it.
const char kLimitedInstallFromWebstore[] = "limited-install-from-webstore";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 6d0ed50..7c7d8c4 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -235,6 +235,8 @@ extern const char kIpcFuzzerTestcase[];
extern const char kKeepAliveForTest[];
extern const char kKioskMode[];
extern const char kKioskModePrinting[];
+extern const char kLedgerServer[];
+extern const char kLedgerTracingToken[];
extern const char kLimitedInstallFromWebstore[];
extern const char kLoadComponentExtension[];
extern const char kLoadExtension[];
diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json
index 654eac7..a289d27 100644
--- a/chrome/common/extensions/api/_api_features.json
+++ b/chrome/common/extensions/api/_api_features.json
@@ -482,6 +482,11 @@
"dependencies": ["permission:inputMethodPrivate"],
"contexts": ["blessed_extension"]
},
+ "ledger": {
+ "platforms": ["chromeos"],
+ "dependencies": ["permission:ledger"],
+ "contexts": ["blessed_extension"]
+ },
"location": {
"dependencies": ["permission:location"],
"contexts": ["blessed_extension"]
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json
index f68a05b..c298363 100644
--- a/chrome/common/extensions/api/_permission_features.json
+++ b/chrome/common/extensions/api/_permission_features.json
@@ -502,6 +502,10 @@
"extension_types": ["extension", "legacy_packaged_app", "platform_app"],
"location": "component"
}],
+ "ledger": {
+ "channel": "trunk",
+ "extension_types": ["extension", "platform_app"]
+ },
"location": [
{
"channel": "dev",
diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp
index d3f4b8b..275ba74 100644
--- a/chrome/common/extensions/api/api.gyp
+++ b/chrome/common/extensions/api/api.gyp
@@ -174,6 +174,11 @@
'cast_streaming_udp_transport.idl',
],
}],
+ ['branding=="Chrome" and chromeos==1', {
+ 'schema_files': [
+ 'ledger/ledger.idl',
+ ],
+ }],
],
'cc_dir': 'chrome/common/extensions/api',
'root_namespace': 'extensions::api',
diff --git a/chrome/common/extensions/permissions/chrome_api_permissions.cc b/chrome/common/extensions/permissions/chrome_api_permissions.cc
index 6fc12f1..f9b9e06 100644
--- a/chrome/common/extensions/permissions/chrome_api_permissions.cc
+++ b/chrome/common/extensions/permissions/chrome_api_permissions.cc
@@ -112,6 +112,7 @@ std::vector<APIPermissionInfo*> ChromeAPIPermissions::GetAllPermissions()
{APIPermission::kInfobars, "infobars"},
{APIPermission::kInput, "input", APIPermissionInfo::kFlagNone,
IDS_EXTENSION_PROMPT_WARNING_INPUT, PermissionMessage::kInput},
+ {APIPermission::kLedger, "ledger"},
{APIPermission::kLocation, "location",
APIPermissionInfo::kFlagCannotBeOptional,
IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION,
diff --git a/chrome/common/extensions/permissions/permission_set_unittest.cc b/chrome/common/extensions/permissions/permission_set_unittest.cc
index 06df0f9..30d7e82 100644
--- a/chrome/common/extensions/permissions/permission_set_unittest.cc
+++ b/chrome/common/extensions/permissions/permission_set_unittest.cc
@@ -655,6 +655,7 @@ TEST(PermissionsTest, PermissionMessages) {
skip.insert(APIPermission::kGcm);
skip.insert(APIPermission::kIdle);
skip.insert(APIPermission::kIdltest);
+ skip.insert(APIPermission::kLedger);
skip.insert(APIPermission::kLogPrivate);
skip.insert(APIPermission::kNotification);
skip.insert(APIPermission::kOverrideEscFullscreen);
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 3403afb..bef59ed 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -820,6 +820,7 @@ enum HistogramValue {
HOTWORDPRIVATE_NOTIFYHOTWORDRECOGNITION,
FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDSUCCESS,
FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR,
+ LEDGER_BATCHEXECUTE,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms/histograms.xml.
ENUM_BOUNDARY
diff --git a/extensions/common/permissions/api_permission.h b/extensions/common/permissions/api_permission.h
index 15e44ec..1563f59 100644
--- a/extensions/common/permissions/api_permission.h
+++ b/extensions/common/permissions/api_permission.h
@@ -105,6 +105,7 @@ class APIPermission {
kInfobars,
kInput,
kInputMethodPrivate,
+ kLedger,
kLocation,
kLogPrivate,
kManagement,
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
index 1773d4b..98f44d7 100755
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -40,13 +40,13 @@ def GenerateSchema(generator,
root_namespace,
dart_overrides_dir,
impl_dir):
- schema_loader = SchemaLoader(
- os.path.dirname(os.path.relpath(os.path.normpath(filenames[0]), root)),
- os.path.dirname(filenames[0]))
# Merge the source files into a single list of schemas.
api_defs = []
for filename in filenames:
schema = os.path.normpath(filename)
+ schema_loader = SchemaLoader(
+ os.path.dirname(os.path.relpath(os.path.normpath(filename), root)),
+ os.path.dirname(filename))
api_def = schema_loader.LoadSchema(os.path.split(schema)[1])
# If compiling the C++ model code, delete 'nocompile' nodes.
@@ -60,15 +60,25 @@ def GenerateSchema(generator,
# is the default one.
default_namespace = None
+ # If we have files from multiple source paths, we'll use the common parent
+ # path as the source directory.
+ src_path = None
+
# Load the actual namespaces into the model.
for target_namespace, schema_filename in zip(api_defs, filenames):
relpath = os.path.relpath(os.path.normpath(schema_filename), root)
namespace = api_model.AddNamespace(target_namespace,
relpath,
include_compiler_options=True)
+
if default_namespace is None:
default_namespace = namespace
+ if src_path is None:
+ src_path = namespace.source_file_dir
+ else:
+ src_path = os.path.commonprefix((src_path, namespace.source_file_dir))
+
path, filename = os.path.split(schema_filename)
short_filename, extension = os.path.splitext(filename)
@@ -76,14 +86,13 @@ def GenerateSchema(generator,
type_generator = CppTypeGenerator(api_model,
schema_loader,
default_namespace=default_namespace)
-
if generator == 'cpp-bundle':
cpp_bundle_generator = CppBundleGenerator(root,
api_model,
api_defs,
type_generator,
root_namespace,
- namespace.source_file_dir,
+ src_path,
impl_dir)
generators = [
('generated_api.cc', cpp_bundle_generator.api_cc_generator),
@@ -115,8 +124,10 @@ def GenerateSchema(generator,
for filename, generator in generators:
code = generator.Generate(namespace).Render()
if destdir:
- with open(os.path.join(destdir, namespace.source_file_dir,
- filename), 'w') as f:
+ output_dir = os.path.join(destdir, src_path)
+ if not os.path.exists(output_dir):
+ os.makedirs(output_dir)
+ with open(os.path.join(output_dir, filename), 'w') as f:
f.write(code)
output_code += [filename, '', code, '']
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index be64f93..7747c7c 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -34191,6 +34191,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
label="FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDSUCCESS"/>
<int value="761"
label="FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR"/>
+ <int value="762" label="LEDGER_BATCHEXECUTE"/>
</enum>
<enum name="ExtensionInstallCause" type="int">