Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/browser/extensions/api/README.txt

Issue 10391034: Scaffolding for an experimental discovery API letting users inject links in the recommended pane of… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Answered review comments from PatchSet 4. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app/app_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 This file describes steps and files needed when adding a new API to Chrome.
2 Before you start coding your new API, though, make sure you follow the process
3 described at:
4 http://www.chromium.org/developers/design-documents/extensions/proposed-change s/apis-under-development
5
6 Two approaches are available for writing your API specification. The original
7 approach relies on JSON specification files. The more recent and simpler system
8 uses Web IDL files, but does not yet support all the features of the JSON files.
9 Discuss with a member of the extensions team (aa@chromium.org) before you decide
10 which approach is better suited to your API.
11
12 The following steps suppose you're writing an experimental API called "Foo".
13
14 --------------------------------------------------------------------------------
15 APPROACH 1: JSON FILES
16
17 1) Write your API specification.
18 Create "chrome/common/extensions/api/experimental_foo.json". For inspiration
19 look at the "app" API. Include descriptions fields to generate the
20 documentation.
21
22 2) Add your API specification to the project.
23 Add an "<include ...>" line with your JSON specification file to
24 "chrome/common/extensions_api_resources.grd".
25
26 3) Write the API function handlers.
27 Create foo_api.cc and foo_api.h under "chrome/browser/extensions/api/foo". You
28 should use the JSON Schema Compiler. Look at the "alarms_api.cc" for details on
29 how to do that.
30
31 4) Register function handlers.
32 In "chrome/browser/extensions/extension_function_registry.cc" include foo_api.h
33 and instantiate a RegisterFunction for each function you created in (3).
34
35 --------------------------------------------------------------------------------
36 APPROACH 2: IDL FILES
37
38 1) Write your API specification.
39 Create "chrome/common/extensions/api/experimental_foo.idl". For inspiration look
40 at "alarms.idl". Include comments, they will be used to automatically generate
41 the documentation.
42
43 2) Add your API specification to the project.
44 Add "experimental_foo.idl" to the "idl_schema_files" section in
45 "chrome/common/extensions/api/api.gyp".
46
47 3) Write the API function handlers.
48 Create foo_api.cc and foo_api.h under "chrome/browser/extensions/api/foo". You
49 should use the JSON Schema Compiler. Look at the "alarms_api.cc" for details on
50 how to do that.
51
52 4) Nothing to do! Function handlers are automatically registered for you.
53
54 --------------------------------------------------------------------------------
55 STEPS COMMON TO BOTH APPROACHES
56
57 5) Write support classes for your API
58 If your API needs any support classes add them to
59 "chrome/browser/extensions/api/foo". Some old APIs added their support classes
60 directly to chrome/browser/extensions. Don't do that.
61
62 6) Update the project with your new files.
63 The files you created in (3) and (5) should be added to
64 "chrome/chrome_browser_extensions.gypi".
65
66 --------------------------------------------------------------------------------
67 GENERATING DOCUMENTATION
68
69 7) Build the project. (Only required if you used IDL files.)
70 If you used IDL files, you need to build the project once in order for the
71 documentation to be properly generated. Do this now. (This is required in order
72 to generate the JSON file used to generate documentation.)
73
74 8) Add your JSON file to the documentation controller
75 Open "chrome/common/extensions/docs/js/api_page_generator.js" and add a line
76 referring to "../api/experimental_foo.json". Do this even if you used the IDL
77 approach as this JSON file has been generated in (7).
78
79 9) Write the static HTML page.
80 Write a small snippet of static HTML describing your API in
81 "chrome/common/extensions/docs/static/experimental.foo.html". For the moment,
82 just include the following in this file, adjusting it to describe your API:
83
84 <div id="pageData-name" class="pageData">Experimental Foo APIs</div>
85
86 <!-- BEGIN AUTHORED CONTENT -->
87 <p>The current methods allow applications to...</p>
88 <!-- END AUTHORED CONTENT -->
89
90 10) Build the documentation.
91 You will need to build DumpRenderTree once before you can build the
92 documentation. Once this is done, from "chrome/common/extensions/docs" run
93 "build/build.py". For more information on building documentation see README.txt
94 in "chrome/common/extensions/docs".
95
96 --------------------------------------------------------------------------------
97 WRITING TESTS
98
99 TODO(beaudoin)
100
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app/app_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698