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

Side by Side Diff: chrome/common/extensions/manifest_handlers/theme_handler.cc

Issue 1880143002: Convert chrome/common to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/theme_handler.h" 5 #include "chrome/common/extensions/manifest_handlers/theme_handler.h"
6 6
7 #include <memory>
8
7 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "chrome/grit/generated_resources.h" 12 #include "chrome/grit/generated_resources.h"
12 #include "extensions/common/manifest.h" 13 #include "extensions/common/manifest.h"
13 #include "extensions/common/manifest_constants.h" 14 #include "extensions/common/manifest_constants.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 namespace keys = manifest_keys; 19 namespace keys = manifest_keys;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ThemeHandler::~ThemeHandler() { 168 ThemeHandler::~ThemeHandler() {
168 } 169 }
169 170
170 bool ThemeHandler::Parse(Extension* extension, base::string16* error) { 171 bool ThemeHandler::Parse(Extension* extension, base::string16* error) {
171 const base::DictionaryValue* theme_value = NULL; 172 const base::DictionaryValue* theme_value = NULL;
172 if (!extension->manifest()->GetDictionary(keys::kTheme, &theme_value)) { 173 if (!extension->manifest()->GetDictionary(keys::kTheme, &theme_value)) {
173 *error = base::ASCIIToUTF16(errors::kInvalidTheme); 174 *error = base::ASCIIToUTF16(errors::kInvalidTheme);
174 return false; 175 return false;
175 } 176 }
176 177
177 scoped_ptr<ThemeInfo> theme_info(new ThemeInfo); 178 std::unique_ptr<ThemeInfo> theme_info(new ThemeInfo);
178 if (!LoadImages(theme_value, error, theme_info.get())) 179 if (!LoadImages(theme_value, error, theme_info.get()))
179 return false; 180 return false;
180 if (!LoadColors(theme_value, error, theme_info.get())) 181 if (!LoadColors(theme_value, error, theme_info.get()))
181 return false; 182 return false;
182 if (!LoadTints(theme_value, error, theme_info.get())) 183 if (!LoadTints(theme_value, error, theme_info.get()))
183 return false; 184 return false;
184 if (!LoadDisplayProperties(theme_value, error, theme_info.get())) 185 if (!LoadDisplayProperties(theme_value, error, theme_info.get()))
185 return false; 186 return false;
186 187
187 extension->SetManifestData(keys::kTheme, theme_info.release()); 188 extension->SetManifestData(keys::kTheme, theme_info.release());
(...skipping 25 matching lines...) Expand all
213 } 214 }
214 } 215 }
215 return true; 216 return true;
216 } 217 }
217 218
218 const std::vector<std::string> ThemeHandler::Keys() const { 219 const std::vector<std::string> ThemeHandler::Keys() const {
219 return SingleKey(keys::kTheme); 220 return SingleKey(keys::kTheme);
220 } 221 }
221 222
222 } // namespace extensions 223 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698