Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5432)

Unified Diff: chrome/browser/extensions/install_tracker.h

Issue 12298015: Change NotifyAppList*() functions into observers on a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/install_tracker.h
diff --git a/chrome/browser/extensions/install_tracker.h b/chrome/browser/extensions/install_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..09770e7307dfb8c78aae2f631cb55cc6a08ca28d
--- /dev/null
+++ b/chrome/browser/extensions/install_tracker.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_
+#define CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_
+
+#include "base/observer_list.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "ui/gfx/image/image_skia.h"
+
+class Profile;
+
+namespace extensions {
+
+class InstallObserver {
+ public:
+ virtual void OnBeginExtensionInstall(
+ const std::string& extension_id,
+ const std::string& extension_name,
+ const gfx::ImageSkia& installing_icon,
+ bool is_app) = 0;
+
+ virtual void OnDownloadProgress(const std::string& extension_id,
+ int percent_downloaded) = 0;
+
+ virtual void OnInstallFailure(
benwells 2013/02/21 06:15:38 nit: will fit on one line (i think)
koz (OOO until 15th September) 2013/02/25 02:39:28 Done.
+ const std::string& extension_id) = 0;
xiyuan 2013/02/21 06:33:17 nit: add a protected virtual destructor.
koz (OOO until 15th September) 2013/02/25 02:39:28 Done.
+};
+
+class InstallTracker : public ProfileKeyedService, public InstallObserver {
xiyuan 2013/02/21 06:33:17 InstallTracker probably should not derive from Ins
koz (OOO until 15th September) 2013/02/25 02:39:28 Done.
+ public:
+ explicit InstallTracker(Profile* profile);
+ virtual ~InstallTracker();
+
+ // ProfileKeyedService implementation.
+ virtual void Shutdown() OVERRIDE {}
xiyuan 2013/02/21 06:33:17 Think we can get rid of this since we are not real
koz (OOO until 15th September) 2013/02/25 02:39:28 Done.
+
+ void AddObserver(InstallObserver* observer);
+ void RemoveObserver(InstallObserver* observer);
+
+ // InstallObserver overrides.
+ virtual void OnBeginExtensionInstall(
+ const std::string& extension_id,
+ const std::string& extension_name,
+ const gfx::ImageSkia& installing_icon,
+ bool is_app) OVERRIDE;
+ virtual void OnDownloadProgress(const std::string& extension_id,
+ int percent_downloaded) OVERRIDE;
+ virtual void OnInstallFailure(const std::string& extension_id) OVERRIDE;
+
+ private:
+ Profile* profile_;
xiyuan 2013/02/21 06:33:17 This does not seem used anywhere. Think we could g
koz (OOO until 15th September) 2013/02/25 02:39:28 Done.
+ ObserverList<InstallObserver> observers_;
xiyuan 2013/02/21 06:33:17 DISALLOW_COPY_AND_ASSIGN(...)
koz (OOO until 15th September) 2013/02/25 02:39:28 Done.
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_

Powered by Google App Engine
This is Rietveld 408576698