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

Side by Side Diff: chrome/browser/ui/webui/settings/on_startup_handler.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/on_startup_handler.h" 5 #include "chrome/browser/ui/webui/settings/on_startup_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/extensions/settings_api_helpers.h" 10 #include "chrome/browser/extensions/settings_api_helpers.h"
(...skipping 23 matching lines...) Expand all
34 const base::Value* callback_id; 34 const base::Value* callback_id;
35 CHECK(args->Get(0, &callback_id)); 35 CHECK(args->Get(0, &callback_id));
36 36
37 AllowJavascript(); 37 AllowJavascript();
38 38
39 Profile* profile = Profile::FromWebUI(web_ui()); 39 Profile* profile = Profile::FromWebUI(web_ui());
40 const extensions::Extension* ntp_extension = 40 const extensions::Extension* ntp_extension =
41 extensions::GetExtensionOverridingNewTabPage(profile); 41 extensions::GetExtensionOverridingNewTabPage(profile);
42 42
43 if (!ntp_extension) { 43 if (!ntp_extension) {
44 ResolveJavascriptCallback(*callback_id, *base::Value::CreateNullValue()); 44 ResolveJavascriptCallback(*callback_id, base::Value());
45 return; 45 return;
46 } 46 }
47 47
48 base::DictionaryValue dict; 48 base::DictionaryValue dict;
49 dict.SetString("id", ntp_extension->id()); 49 dict.SetString("id", ntp_extension->id());
50 dict.SetString("name", ntp_extension->name()); 50 dict.SetString("name", ntp_extension->name());
51 dict.SetBoolean("canBeDisabled", 51 dict.SetBoolean("canBeDisabled",
52 !extensions::ExtensionSystem::Get(profile) 52 !extensions::ExtensionSystem::Get(profile)
53 ->management_policy() 53 ->management_policy()
54 ->MustRemainEnabled(ntp_extension, nullptr)); 54 ->MustRemainEnabled(ntp_extension, nullptr));
55 ResolveJavascriptCallback(*callback_id, dict); 55 ResolveJavascriptCallback(*callback_id, dict);
56 } 56 }
57 57
58 void OnStartupHandler::HandleValidateStartupPage(const base::ListValue* args) { 58 void OnStartupHandler::HandleValidateStartupPage(const base::ListValue* args) {
59 AllowJavascript(); 59 AllowJavascript();
60 60
61 CHECK_EQ(args->GetSize(), 2U); 61 CHECK_EQ(args->GetSize(), 2U);
62 62
63 const base::Value* callback_id; 63 const base::Value* callback_id;
64 CHECK(args->Get(0, &callback_id)); 64 CHECK(args->Get(0, &callback_id));
65 65
66 std::string url_string; 66 std::string url_string;
67 CHECK(args->GetString(1, &url_string)); 67 CHECK(args->GetString(1, &url_string));
68 68
69 bool valid = settings_utils::FixupAndValidateStartupPage(url_string, nullptr); 69 bool valid = settings_utils::FixupAndValidateStartupPage(url_string, nullptr);
70 ResolveJavascriptCallback(*callback_id, base::Value(valid)); 70 ResolveJavascriptCallback(*callback_id, base::Value(valid));
71 } 71 }
72 72
73 } // namespace settings 73 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/certificates_handler.cc ('k') | chrome/browser/ui/webui/settings/reset_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698