|
Implement an initial extension settings API.
Some general notes:
- It's a lot of code for a single review, about 1.5K lines (plus tests, plus those generated docs, = 3.5K). Apologies. But it's close to the minimal amount of useful functionality. I've left some TODOs in the code to fix up soon.
- No integration-style tests, but I'll start writing those now. Works from within a browser though.
- Sync not hooked up yet, of course.
- Ditto events.
- Ditto thinking about incognito mode.
- Ditto fun bugs like what happens if you set key "foo.bar" to "baz".
- This is the first significant amount of C++ code I've ever written... so don't hold back.
- The docs (i.e. my changes to extension_api.json) are a little incomplete, and I'm aware of that.
A summary of the implementation:
- There is an ExtensionSettings factory-type object which hands out ExtensionSettingsStorage areas for extensions. You may notice that I basically did the same thing that ExtensionPreferences does (so, lives with the profile, etc).
- ExtensionSettingsStorage is a pure interface, with three implementations.
- the main leveldb implementation.
- a caching decorator, designed to sit on top of the leveldb implementation.
- a "no-op" implementation which gives a trivial in-memory storage area when wrapped with a cache. This is used in the cases where the leveldb database fails to initialise (ExtensionSettings handles this).
- and note that my plan is, when hooking up sync, that this will be implemented as another decorator.
- ... the code is pretty well documented so not much else to say.
For testing, turns out gtest is pretty snazzy. There are a bunch of test fixtrues in extension_settings_storage_unittest.h, so that 3 different configurations are tested: leveldb, leveldb + cache, and no-op + cache.
BUG= 47327
TEST=unit tests provided
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96159
Total comments: 26
Total comments: 45
Total comments: 19
Total comments: 26
Total comments: 19
Total comments: 3
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+3677 lines, -1 line) |
Patch |
|
M |
chrome/browser/extensions/extension_function_dispatcher.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
2 chunks |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/extensions/extension_service.h
|
View
|
1
2
3
4
5
6
7
8
9
|
5 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/extensions/extension_service.cc
|
View
|
1
2
3
4
5
6
7
8
9
|
3 chunks |
+7 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+98 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+162 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_api.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+78 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_api.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+107 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_apitest.cc
|
View
|
1
2
3
4
|
1 chunk |
+17 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_cached_leveldb_storage_unittest.cc
|
View
|
1
2
3
4
5
|
1 chunk |
+25 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_cached_noop_storage_unittest.cc
|
View
|
1
2
3
4
5
|
1 chunk |
+25 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_leveldb_storage.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+59 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_leveldb_storage.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+505 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_leveldb_storage_unittest.cc
|
View
|
1
2
3
4
5
|
1 chunk |
+25 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_noop_storage.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+34 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_noop_storage.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+72 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_storage.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+83 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_storage_cache.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+54 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_storage_cache.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+265 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_storage_unittest.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+65 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/browser/extensions/extension_settings_storage_unittest.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+289 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/profiles/profile_impl.h
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/profiles/profile_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
3 chunks |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/ui/cocoa/extensions/extension_popup_controller_unittest.mm
|
View
|
1
2
3
4
5
6
7
8
9
|
5 chunks |
+9 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/chrome.gyp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
chrome/chrome_browser.gypi
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
2 chunks |
+12 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/chrome_tests.gypi
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
3 chunks |
+8 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/common/extensions/api/extension_api.json
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+102 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/common/extensions/docs/experimental.html
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
A |
chrome/common/extensions/docs/experimental.settings.html
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+1322 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/common/extensions/docs/samples.json
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/renderer/resources/renderer_extension_bindings.js
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
chrome/test/base/testing_profile.h
|
View
|
1
2
3
4
5
6
7
8
9
|
3 chunks |
+5 lines, -1 line |
0 comments
|
Download
|
|
M |
chrome/test/base/testing_profile.cc
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/test/data/extensions/api_test/settings/manifest.json
|
View
|
1
2
3
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
A |
chrome/test/data/extensions/api_test/settings/test.html
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+206 lines, -0 lines |
0 comments
|
Download
|
Total messages: 23 (0 generated)
|