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

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 3. 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
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
Aaron Boodman 2012/05/17 00:05:29 80 cols
beaudoin 2012/05/17 19:11:16 Done.
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". Look
28 at the "app" API for the parsing mechanism.
Aaron Boodman 2012/05/17 00:05:29 Should use JSON schema compiler this way too.
beaudoin 2012/05/17 19:11:16 Ah! This is what you wanted me to do. :) Looking a
29
30 4) Register function handlers.
31 In "chrome/browser/extensions/extension_function_registry.cc" include foo_api.h
32 and instantiate a RegisterFunction for each function you created in (3).
33
34 --------------------------------------------------------------------------------
35 APPROACH 2: IDL FILES
36
37 1) Write your API specification.
38 Create "chrome/common/extensions/api/experimental_foo.idl". For inspiration look
39 at "alarms.idl". Include comments, they will be used to automatically generate
40 the documentation.
41
42 2) Add your API specification to the project.
43 Add "experimental_foo.idl" to the "idl_schema_files" section in
44 "chrome/common/extensions/api/api.gyp".
45
46 3) Write the API function handlers.
47 Create foo_api.cc and foo_api.h under "chrome/browser/extensions/api/foo". You
48 should use the JSON Schema Compiler. Look at the "alarms" API for details on how
49 to do that.
50
51 4) Nothing to do! Function handlers are automatically registered for you.
52
53 --------------------------------------------------------------------------------
54 STEPS COMMON TO BOTH APPROACHES
55
56 5) Write support classes for your API
57 If your API needs any support classes add them to
58 "chrome/browser/extensions/api/foo". Some old APIs added their support classes
59 directly to chrome/browser/extensions. Don't do that.
60
61 6) Update the project with your new files.
62 The files you created in (3) and (5) should be added to
63 "chrome/chrome_browser_extensions.gypi".
64
65 --------------------------------------------------------------------------------
66 GENERATING DOCUMENTATION
67
68 7) Build the project. (Only required if you used IDL files.)
69 If you used IDL files, you need to build the project once in order for the
70 documentation to be properly generated. Do this now.
Aaron Boodman 2012/05/17 00:05:29 Really? What happens if you don't?
beaudoin 2012/05/17 19:11:16 The documentation is generated from the JSON file
71
72 8) Add your JSON file to the documentation controller
73 Open "chrome/common/extensions/docs/js/api_page_generator.js" and add a line
74 referring to "../api/experimental_foo.json". Do this even if you used the IDL
75 approach as this JSON file has been generated in (7).
76
77 9) Write the static HTML page.
78 Write a small snippet of static HTML describing your API in
79 "chrome/common/extensions/docs/static/experimental.foo.html". For the moment,
80 just include the following in this file, adjusting it to describe your API:
81
82 <div id="pageData-name" class="pageData">Experimental Foo APIs</div>
83
84 <!-- BEGIN AUTHORED CONTENT -->
85 <p>The current methods allow applications to...</p>
86 <!-- END AUTHORED CONTENT -->
87
88 10) Build the documentation.
89 You will need to build DumpRenderTree once before you can build the
90 documentation. Once this is done, from "chrome/common/extensions/docs" run
91 "build/build.py". For more information on building documentation see README.txt
92 in "chrome/common/extensions/docs".
93
94 --------------------------------------------------------------------------------
95 WRITING TESTS
96
97 TODO(beaudoin)
98
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app/app_api.cc » ('j') | chrome/browser/extensions/api/discovery/suggested_link.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698