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

Side by Side Diff: chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser/ui/webui/sync_file_system_internals/extension_statuses_ handler.h" 5 #include "chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_ handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory>
9 #include <utility>
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/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sync_file_system/sync_file_system_service.h" 17 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
16 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" 18 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
17 #include "content/public/browser/web_ui.h" 19 #include "content/public/browser/web_ui.h"
(...skipping 22 matching lines...) Expand all
40 itr != status_map.end(); 42 itr != status_map.end();
41 ++itr) { 43 ++itr) {
42 std::string extension_id = itr->first.HostNoBrackets(); 44 std::string extension_id = itr->first.HostNoBrackets();
43 45
44 // Join with human readable extension name. 46 // Join with human readable extension name.
45 const extensions::Extension* extension = 47 const extensions::Extension* extension =
46 extension_service->GetExtensionById(extension_id, true); 48 extension_service->GetExtensionById(extension_id, true);
47 if (!extension) 49 if (!extension)
48 continue; 50 continue;
49 51
50 base::DictionaryValue* dict = new base::DictionaryValue; 52 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
51 dict->SetString("extensionID", extension_id); 53 dict->SetString("extensionID", extension_id);
52 dict->SetString("extensionName", extension->name()); 54 dict->SetString("extensionName", extension->name());
53 dict->SetString("status", itr->second); 55 dict->SetString("status", itr->second);
54 list.Append(dict); 56 list.Append(std::move(dict));
55 } 57 }
56 58
57 callback.Run(list); 59 callback.Run(list);
58 } 60 }
59 61
60 } // namespace 62 } // namespace
61 63
62 ExtensionStatusesHandler::ExtensionStatusesHandler(Profile* profile) 64 ExtensionStatusesHandler::ExtensionStatusesHandler(Profile* profile)
63 : profile_(profile), 65 : profile_(profile),
64 weak_ptr_factory_(this) {} 66 weak_ptr_factory_(this) {}
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 weak_ptr_factory_.GetWeakPtr())); 108 weak_ptr_factory_.GetWeakPtr()));
107 } 109 }
108 110
109 void ExtensionStatusesHandler::DidGetExtensionStatuses( 111 void ExtensionStatusesHandler::DidGetExtensionStatuses(
110 const base::ListValue& list) { 112 const base::ListValue& list) {
111 web_ui()->CallJavascriptFunctionUnsafe( 113 web_ui()->CallJavascriptFunctionUnsafe(
112 "ExtensionStatuses.onGetExtensionStatuses", list); 114 "ExtensionStatuses.onGetExtensionStatuses", list);
113 } 115 }
114 116
115 } // namespace syncfs_internals 117 } // namespace syncfs_internals
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698