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

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

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: No ListValue::SetDouble Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_util.cc ('k') | chrome/browser/ui/webui/flags_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
14 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
17 #include "base/task_scheduler/post_task.h" 19 #include "base/task_scheduler/post_task.h"
20 #include "base/values.h"
18 #include "chrome/browser/extensions/path_util.h" 21 #include "chrome/browser/extensions/path_util.h"
19 #include "chrome/browser/extensions/unpacked_installer.h" 22 #include "chrome/browser/extensions/unpacked_installer.h"
20 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/grit/generated_resources.h" 24 #include "chrome/grit/generated_resources.h"
22 #include "content/public/browser/navigation_handle.h" 25 #include "content/public/browser/navigation_handle.h"
23 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_ui.h" 27 #include "content/public/browser/web_ui.h"
25 #include "content/public/browser/web_ui_data_source.h" 28 #include "content/public/browser/web_ui_data_source.h"
26 #include "extensions/browser/extension_system.h" 29 #include "extensions/browser/extension_system.h"
27 #include "extensions/browser/file_highlighter.h" 30 #include "extensions/browser/file_highlighter.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 base::FilePath prettified_path = path_util::PrettifyPath(file_path); 201 base::FilePath prettified_path = path_util::PrettifyPath(file_path);
199 202
200 std::unique_ptr<base::DictionaryValue> manifest_value( 203 std::unique_ptr<base::DictionaryValue> manifest_value(
201 new base::DictionaryValue()); 204 new base::DictionaryValue());
202 SourceHighlighter highlighter(manifest, line_number); 205 SourceHighlighter highlighter(manifest, line_number);
203 // If the line number is 0, this highlights no regions, but still adds the 206 // If the line number is 0, this highlights no regions, but still adds the
204 // full manifest. 207 // full manifest.
205 highlighter.SetHighlightedRegions(manifest_value.get()); 208 highlighter.SetHighlightedRegions(manifest_value.get());
206 209
207 std::unique_ptr<base::DictionaryValue> failure(new base::DictionaryValue()); 210 std::unique_ptr<base::DictionaryValue> failure(new base::DictionaryValue());
208 failure->Set("path", new base::Value(prettified_path.LossyDisplayName())); 211 failure->SetString("path", prettified_path.LossyDisplayName());
209 failure->Set("error", new base::Value(base::UTF8ToUTF16(error))); 212 failure->SetString("error", error);
210 failure->Set("manifest", manifest_value.release()); 213 failure->Set("manifest", std::move(manifest_value));
211 failures_.Append(std::move(failure)); 214 failures_.Append(std::move(failure));
212 215
213 // Only notify the frontend if the frontend UI is ready. 216 // Only notify the frontend if the frontend UI is ready.
214 if (ui_ready_) 217 if (ui_ready_)
215 NotifyFrontendOfFailure(); 218 NotifyFrontendOfFailure();
216 } 219 }
217 220
218 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { 221 void ExtensionLoaderHandler::NotifyFrontendOfFailure() {
219 web_ui()->CallJavascriptFunctionUnsafe( 222 web_ui()->CallJavascriptFunctionUnsafe(
220 "extensions.ExtensionLoader.notifyLoadFailed", failures_); 223 "extensions.ExtensionLoader.notifyLoadFailed", failures_);
221 failures_.Clear(); 224 failures_.Clear();
222 } 225 }
223 226
224 } // namespace extensions 227 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_util.cc ('k') | chrome/browser/ui/webui/flags_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698