blob: 6c64cca7e815e66eef55ca3c09ae1f6b92f37e1d [file] [log] [blame]
[email protected]ef9d2742013-02-26 12:48:351// 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
[email protected]919b2f82013-10-04 03:11:268#include <string>
9
[email protected]fa517d02013-11-18 09:33:0910#include "ui/gfx/image/image_skia.h"
[email protected]ef9d2742013-02-26 12:48:3511
12namespace extensions {
13
[email protected]67e0a262013-03-15 13:14:4914class Extension;
15
[email protected]ef9d2742013-02-26 12:48:3516class InstallObserver {
17 public:
[email protected]fa517d02013-11-18 09:33:0918 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;
[email protected]ce35418b2013-11-25 01:22:3331 bool is_ephemeral;
[email protected]fa517d02013-11-18 09:33:0932 };
33
[email protected]243c2e522014-02-27 06:26:2734 // 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);
[email protected]ef9d2742013-02-26 12:48:3537
[email protected]243c2e522014-02-27 06:26:2738 // Called whenever the extension download is updated.
39 // Note: Some extensions have multiple modules, so the percent included here
40 // is a simple calculation of:
41 // (finished_files * 100 + current_file_progress) / (total files * 100).
[email protected]ef9d2742013-02-26 12:48:3542 virtual void OnDownloadProgress(const std::string& extension_id,
[email protected]243c2e522014-02-27 06:26:2743 int percent_downloaded);
[email protected]ef9d2742013-02-26 12:48:3544
[email protected]243c2e522014-02-27 06:26:2745 // Called if the extension fails to install.
46 virtual void OnInstallFailure(const std::string& extension_id);
[email protected]ef9d2742013-02-26 12:48:3547
[email protected]243c2e522014-02-27 06:26:2748 // Called if the installation succeeds.
49 virtual void OnExtensionInstalled(const Extension* extension);
50
51 // Called when an extension is [Loaded, Unloaded, Uninstalled] or an app is
52 // installed to the app list. These are simply forwarded from the
53 // chrome::NOTIFICATIONs.
54 virtual void OnExtensionLoaded(const Extension* extension);
55 virtual void OnExtensionUnloaded(const Extension* extension);
56 virtual void OnExtensionUninstalled(const Extension* extension);
57 virtual void OnAppInstalledToAppList(const std::string& extension_id);
58
59 // Called when the app list is reordered.
60 virtual void OnAppsReordered();
[email protected]67e0a262013-03-15 13:14:4961
[email protected]523352c922013-02-28 01:38:5262 // Notifies observers that the observed object is going away.
[email protected]243c2e522014-02-27 06:26:2763 virtual void OnShutdown();
[email protected]523352c922013-02-28 01:38:5264
[email protected]ef9d2742013-02-26 12:48:3565 protected:
66 virtual ~InstallObserver() {}
67};
68
69} // namespace extensions
70
71#endif // CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_