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

Side by Side Diff: chrome/browser/extensions/extension_web_ui.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . Created 4 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/extensions/extension_web_ui.h" 5 #include "chrome/browser/extensions/extension_web_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
16 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h" 18 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h"
17 #include "chrome/browser/extensions/extension_tab_util.h" 19 #include "chrome/browser/extensions/extension_tab_util.h"
18 #include "chrome/browser/extensions/extension_util.h" 20 #include "chrome/browser/extensions/extension_util.h"
19 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (!val->GetAsDictionary(&dict) || !dict->GetString(kEntry, &entry)) { 104 if (!val->GetAsDictionary(&dict) || !dict->GetString(kEntry, &entry)) {
103 NOTREACHED(); 105 NOTREACHED();
104 continue; 106 continue;
105 } 107 }
106 if (entry == override) { 108 if (entry == override) {
107 dict->SetBoolean(kActive, true); 109 dict->SetBoolean(kActive, true);
108 return; // All done! 110 return; // All done!
109 } 111 }
110 } 112 }
111 113
112 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 114 auto dict = base::MakeUnique<base::DictionaryValue>();
113 dict->SetString(kEntry, override); 115 dict->SetString(kEntry, override);
114 dict->SetBoolean(kActive, true); 116 dict->SetBoolean(kActive, true);
115 // Add the entry to the front of the list. 117 // Add the entry to the front of the list.
116 list->Insert(0, dict.release()); 118 list->Insert(0, std::move(dict));
117 } 119 }
118 120
119 // Validates that each entry in |list| contains a valid url and points to an 121 // Validates that each entry in |list| contains a valid url and points to an
120 // extension contained in |all_extensions| (and, if not, removes it). 122 // extension contained in |all_extensions| (and, if not, removes it).
121 void ValidateOverridesList(const extensions::ExtensionSet* all_extensions, 123 void ValidateOverridesList(const extensions::ExtensionSet* all_extensions,
122 base::ListValue* list) { 124 base::ListValue* list) {
123 base::ListValue migrated; 125 base::ListValue migrated;
124 for (const auto& val : *list) { 126 for (const auto& val : *list) {
125 base::DictionaryValue* dict = nullptr; 127 base::DictionaryValue* dict = nullptr;
126 std::string entry; 128 std::string entry;
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 560 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
559 gfx::Size(pixel_size, pixel_size), 561 gfx::Size(pixel_size, pixel_size),
560 resource_scale_factor)); 562 resource_scale_factor));
561 } 563 }
562 564
563 // LoadImagesAsync actually can run callback synchronously. We want to force 565 // LoadImagesAsync actually can run callback synchronously. We want to force
564 // async. 566 // async.
565 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 567 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
566 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 568 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
567 } 569 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_test_util.cc ('k') | chrome/browser/notifications/notifier_state_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698