faecf147c36a7e82230ba6d6806b3635f9a6b938
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / install_observer.h
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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_
6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_
7
8 #include <string>
9
10 #include "ui/gfx/image/image_skia.h"
11
12 namespace extensions {
13
14 class Extension;
15
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);
25
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;
32   };
33
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) {}
37
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) {}
42
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) {}
49
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) {}
53
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) {}
58
59   // Called if the extension fails to install.
60   virtual void OnInstallFailure(const std::string& extension_id) {}
61
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) {}
65
66   // Called when the app list is reordered.
67   virtual void OnAppsReordered() {}
68
69   // Notifies observers that the observed object is going away.
70   virtual void OnShutdown() {}
71
72  protected:
73   virtual ~InstallObserver() {}
74 };
75
76 }  // namespace extensions
77
78 #endif  // CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_