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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_loader_handler.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/ui/webui/extensions/extension_loader_handler.h" 5 #include "chrome/browser/ui/webui/extensions/extension_loader_handler.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/extensions/path_util.h" 17 #include "chrome/browser/extensions/path_util.h"
16 #include "chrome/browser/extensions/unpacked_installer.h" 18 #include "chrome/browser/extensions/unpacked_installer.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 SourceHighlighter highlighter(manifest, line_number); 193 SourceHighlighter highlighter(manifest, line_number);
192 // If the line number is 0, this highlights no regions, but still adds the 194 // If the line number is 0, this highlights no regions, but still adds the
193 // full manifest. 195 // full manifest.
194 highlighter.SetHighlightedRegions(manifest_value.get()); 196 highlighter.SetHighlightedRegions(manifest_value.get());
195 197
196 std::unique_ptr<base::DictionaryValue> failure(new base::DictionaryValue()); 198 std::unique_ptr<base::DictionaryValue> failure(new base::DictionaryValue());
197 failure->Set("path", 199 failure->Set("path",
198 new base::StringValue(prettified_path.LossyDisplayName())); 200 new base::StringValue(prettified_path.LossyDisplayName()));
199 failure->Set("error", new base::StringValue(base::UTF8ToUTF16(error))); 201 failure->Set("error", new base::StringValue(base::UTF8ToUTF16(error)));
200 failure->Set("manifest", manifest_value.release()); 202 failure->Set("manifest", manifest_value.release());
201 failures_.Append(failure.release()); 203 failures_.Append(std::move(failure));
202 204
203 // Only notify the frontend if the frontend UI is ready. 205 // Only notify the frontend if the frontend UI is ready.
204 if (ui_ready_) 206 if (ui_ready_)
205 NotifyFrontendOfFailure(); 207 NotifyFrontendOfFailure();
206 } 208 }
207 209
208 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { 210 void ExtensionLoaderHandler::NotifyFrontendOfFailure() {
209 web_ui()->CallJavascriptFunctionUnsafe( 211 web_ui()->CallJavascriptFunctionUnsafe(
210 "extensions.ExtensionLoader.notifyLoadFailed", failures_); 212 "extensions.ExtensionLoader.notifyLoadFailed", failures_);
211 failures_.Clear(); 213 failures_.Clear();
212 } 214 }
213 215
214 } // namespace extensions 216 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698