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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.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 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 "chrome/browser/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/base64.h" 11 #include "base/base64.h"
11 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
12 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
13 #include "base/json/string_escape.h" 14 #include "base/json/string_escape.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 extensions::ExtensionRegistry::Get(profile_->GetOriginalProfile()); 1001 extensions::ExtensionRegistry::Get(profile_->GetOriginalProfile());
1001 if (!registry) 1002 if (!registry)
1002 return; 1003 return;
1003 1004
1004 base::ListValue results; 1005 base::ListValue results;
1005 for (const scoped_refptr<const extensions::Extension>& extension : 1006 for (const scoped_refptr<const extensions::Extension>& extension :
1006 registry->enabled_extensions()) { 1007 registry->enabled_extensions()) {
1007 if (extensions::chrome_manifest_urls::GetDevToolsPage(extension.get()) 1008 if (extensions::chrome_manifest_urls::GetDevToolsPage(extension.get())
1008 .is_empty()) 1009 .is_empty())
1009 continue; 1010 continue;
1010 base::DictionaryValue* extension_info = new base::DictionaryValue(); 1011 std::unique_ptr<base::DictionaryValue> extension_info(
1012 new base::DictionaryValue());
1011 extension_info->Set( 1013 extension_info->Set(
1012 "startPage", 1014 "startPage",
1013 new base::StringValue(extensions::chrome_manifest_urls::GetDevToolsPage( 1015 new base::StringValue(extensions::chrome_manifest_urls::GetDevToolsPage(
1014 extension.get()).spec())); 1016 extension.get()).spec()));
1015 extension_info->Set("name", new base::StringValue(extension->name())); 1017 extension_info->Set("name", new base::StringValue(extension->name()));
1016 extension_info->Set("exposeExperimentalAPIs", 1018 extension_info->Set("exposeExperimentalAPIs",
1017 new base::FundamentalValue( 1019 new base::FundamentalValue(
1018 extension->permissions_data()->HasAPIPermission( 1020 extension->permissions_data()->HasAPIPermission(
1019 extensions::APIPermission::kExperimental))); 1021 extensions::APIPermission::kExperimental)));
1020 results.Append(extension_info); 1022 results.Append(std::move(extension_info));
1021 } 1023 }
1022 CallClientFunction("DevToolsAPI.addExtensions", 1024 CallClientFunction("DevToolsAPI.addExtensions",
1023 &results, NULL, NULL); 1025 &results, NULL, NULL);
1024 } 1026 }
1025 1027
1026 void DevToolsUIBindings::SetDelegate(Delegate* delegate) { 1028 void DevToolsUIBindings::SetDelegate(Delegate* delegate) {
1027 delegate_.reset(delegate); 1029 delegate_.reset(delegate);
1028 } 1030 }
1029 1031
1030 void DevToolsUIBindings::AttachTo( 1032 void DevToolsUIBindings::AttachTo(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 void DevToolsUIBindings::FrontendLoaded() { 1101 void DevToolsUIBindings::FrontendLoaded() {
1100 if (frontend_loaded_) 1102 if (frontend_loaded_)
1101 return; 1103 return;
1102 frontend_loaded_ = true; 1104 frontend_loaded_ = true;
1103 1105
1104 // Call delegate first - it seeds importants bit of information. 1106 // Call delegate first - it seeds importants bit of information.
1105 delegate_->OnLoadCompleted(); 1107 delegate_->OnLoadCompleted();
1106 1108
1107 AddDevToolsExtensionsToClient(); 1109 AddDevToolsExtensionsToClient();
1108 } 1110 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_targets_ui.cc ('k') | chrome/browser/extensions/api/autotest_private/autotest_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698