Home | History | Annotate | Download | only in docs
      1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note:
      2     1) The <head> information in this page is significant, should be uniform
      3        across api docs and should be edited only with knowledge of the
      4        templating mechanism.
      5     3) All <body>.innerHTML is genereated as an rendering step. If viewed in a
      6        browser, it will be re-generated from the template, json schema and
      7        authored overview content.
      8     4) The <body>.innerHTML is also generated by an offline step so that this
      9        page may easily be indexed by search engines.
     10 --><html xmlns="http://www.w3.org/1999/xhtml"><head>
     11     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     12     <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
     13     <link href="css/print.css" rel="stylesheet" type="text/css" media="print">
     14     <script type="text/javascript" src="../../../third_party/jstemplate/jstemplate_compiled.js">
     15     </script>
     16     <script type="text/javascript" src="js/api_page_generator.js"></script>
     17     <script type="text/javascript" src="js/bootstrap.js"></script>
     18     <script type="text/javascript" src="js/sidebar.js"></script>
     19   <title>Packaging - Google Chrome Extensions - Google Code</title></head>
     20   <body>  <div id="gc-container" class="labs">
     21       <div id="devModeWarning">
     22         You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
     23       </div>
     24       <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
     25       <!-- In particular, sub-templates that recurse, must be used by allowing
     26            jstemplate to make a copy of the template in this section which
     27            are not operated on by way of the jsskip="true" -->
     28       <div style="display:none">
     29 
     30         <!-- VALUE -->
     31         <div id="valueTemplate">
     32           <dt>
     33             <var>paramName</var>
     34               <em>
     35 
     36                 <!-- TYPE -->
     37                 <div style="display:inline">
     38                   (
     39                     <span class="optional">optional</span>
     40                     <span class="enum">enumerated</span>
     41                     <span id="typeTemplate">
     42                       <span>
     43                         <a> Type</a>
     44                       </span>
     45                       <span>
     46                         <span>
     47                           array of <span><span></span></span>
     48                         </span>
     49                         <span>paramType</span>
     50                         <span></span>
     51                       </span>
     52                     </span>
     53                   )
     54                 </div>
     55 
     56               </em>
     57           </dt>
     58           <dd class="todo">
     59             Undocumented.
     60           </dd>
     61           <dd>
     62             Description of this parameter from the json schema.
     63           </dd>
     64           <dd>
     65             This parameter was added in version
     66             <b><span></span></b>.
     67             You must omit this parameter in earlier versions,
     68             and you may omit it in any version.  If you require this
     69             parameter, the manifest key
     70             <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
     71             can ensure that your extension won't be run in an earlier browser version.
     72           </dd>
     73 
     74           <!-- OBJECT PROPERTIES -->
     75           <dd>
     76             <dl>
     77               <div>
     78                 <div>
     79                 </div>
     80               </div>
     81             </dl>
     82           </dd>
     83 
     84           <!-- OBJECT METHODS -->
     85           <dd>
     86             <div></div>
     87           </dd>
     88 
     89           <!-- OBJECT EVENT FIELDS -->
     90           <dd>
     91             <div></div>
     92           </dd>
     93 
     94           <!-- FUNCTION PARAMETERS -->
     95           <dd>
     96             <div></div>
     97           </dd>
     98 
     99         </div> <!-- /VALUE -->
    100 
    101         <div id="functionParametersTemplate">
    102           <h5>Parameters</h5>
    103           <dl>
    104             <div>
    105               <div>
    106               </div>
    107             </div>
    108           </dl>
    109         </div>
    110       </div> <!-- /SUBTEMPLATES -->
    111 
    112   <a id="top"></a>
    113     <div id="skipto">
    114       <a href="#gc-pagecontent">Skip to page content</a>
    115       <a href="#gc-toc">Skip to main navigation</a>
    116     </div>
    117     <!-- API HEADER -->
    118     <table id="header" width="100%" cellspacing="0" border="0">
    119       <tbody><tr>
    120         <td valign="middle"><a href="http://code.google.com/"><img src="images/code_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:0; margin:0;"></a></td>
    121         <td valign="middle" width="100%" style="padding-left:0.6em;">
    122           <form action="http://www.google.com/cse" id="cse" style="margin-top:0.5em">
    123             <div id="gsc-search-box">
    124               <input type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno">
    125               <input type="hidden" name="ie" value="UTF-8">
    126               <input type="text" name="q" value="" size="55">
    127               <input class="gsc-search-button" type="submit" name="sa" value="Search">
    128               <br>
    129               <span class="greytext">e.g. "page action" or "tabs"</span>
    130             </div>
    131           </form>
    132 
    133           <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    134           <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
    135           <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse&t13n_langs=en"></script>
    136           <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse&lang=en"></script>
    137         </td>
    138       </tr>
    139     </tbody></table>
    140 
    141     <div id="codesiteContent" class="">
    142 
    143       <a id="gc-topnav-anchor"></a>
    144       <div id="gc-topnav">
    145         <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Labs</a>)</h1>
    146         <ul id="home" class="gc-topnav-tabs">
    147           <li id="home_link">
    148             <a href="index.html" title="Google Chrome Extensions home page">Home</a>
    149           </li>
    150           <li id="docs_link">
    151             <a href="docs.html" title="Official Google Chrome Extensions documentation">Docs</a>
    152           </li>
    153           <li id="faq_link">
    154             <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions">FAQ</a>
    155           </li>
    156           <li id="samples_link">
    157             <a href="samples.html" title="Sample extensions (with source code)">Samples</a>
    158           </li>
    159           <li id="group_link">
    160             <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum">Group</a>
    161           </li>
    162         </ul>
    163       </div> <!-- end gc-topnav -->
    164 
    165     <div class="g-section g-tpl-170">
    166       <!-- SIDENAV -->
    167       <div class="g-unit g-first" id="gc-toc">
    168         <ul>
    169           <li><a href="getstarted.html">Getting Started</a></li>
    170           <li><a href="overview.html">Overview</a></li>
    171           <li><a href="whats_new.html">What's New?</a></li>
    172           <li><h2><a href="devguide.html">Developer's Guide</a></h2>
    173             <ul>
    174               <li>Browser UI
    175                 <ul>
    176                   <li><a href="browserAction.html">Browser Actions</a></li>
    177                   <li><a href="contextMenus.html">Context Menus</a></li>
    178                   <li><a href="notifications.html">Desktop Notifications</a></li>
    179                   <li><a href="omnibox.html">Omnibox</a></li>
    180                   <li><a href="options.html">Options Pages</a></li>
    181                   <li><a href="override.html">Override Pages</a></li>
    182                   <li><a href="pageAction.html">Page Actions</a></li>
    183                 </ul>
    184               </li>
    185               <li>Browser Interaction
    186                 <ul>
    187                   <li><a href="bookmarks.html">Bookmarks</a></li>
    188                   <li><a href="cookies.html">Cookies</a></li>
    189                   <li><a href="events.html">Events</a></li>
    190                   <li><a href="history.html">History</a></li>
    191                   <li><a href="management.html">Management</a></li>
    192                   <li><a href="tabs.html">Tabs</a></li>
    193                   <li><a href="windows.html">Windows</a></li>
    194                 </ul>
    195               </li>
    196               <li>Implementation
    197                 <ul>
    198                   <li><a href="a11y.html">Accessibility</a></li>
    199                   <li><a href="background_pages.html">Background Pages</a></li>
    200                   <li><a href="content_scripts.html">Content Scripts</a></li>
    201                   <li><a href="xhr.html">Cross-Origin XHR</a></li>
    202                   <li><a href="idle.html">Idle</a></li>
    203                   <li><a href="i18n.html">Internationalization</a></li>
    204                   <li><a href="messaging.html">Message Passing</a></li>
    205                   <li><a href="npapi.html">NPAPI Plugins</a></li>
    206                 </ul>
    207               </li>
    208               <li>Finishing
    209                 <ul>
    210                   <li><a href="hosting.html">Hosting</a></li>
    211                   <li><a href="external_extensions.html">Other Deployment Options</a></li>
    212                 </ul>
    213               </li>
    214             </ul>
    215           </li>
    216           <li><h2><a href="apps.html">Packaged Apps</a></h2></li>
    217           <li><h2><a href="tutorials.html">Tutorials</a></h2>
    218             <ul>
    219               <li><a href="tut_debugging.html">Debugging</a></li>
    220               <li><a href="tut_analytics.html">Google Analytics</a></li>
    221               <li><a href="tut_oauth.html">OAuth</a></li>
    222             </ul>
    223           </li>
    224           <li><h2>Reference</h2>
    225             <ul>
    226               <li>Formats
    227                 <ul>
    228                   <li><a href="manifest.html">Manifest Files</a></li>
    229                   <li><a href="match_patterns.html">Match Patterns</a></li>
    230                 </ul>
    231               </li>
    232               <li><a href="permission_warnings.html">Permission Warnings</a></li>
    233               <li><a href="api_index.html">chrome.* APIs</a></li>
    234               <li><a href="api_other.html">Other APIs</a></li>
    235             </ul>
    236           </li>
    237           <li><h2><a href="samples.html">Samples</a></h2></li>
    238           <div class="line"> </div>
    239           <li><h2>More</h2>
    240             <ul>
    241               <li><a href="http://code.google.com/chrome/webstore/docs/index.html">Chrome Web Store</a></li>
    242               <li><a href="http://code.google.com/chrome/apps/docs/developers_guide.html">Hosted Apps</a></li>
    243               <li><a href="themes.html">Themes</a></li>
    244             </ul>
    245           </li>
    246         </ul>
    247       </div>
    248       <script>
    249         initToggles();
    250       </script>
    251 
    252     <div class="g-unit" id="gc-pagecontent">
    253       <div id="pageTitle">
    254         <h1 class="page_title">Packaging</h1>
    255       </div>
    256         <!-- TABLE OF CONTENTS -->
    257         <div id="toc">
    258           <h2>Contents</h2>
    259           <ol>
    260             <li>
    261               <a href="#H2-0">Creating a package</a>
    262               <ol>
    263                 <li style="display: none; ">
    264                   <a>h3Name</a>
    265                 </li>
    266               </ol>
    267             </li><li>
    268               <a href="#update">Updating a package</a>
    269               <ol>
    270                 <li style="display: none; ">
    271                   <a>h3Name</a>
    272                 </li>
    273               </ol>
    274             </li><li>
    275               <a href="#H2-2">Packaging at the command line</a>
    276               <ol>
    277                 <li style="display: none; ">
    278                   <a>h3Name</a>
    279                 </li>
    280               </ol>
    281             </li><li>
    282               <a href="#H2-3">Package format and scripts</a>
    283               <ol>
    284                 <li style="display: none; ">
    285                   <a>h3Name</a>
    286                 </li>
    287               </ol>
    288             </li>
    289               <li style="display: none; ">
    290                 <a href="#apiReference">API reference</a>
    291                 <ol>
    292                   <li>
    293                     <a href="#properties">Properties</a>
    294                     <ol>
    295                       <li>
    296                         <a href="#property-anchor">propertyName</a>
    297                       </li>
    298                     </ol>
    299                   </li>
    300                   <li>
    301                     <a>Methods</a>
    302                     <ol>
    303                       <li>
    304                         <a href="#method-anchor">methodName</a>
    305                       </li>
    306                     </ol>
    307                   </li>
    308                   <li>
    309                     <a>Events</a>
    310                     <ol>
    311                       <li>
    312                         <a href="#event-anchor">eventName</a>
    313                       </li>
    314                     </ol>
    315                   </li>
    316                   <li>
    317                     <a href="#types">Types</a>
    318                     <ol>
    319                       <li>
    320                         <a href="#id-anchor">id</a>
    321                       </li>
    322                     </ol>
    323                   </li>
    324                 </ol>
    325               </li>
    326           </ol>
    327         </div>
    328         <!-- /TABLE OF CONTENTS -->
    329 
    330         <!-- Standard content lead-in for experimental API pages -->
    331         <p id="classSummary" style="display: none; ">
    332           For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
    333         </p>
    334 
    335         <!-- STATIC CONTENT PLACEHOLDER -->
    336         <div id="static"><div id="pageData-name" class="pageData">Packaging</div>
    337 <div id="pageData-showTOC" class="pageData">true</div>
    338 
    339 <p>
    340 This page describes how to package your extension.
    341 As the <a href="overview.html">Overview</a> explains,
    342 extensions are packaged as signed ZIP files
    343 with the file extension "crx" 
    344 for example, <code>myextension.crx</code>.
    345 </p>
    346 
    347 <p>
    348 <b>Note:</b>
    349 You might not need to package your extension.
    350 If you publish your extension using the
    351 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a>,
    352 then the only reason to create your own <code>.crx</code> file
    353 would be to distribute a non-public version 
    354 for example, to alpha testers.
    355 </p>
    356 
    357 <!-- [PENDING: Refer to instructions on submitting an extension for inclusion in the gallery.] -->
    358 
    359 <p>
    360 When you package an extension,
    361 the extension is assigned a unique key pair.
    362 The public key is used as the identifier for the extension.
    363 The private key is kept private
    364 and used to sign each version of the extension.
    365 </p>
    366 
    367 
    368 <a name="H2-0"></a><h2>Creating a package</h2>
    369 
    370 <p>To package an extension:</p>
    371 <ol>
    372   <li>
    373     Bring up the Extensions management page
    374     by going to this URL:
    375     <blockquote>
    376     <b>chrome://extensions</b>
    377     </blockquote>
    378   </li>
    379 
    380   <li>
    381     If <b>Developer mode</b> has a + by it,
    382     click the +.
    383   </li>
    384 
    385   <li>
    386     Click the <b>Pack extension</b> button.
    387     A dialog appears.
    388   </li>
    389 
    390   <li>
    391     In the <b>Extension root directory</b> field,
    392     specify the path to the extension's folder 
    393     for example, <code>c:\myext</code>.
    394     (Ignore the other field;
    395     you don't specify a private key file
    396     the first time you package a particular extension.)
    397   </li>
    398 
    399   <li>
    400     Click <b>OK</b>.
    401     The packager creates two files:
    402     a <code>.crx</code> file,
    403     which is the actual extension that can be installed,
    404     and a <code>.pem</code> file,
    405     which contains the private key.
    406   </li>
    407 </ol>
    408 
    409 
    410 <p>
    411 <b>Do not lose the private key!</b>
    412 Keep the <code>.pem</code> file secret and in a safe place.
    413 You'll need it later if you want to do any of the following:
    414 </p>
    415 <ul>
    416 <li><a href="#update">Update</a> the extension</li>
    417 <li>Upload the extension using the
    418 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a></li>
    419 </ul>
    420 
    421 <p>
    422 If the extension is successfully packaged, you'll see a dialog like this
    423 that tells you where to find
    424 the <code>.crx</code> and <code>.pem</code> files:</p>
    425 <p></p>
    426 
    427 <img src="images/package-success.gif" width="554" height="208">
    428 
    429 
    430 <h2 id="update">Updating a package</h2>
    431 
    432 <p>To create an updated version of your extension:</p>
    433 <ol>
    434   <li>
    435     Increase the version number in <code>manifest.json</code>.
    436   </li>
    437 
    438   <li>
    439     Bring up the Extensions management page
    440     by going to this URL: <b>chrome://extensions</b>
    441   </li>
    442 
    443   <li>
    444     Click the <b>Pack extension</b> button.
    445     A dialog appears.
    446   </li>
    447 
    448   <li>
    449     In the <b>Extension root directory</b> field,
    450     specify the path to the extension's folder 
    451     for example, <code>c:\myext</code>.
    452   </li>
    453 
    454   <li>
    455     In the <b>Private key file</b> field,
    456     specify the location of the
    457     already generated <code>.pem</code> file for this extension 
    458     for example, <code>c:\myext.pem</code>.
    459   </li>
    460 
    461   <li>
    462     Click <b>OK</b>.
    463   </li>
    464 </ol>
    465 
    466 <p>If the updated extension is successfully packaged, you'll see a dialog like this:</p>
    467 
    468 <img src="images/update-success.gif" width="298" height="160">
    469 
    470 <a name="H2-2"></a><h2>Packaging at the command line</h2>
    471 
    472 <p>
    473 Another way to package extensions
    474 is by invoking <code>chrome.exe</code> at the command line.
    475 Use the <code>--pack-extension</code> flag
    476 to specify the location of the extension's folder.
    477 Use <code>--pack-extension-key</code>
    478 to specify the location of the extension's private key file.
    479 For example:
    480 </p>
    481 
    482 <pre>chrome.exe --pack-extension=c:\myext --pack-extension-key=c:\myext.pem
    483 </pre>
    484 
    485 <p>
    486 To suppress the dialog,
    487 add <code>--no-message-box</code> to the command.
    488 </p>
    489 
    490 <a name="H2-3"></a><h2>Package format and scripts</h2>
    491 <p>
    492 For more information on the format, as well as pointers to scripts you can use
    493 to create <code>.crx</code> files, see <a href="crx.html">CRX package format</a>.
    494 </p>
    495 </div>
    496 
    497         <!-- API PAGE -->
    498         <div class="apiPage" style="display: none; ">
    499         <a name="apiReference"></a>
    500         <h2>API reference: chrome.apiname </h2>
    501 
    502           <!-- PROPERTIES -->
    503           <div class="apiGroup">
    504             <a name="properties"></a>
    505             <h3 id="properties">Properties</h3>
    506 
    507             <div>
    508               <a></a>
    509               <h4>getLastError</h4>
    510               <div class="summary">
    511                 <!-- Note: intentionally longer 80 columns -->
    512                 <span>chrome.extension</span><span>lastError</span>
    513               </div>
    514               <div>
    515               </div>
    516             </div>
    517 
    518           </div> <!-- /apiGroup -->
    519 
    520           <!-- METHODS -->
    521           <div id="methodsTemplate" class="apiGroup">
    522             <a></a>
    523             <h3>Methods</h3>
    524 
    525             <!-- iterates over all functions -->
    526             <div class="apiItem">
    527               <a></a> <!-- method-anchor -->
    528               <h4>method name</h4>
    529 
    530               <div class="summary"><span>void</span>
    531                   <!-- Note: intentionally longer 80 columns -->
    532                   <span>chrome.module.methodName</span>(<span><span>, </span><span></span>
    533                       <var><span></span></var></span>)</div>
    534 
    535               <div class="description">
    536                 <p class="todo">Undocumented.</p>
    537                 <p>
    538                   A description from the json schema def of the function goes here.
    539                 </p>
    540 
    541                 <!-- PARAMETERS -->
    542                 <h4>Parameters</h4>
    543                 <dl>
    544                   <div>
    545                     <div>
    546                     </div>
    547                   </div>
    548                 </dl>
    549 
    550                 <!-- RETURNS -->
    551                 <h4>Returns</h4>
    552                 <dl>
    553                   <div>
    554                     <div>
    555                     </div>
    556                   </div>
    557                 </dl>
    558 
    559                 <!-- CALLBACK -->
    560                 <div>
    561                   <div>
    562                   <h4>Callback function</h4>
    563                   <p>
    564                     The callback <em>parameter</em> should specify a function
    565                     that looks like this:
    566                   </p>
    567                   <p>
    568                     If you specify the <em>callback</em> parameter, it should
    569                     specify a function that looks like this:
    570                   </p>
    571 
    572                   <!-- Note: intentionally longer 80 columns -->
    573                   <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>;</pre>
    574                   <dl>
    575                     <div>
    576                       <div>
    577                       </div>
    578                     </div>
    579                   </dl>
    580                   </div>
    581                 </div>
    582 
    583                 <!-- MIN_VERSION -->
    584                 <p>
    585                   This function was added in version <b><span></span></b>.
    586                   If you require this function, the manifest key
    587                   <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
    588                   can ensure that your extension won't be run in an earlier browser version.
    589                 </p>
    590               </div> <!-- /description -->
    591 
    592             </div>  <!-- /apiItem -->
    593 
    594           </div>  <!-- /apiGroup -->
    595 
    596           <!-- EVENTS -->
    597           <div id="eventsTemplate" class="apiGroup">
    598             <a></a>
    599             <h3>Events</h3>
    600             <!-- iterates over all events -->
    601             <div class="apiItem">
    602               <a></a>
    603               <h4>event name</h4>
    604 
    605               <div class="summary">
    606                 <!-- Note: intentionally longer 80 columns -->
    607                 <span class="subdued">chrome.bookmarks</span><span>onEvent</span><span class="subdued">.addListener</span>(function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>);
    608               </div>
    609 
    610               <div class="description">
    611                 <p class="todo">Undocumented.</p>
    612                 <p>
    613                   A description from the json schema def of the event goes here.
    614                 </p>
    615 
    616                 <!-- PARAMETERS -->
    617                 <div>
    618                   <h4>Parameters</h4>
    619                   <dl>
    620                     <div>
    621                       <div>
    622                       </div>
    623                     </div>
    624                   </dl>
    625                 </div>
    626               </div> <!-- /decription -->
    627 
    628             </div> <!-- /apiItem -->
    629 
    630           </div> <!-- /apiGroup -->
    631 
    632           <!-- TYPES -->
    633           <div class="apiGroup">
    634             <a name="types"></a>
    635             <h3 id="types">Types</h3>
    636 
    637             <!-- iterates over all types -->
    638             <div class="apiItem">
    639               <a></a>
    640               <h4>type name</h4>
    641 
    642               <div>
    643               </div>
    644 
    645             </div> <!-- /apiItem -->
    646 
    647           </div> <!-- /apiGroup -->
    648 
    649         </div> <!-- /apiPage -->
    650       </div> <!-- /gc-pagecontent -->
    651     </div> <!-- /g-section -->
    652   </div> <!-- /codesiteContent -->
    653     <div id="gc-footer" --="">
    654       <div class="text">
    655   <p>
    656   Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>,
    657   the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons
    658   Attribution 3.0 License</a>, and code samples are licensed under the
    659   <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
    660   </p>
    661   <p>
    662   2011 Google
    663   </p>
    664 
    665 <!-- begin analytics -->
    666 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
    667 <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
    668 
    669 <script type="text/javascript">
    670   // chrome doc tracking
    671   try {
    672     var engdocs = _gat._getTracker("YT-10763712-2");
    673     engdocs._trackPageview();
    674   } catch(err) {}
    675 
    676   // code.google.com site-wide tracking
    677   try {
    678     _uacct="UA-18071-1";
    679     _uanchor=1;
    680     _uff=0;
    681     urchinTracker();
    682   }
    683   catch(e) {/* urchinTracker not available. */}
    684 </script>
    685 <!-- end analytics -->
    686       </div>
    687     </div> <!-- /gc-footer -->
    688   </div> <!-- /gc-container -->
    689 </body></html>
    690