blob: 0185dd374212232dc27bc4a586cd6548e2d874d7 [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;
31 };
32
[email protected]243c2e522014-02-27 06:26:2733 // Called at the beginning of the complete installation process, i.e., this
34 // is called before the extension download begins.
[email protected]c80fe5f2014-03-26 04:36:3035 virtual void OnBeginExtensionInstall(const ExtensionInstallParams& params) {}
36
37 // Called when the Extension begins the download process. This typically
38 // happens right after OnBeginExtensionInstall(), unless the extension has
39 // already been downloaded.
40 virtual void OnBeginExtensionDownload(const std::string& extension_id) {}
[email protected]ef9d2742013-02-26 12:48:3541
[email protected]243c2e522014-02-27 06:26:2742 // Called whenever the extension download is updated.
43 // Note: Some extensions have multiple modules, so the percent included here
44 // is a simple calculation of:
45 // (finished_files * 100 + current_file_progress) / (total files * 100).
[email protected]ef9d2742013-02-26 12:48:3546 virtual void OnDownloadProgress(const std::string& extension_id,
[email protected]c80fe5f2014-03-26 04:36:3047 int percent_downloaded) {}
48
49 // Called when the necessary downloads have completed, and the crx
50 // installation is due to start.
51 virtual void OnBeginCrxInstall(const std::string& extension_id) {}
[email protected]ef9d2742013-02-26 12:48:3552
[email protected]73cd487c2014-04-16 05:22:5053 // Called when installation of a crx has completed (either successfully or
54 // not).
55 virtual void OnFinishCrxInstall(const std::string& extension_id,
56 bool success) {}
57
[email protected]243c2e522014-02-27 06:26:2758 // Called if the extension fails to install.
[email protected]c80fe5f2014-03-26 04:36:3059 virtual void OnInstallFailure(const std::string& extension_id) {}
[email protected]ef9d2742013-02-26 12:48:3560
[email protected]b8e45df2014-06-11 19:32:3661 // Called when an extension or an app is installed to the app list. These are
62 // simply forwarded from the chrome::NOTIFICATIONs.
[email protected]c80fe5f2014-03-26 04:36:3063 virtual void OnDisabledExtensionUpdated(const Extension* extension) {}
[email protected]243c2e522014-02-27 06:26:2764
65 // Called when the app list is reordered.
[email protected]c80fe5f2014-03-26 04:36:3066 virtual void OnAppsReordered() {}
[email protected]67e0a262013-03-15 13:14:4967
[email protected]523352c922013-02-28 01:38:5268 // Notifies observers that the observed object is going away.
[email protected]c80fe5f2014-03-26 04:36:3069 virtual void OnShutdown() {}
[email protected]523352c922013-02-28 01:38:5270
[email protected]ef9d2742013-02-26 12:48:3571 protected:
72 virtual ~InstallObserver() {}
73};
74
75} // namespace extensions
76
77#endif // CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_