Extensions cleanup: Merge IsSyncableApp+Extension, ShouldSyncApp+Extension
[chromium-blink-merge.git] / chrome / browser / extensions / install_observer.h
blobfaecf147c36a7e82230ba6d6806b3635f9a6b938
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_
6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_
8 #include <string>
10 #include "ui/gfx/image/image_skia.h"
12 namespace extensions {
14 class Extension;
16 class InstallObserver {
17 public:
18 struct ExtensionInstallParams {
19 ExtensionInstallParams(
20 std::string extension_id,
21 std::string extension_name,
22 gfx::ImageSkia installing_icon,
23 bool is_app,
24 bool is_platform_app);
26 std::string extension_id;
27 std::string extension_name;
28 gfx::ImageSkia installing_icon;
29 bool is_app;
30 bool is_platform_app;
31 bool is_ephemeral;
34 // Called at the beginning of the complete installation process, i.e., this
35 // is called before the extension download begins.
36 virtual void OnBeginExtensionInstall(const ExtensionInstallParams& params) {}
38 // Called when the Extension begins the download process. This typically
39 // happens right after OnBeginExtensionInstall(), unless the extension has
40 // already been downloaded.
41 virtual void OnBeginExtensionDownload(const std::string& extension_id) {}
43 // Called whenever the extension download is updated.
44 // Note: Some extensions have multiple modules, so the percent included here
45 // is a simple calculation of:
46 // (finished_files * 100 + current_file_progress) / (total files * 100).
47 virtual void OnDownloadProgress(const std::string& extension_id,
48 int percent_downloaded) {}
50 // Called when the necessary downloads have completed, and the crx
51 // installation is due to start.
52 virtual void OnBeginCrxInstall(const std::string& extension_id) {}
54 // Called when installation of a crx has completed (either successfully or
55 // not).
56 virtual void OnFinishCrxInstall(const std::string& extension_id,
57 bool success) {}
59 // Called if the extension fails to install.
60 virtual void OnInstallFailure(const std::string& extension_id) {}
62 // Called when an extension or an app is installed to the app list. These are
63 // simply forwarded from the chrome::NOTIFICATIONs.
64 virtual void OnDisabledExtensionUpdated(const Extension* extension) {}
66 // Called when the app list is reordered.
67 virtual void OnAppsReordered() {}
69 // Notifies observers that the observed object is going away.
70 virtual void OnShutdown() {}
72 protected:
73 virtual ~InstallObserver() {}
76 } // namespace extensions
78 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_