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

Side by Side Diff: chrome/browser/ui/webui/options/handler_options_handler.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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/ui/webui/options/handler_options_handler.h" 5 #include "chrome/browser/ui/webui/options/handler_options_handler.h"
6 6
7 #include <memory>
8 #include <utility>
7 #include <vector> 9 #include <vector>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 17 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
16 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ProtocolHandlerRegistry* HandlerOptionsHandler::GetProtocolHandlerRegistry() { 84 ProtocolHandlerRegistry* HandlerOptionsHandler::GetProtocolHandlerRegistry() {
83 return ProtocolHandlerRegistryFactory::GetForBrowserContext( 85 return ProtocolHandlerRegistryFactory::GetForBrowserContext(
84 Profile::FromWebUI(web_ui())); 86 Profile::FromWebUI(web_ui()));
85 } 87 }
86 88
87 static void GetHandlersAsListValue( 89 static void GetHandlersAsListValue(
88 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, 90 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers,
89 base::ListValue* handler_list) { 91 base::ListValue* handler_list) {
90 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; 92 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler;
91 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { 93 for (handler = handlers.begin(); handler != handlers.end(); ++handler) {
92 base::ListValue* handlerValue = new base::ListValue(); 94 std::unique_ptr<base::ListValue> handlerValue(new base::ListValue());
93 handlerValue->AppendString(handler->protocol()); 95 handlerValue->AppendString(handler->protocol());
94 handlerValue->AppendString(handler->url().spec()); 96 handlerValue->AppendString(handler->url().spec());
95 handlerValue->AppendString(handler->url().host()); 97 handlerValue->AppendString(handler->url().host());
96 handler_list->Append(handlerValue); 98 handler_list->Append(std::move(handlerValue));
97 } 99 }
98 } 100 }
99 101
100 void HandlerOptionsHandler::GetHandlersForProtocol( 102 void HandlerOptionsHandler::GetHandlersForProtocol(
101 const std::string& protocol, 103 const std::string& protocol,
102 base::DictionaryValue* handlers_value) { 104 base::DictionaryValue* handlers_value) {
103 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); 105 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry();
104 // The items which are to be written into |handlers_value| are also described 106 // The items which are to be written into |handlers_value| are also described
105 // in chrome/browser/resources/options/handler_options.js in @typedef 107 // in chrome/browser/resources/options/handler_options.js in @typedef
106 // for Handlers. Please update them whenever you add or remove any keys here. 108 // for Handlers. Please update them whenever you add or remove any keys here.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 int type, 214 int type,
213 const content::NotificationSource& source, 215 const content::NotificationSource& source,
214 const content::NotificationDetails& details) { 216 const content::NotificationDetails& details) {
215 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) 217 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED)
216 UpdateHandlerList(); 218 UpdateHandlerList();
217 else 219 else
218 NOTREACHED(); 220 NOTREACHED();
219 } 221 }
220 222
221 } // namespace options 223 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/font_settings_handler.cc ('k') | chrome/browser/ui/webui/options/import_data_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698