OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/extensions/manifest_handlers/linked_app_icons.h" | 5 #include "chrome/common/extensions/manifest_handlers/linked_app_icons.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "extensions/common/manifest.h" | 12 #include "extensions/common/manifest.h" |
13 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 namespace keys = manifest_keys; | 17 namespace keys = manifest_keys; |
18 namespace errors = manifest_errors; | 18 namespace errors = manifest_errors; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 static base::LazyInstance<LinkedAppIcons> g_empty_linked_app_icons = | 22 static base::LazyInstance<LinkedAppIcons>::DestructorAtExit |
23 LAZY_INSTANCE_INITIALIZER; | 23 g_empty_linked_app_icons = LAZY_INSTANCE_INITIALIZER; |
24 | 24 |
25 const LinkedAppIcons& GetInfo(const Extension* extension) { | 25 const LinkedAppIcons& GetInfo(const Extension* extension) { |
26 LinkedAppIcons* info = static_cast<LinkedAppIcons*>( | 26 LinkedAppIcons* info = static_cast<LinkedAppIcons*>( |
27 extension->GetManifestData(keys::kLinkedAppIcons)); | 27 extension->GetManifestData(keys::kLinkedAppIcons)); |
28 return info ? *info : g_empty_linked_app_icons.Get(); | 28 return info ? *info : g_empty_linked_app_icons.Get(); |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 LinkedAppIcons::IconInfo::IconInfo() { | 33 LinkedAppIcons::IconInfo::IconInfo() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 extension->SetManifestData(keys::kLinkedAppIcons, | 104 extension->SetManifestData(keys::kLinkedAppIcons, |
105 std::move(linked_app_icons)); | 105 std::move(linked_app_icons)); |
106 return true; | 106 return true; |
107 } | 107 } |
108 | 108 |
109 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { | 109 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { |
110 return SingleKey(keys::kLinkedAppIcons); | 110 return SingleKey(keys::kLinkedAppIcons); |
111 } | 111 } |
112 | 112 |
113 } // namespace extensions | 113 } // namespace extensions |
OLD | NEW |