Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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_EXTENSION_APP_ICON_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APP_ICON_SERVICE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <memory> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "components/keyed_service/core/keyed_service.h" | |
| 14 | |
| 15 namespace content { | |
| 16 class BrowserContext; | |
| 17 } | |
| 18 | |
| 19 namespace extensions { | |
| 20 | |
| 21 class ExtensionAppIcon; | |
| 22 class ExtensionAppIconDelegate; | |
| 23 | |
| 24 class ExtensionAppIconService : public KeyedService { | |
|
xiyuan
2017/04/18 20:43:00
Document the class
khmel
2017/04/20 00:13:38
Done.
| |
| 25 public: | |
| 26 static ExtensionAppIconService* Create(content::BrowserContext* context); | |
| 27 | |
| 28 // Convenience function to get the ExtensionAppIconService for a | |
| 29 // BrowserContext. | |
| 30 static ExtensionAppIconService* Get(content::BrowserContext* context); | |
| 31 | |
| 32 ~ExtensionAppIconService() override; | |
| 33 | |
| 34 std::unique_ptr<ExtensionAppIcon> CreateIcon( | |
|
xiyuan
2017/04/18 20:43:00
doc ?
khmel
2017/04/20 00:13:38
Done.
| |
| 35 ExtensionAppIconDelegate* delegate, | |
| 36 const std::string& app_id, | |
| 37 int resource_size_in_dip); | |
| 38 | |
| 39 void OnIconDestroyed(ExtensionAppIcon* icon); | |
|
xiyuan
2017/04/18 20:43:00
doc ?
khmel
2017/04/20 00:13:38
Done.
| |
| 40 | |
| 41 // KeyedService: | |
| 42 void Shutdown() override; | |
| 43 | |
| 44 private: | |
| 45 class Updater; | |
| 46 using IconMap = std::multimap<std::string, ExtensionAppIcon*>; | |
| 47 | |
| 48 // See the Create methods. | |
| 49 explicit ExtensionAppIconService(content::BrowserContext* context); | |
| 50 | |
| 51 void OnAppUpdated(const std::string& app_id); | |
|
xiyuan
2017/04/18 20:43:00
doc ?
khmel
2017/04/20 00:13:38
Done.
| |
| 52 | |
| 53 // Unowned pointer. | |
| 54 content::BrowserContext* context_; | |
| 55 | |
| 56 #if defined(OS_CHROMEOS) | |
| 57 std::unique_ptr<Updater> app_updater_; | |
| 58 #endif | |
| 59 | |
| 60 IconMap icon_map_; | |
| 61 | |
| 62 base::WeakPtrFactory<ExtensionAppIconService> weak_ptr_factory_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(ExtensionAppIconService); | |
| 65 }; | |
| 66 | |
| 67 } // namespace extensions | |
| 68 | |
| 69 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APP_ICON_SERVICE_H_ | |
| OLD | NEW |