1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6#include "nsISupports.idl"
7interface nsIFile;
8
9/**
10 * Helper interface for nsIProfileMigrator.
11 *
12 * @provider Toolkit (Startup code)
13 * @client   Application (Profile-migration code)
14 * @obtainable nsIProfileMigrator.migrate
15 */
16[scriptable, uuid(048e5ca1-0eb7-4bb1-a9a2-a36f7d4e0e3c)]
17interface nsIProfileStartup : nsISupports
18{
19  /**
20   * The root directory of the semi-current profile, during profile migration.
21   * After nsIProfileMigrator.migrate has returned, this object will not be
22   * useful.
23   */
24  readonly attribute nsIFile directory;
25
26  /**
27   * Do profile-startup by setting NS_APP_USER_PROFILE_50_DIR in the directory
28   * service and notifying the profile-startup observer topics.
29   */
30  void doStartup();
31};
32
33/**
34 * Migrate application settings from an outside source.
35 *
36 * @provider Application (Profile-migration code)
37 * @client   Toolkit (Startup code)
38 * @obtainable service, contractid("@mozilla.org/toolkit/profile-migrator;1")
39 */
40[scriptable, uuid(3df284a5-2258-4d46-a664-761ecdc04c22)]
41interface nsIProfileMigrator : nsISupports
42{
43  /**
44   * Migrate data from an outside source, if possible.  Does nothing
45   * otherwise.
46   *
47   * When this method is called, a default profile has been created;
48   * XPCOM has been initialized such that compreg.dat is in the
49   * profile; the directory service does *not* return a key for
50   * NS_APP_USER_PROFILE_50_DIR or any of the keys depending on an active
51   * profile. To figure out the directory of the "current" profile, use
52   * aStartup.directory.
53   *
54   * If your migrator needs to access services that use the profile (to
55   * set profile prefs or bookmarks, for example), use aStartup.doStartup.
56   *
57   * @param  aStartup nsIProfileStartup object to use during migration.
58   * @param  aKey     optional key of a migrator to use to skip source selection.
59   * @param  aProfileName optional name of the profile to use for migration.
60   *
61   * @note The startup code ignores COM exceptions thrown from this method.
62   */
63  void migrate(in nsIProfileStartup aStartup, in ACString aKey,
64               [optional] in ACString aProfileName);
65};
66
67%{C++
68#define NS_PROFILEMIGRATOR_CONTRACTID "@mozilla.org/toolkit/profile-migrator;1"
69%}
70