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

Side by Side Diff: extensions/common/message_bundle.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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 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 "extensions/common/message_bundle.h" 5 #include "extensions/common/message_bundle.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
11 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
12 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
13 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "extensions/common/error_utils.h" 20 #include "extensions/common/error_utils.h"
21 #include "extensions/common/extension_l10n_util.h" 21 #include "extensions/common/extension_l10n_util.h"
22 #include "extensions/common/manifest_constants.h" 22 #include "extensions/common/manifest_constants.h"
23 23
24 namespace extensions { 24 namespace extensions {
(...skipping 27 matching lines...) Expand all
52 *error = base::StringPrintf( 52 *error = base::StringPrintf(
53 "Name of a key \"%s\" is invalid. Only ASCII [a-z], " 53 "Name of a key \"%s\" is invalid. Only ASCII [a-z], "
54 "[A-Z], [0-9] and \"_\" are allowed.", 54 "[A-Z], [0-9] and \"_\" are allowed.",
55 name.c_str()); 55 name.c_str());
56 return false; 56 return false;
57 } 57 }
58 58
59 // static 59 // static
60 MessageBundle* MessageBundle::Create(const CatalogVector& locale_catalogs, 60 MessageBundle* MessageBundle::Create(const CatalogVector& locale_catalogs,
61 std::string* error) { 61 std::string* error) {
62 scoped_ptr<MessageBundle> message_bundle(new MessageBundle); 62 std::unique_ptr<MessageBundle> message_bundle(new MessageBundle);
63 if (!message_bundle->Init(locale_catalogs, error)) 63 if (!message_bundle->Init(locale_catalogs, error))
64 return NULL; 64 return NULL;
65 65
66 return message_bundle.release(); 66 return message_bundle.release();
67 } 67 }
68 68
69 bool MessageBundle::Init(const CatalogVector& locale_catalogs, 69 bool MessageBundle::Init(const CatalogVector& locale_catalogs,
70 std::string* error) { 70 std::string* error) {
71 dictionary_.clear(); 71 dictionary_.clear();
72 72
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return &(it->second); 337 return &(it->second);
338 338
339 return NULL; 339 return NULL;
340 } 340 }
341 341
342 void EraseL10nMessagesMap(const std::string& extension_id) { 342 void EraseL10nMessagesMap(const std::string& extension_id) {
343 g_extension_to_messages_map.Get().messages_map.erase(extension_id); 343 g_extension_to_messages_map.Get().messages_map.erase(extension_id);
344 } 344 }
345 345
346 } // namespace extensions 346 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/manifest_url_handlers.cc ('k') | extensions/common/message_bundle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698