Home | History | Annotate | Download | only in intros
      1 <h2 id="ChromeSetting">Chrome settings</h2>
      2 
      3 <p>
      4 The <code>ChromeSetting</code> prototype provides a common set of functions
      5 (<code>get()</code>, <code>set()</code>, and <code>clear()</code>) as
      6 well as an event publisher (<code>onChange</code>) for settings of the
      7 Chrome browser. The <a href="proxy.html#overview-examples">proxy settings
      8  examples</a> demonstrate how these functions are intended to be used.
      9 </p>
     10 
     11 <h3 id="ChromeSetting-lifecycle">Scope and life cycle</h3>
     12 
     13 <p>
     14 Chrome distinguishes between three different scopes of browser settings:
     15 <dl>
     16   <dt><code>regular</code></dt>
     17   <dd>Settings set in the <code>regular</code> scope apply to regular
     18   browser windows and are inherited by incognito windows if they are not
     19   overwritten. These settings are stored to disk and remain in place until
     20   they are cleared by the governing extension, or the governing extension is
     21   disabled or uninstalled.</dd>
     22 
     23   <dt><code>incognito_persistent</code></dt>
     24   <dd>Settings set in the <code>incognito_persistent</code> scope apply only
     25   to incognito windows. For these, they override <code>regular</code>
     26   settings. These settings are stored to disk and remain in place until
     27   they are cleared by the governing extension, or the governing extension is
     28   disabled or uninstalled.</dd>
     29 
     30   <dt><code>incognito_session_only</code></dt>
     31   <dd>Settings set in the <code>incognito_session_only</code> scope apply only
     32   to incognito windows. For these, they override <code>regular</code> and
     33   <code>incognito_session_only</code> settings. These settings are not
     34   stored to disk and are cleared when the last incognito window is closed. They
     35   can only be set when at least one incognito window is open.</dd>
     36 
     37 </dl>
     38 </p>
     39 
     40 <h3 id="ChromeSetting-precedence">Precedence</h3>
     41 
     42 <p>
     43 Chrome manages settings on different layers. The following list describes the
     44 layers that may influence the effective settings, in increasing order of
     45 precedence.
     46 <ol>
     47   <li>System settings provided by the operating system</li>
     48   <li>Command-line parameters</li>
     49   <li>Settings provided by extensions</li>
     50   <li>Policies</li>
     51 </ol>
     52 </p>
     53 
     54 <p>
     55 As the list implies, policies might overrule any changes that you specify with
     56 your extension. You can use the <code>get()</code> function to determine whether
     57 your extension is capable of providing a setting or whether this setting would
     58 be overridden.
     59 </p>
     60 
     61 <p>
     62 As discussed above, Chrome allows using different settings for regular
     63 windows and incognito windows. The following example illustrates the behavior.
     64 Assume that no policy overrides the settings and that an extension can set
     65 settings for regular windows <b>(R)</b> and settings for incognito windows
     66 <b>(I)</b>.
     67 </p>
     68 
     69 <p>
     70 <ul>
     71   <li>If only <b>(R)</b> is set, these settings are effective for both
     72   regular and incognito windows.</li>
     73   <li>If only <b>(I)</b> is set, these settings are effective for only
     74   incognito windows. Regular windows use the settings determined by the lower
     75   layers (command-line options and system settings).</li>
     76   <li>If both <b>(R)</b> and <b>(I)</b> are set, the respective settings are
     77   used for regular and incognito windows.</li>
     78 </ul>
     79 </p>
     80 
     81 <p>
     82 If two or more extensions want to set the same setting to different values,
     83 the extension installed most recently takes precedence over the other
     84 extensions.  If the most recently installed extension sets only <b>(I)</b>, the
     85 settings of regular windows can be defined by previously installed extensions.
     86 </p>
     87 
     88 <p>
     89 The <em>effective</em> value of a setting is the one that results from
     90 considering the precedence rules. It is used by Chrome.
     91 <p>
     92