| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_icon_color_info.h" | 5 #include "chrome/common/extensions/manifest_handlers/app_icon_color_info.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/image_util.h" | 12 #include "extensions/common/image_util.h" |
| 13 #include "extensions/common/manifest.h" | 13 #include "extensions/common/manifest.h" |
| 14 #include "extensions/common/manifest_constants.h" | 14 #include "extensions/common/manifest_constants.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 namespace keys = manifest_keys; | 18 namespace keys = manifest_keys; |
| 19 namespace errors = manifest_errors; | 19 namespace errors = manifest_errors; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 static base::LazyInstance<AppIconColorInfo> g_empty_app_icon_color_info = | 23 static base::LazyInstance<AppIconColorInfo>::DestructorAtExit |
| 24 LAZY_INSTANCE_INITIALIZER; | 24 g_empty_app_icon_color_info = LAZY_INSTANCE_INITIALIZER; |
| 25 | 25 |
| 26 const AppIconColorInfo& GetInfo(const Extension* extension) { | 26 const AppIconColorInfo& GetInfo(const Extension* extension) { |
| 27 AppIconColorInfo* info = static_cast<AppIconColorInfo*>( | 27 AppIconColorInfo* info = static_cast<AppIconColorInfo*>( |
| 28 extension->GetManifestData(keys::kAppIconColor)); | 28 extension->GetManifestData(keys::kAppIconColor)); |
| 29 return info ? *info : g_empty_app_icon_color_info.Get(); | 29 return info ? *info : g_empty_app_icon_color_info.Get(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 AppIconColorInfo::AppIconColorInfo() : icon_color_(SK_ColorTRANSPARENT) { | 34 AppIconColorInfo::AppIconColorInfo() : icon_color_(SK_ColorTRANSPARENT) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 extension->SetManifestData(keys::kAppIconColor, | 77 extension->SetManifestData(keys::kAppIconColor, |
| 78 std::move(app_icon_color_info)); | 78 std::move(app_icon_color_info)); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 const std::vector<std::string> AppIconColorHandler::Keys() const { | 82 const std::vector<std::string> AppIconColorHandler::Keys() const { |
| 83 return SingleKey(keys::kAppIconColor); | 83 return SingleKey(keys::kAppIconColor); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace extensions | 86 } // namespace extensions |
| OLD | NEW |