Index: chrome/browser/extensions/extension_app_icon_service.h |
diff --git a/chrome/browser/extensions/extension_app_icon_service.h b/chrome/browser/extensions/extension_app_icon_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..216e68627706afe1009fdcf4cee3acc94100f773 |
--- /dev/null |
+++ b/chrome/browser/extensions/extension_app_icon_service.h |
@@ -0,0 +1,69 @@ |
+// Copyright 2017 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_EXTENSION_APP_ICON_SERVICE_H_ |
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_APP_ICON_SERVICE_H_ |
+ |
+#include <map> |
+#include <memory> |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+ |
+namespace content { |
+class BrowserContext; |
+} |
+ |
+namespace extensions { |
+ |
+class ExtensionAppIcon; |
+class ExtensionAppIconDelegate; |
+ |
+class ExtensionAppIconService : public KeyedService { |
xiyuan
2017/04/18 20:43:00
Document the class
khmel
2017/04/20 00:13:38
Done.
|
+ public: |
+ static ExtensionAppIconService* Create(content::BrowserContext* context); |
+ |
+ // Convenience function to get the ExtensionAppIconService for a |
+ // BrowserContext. |
+ static ExtensionAppIconService* Get(content::BrowserContext* context); |
+ |
+ ~ExtensionAppIconService() override; |
+ |
+ std::unique_ptr<ExtensionAppIcon> CreateIcon( |
xiyuan
2017/04/18 20:43:00
doc ?
khmel
2017/04/20 00:13:38
Done.
|
+ ExtensionAppIconDelegate* delegate, |
+ const std::string& app_id, |
+ int resource_size_in_dip); |
+ |
+ void OnIconDestroyed(ExtensionAppIcon* icon); |
xiyuan
2017/04/18 20:43:00
doc ?
khmel
2017/04/20 00:13:38
Done.
|
+ |
+ // KeyedService: |
+ void Shutdown() override; |
+ |
+ private: |
+ class Updater; |
+ using IconMap = std::multimap<std::string, ExtensionAppIcon*>; |
+ |
+ // See the Create methods. |
+ explicit ExtensionAppIconService(content::BrowserContext* context); |
+ |
+ void OnAppUpdated(const std::string& app_id); |
xiyuan
2017/04/18 20:43:00
doc ?
khmel
2017/04/20 00:13:38
Done.
|
+ |
+ // Unowned pointer. |
+ content::BrowserContext* context_; |
+ |
+#if defined(OS_CHROMEOS) |
+ std::unique_ptr<Updater> app_updater_; |
+#endif |
+ |
+ IconMap icon_map_; |
+ |
+ base::WeakPtrFactory<ExtensionAppIconService> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExtensionAppIconService); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APP_ICON_SERVICE_H_ |