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

Side by Side Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 "extensions/browser/api/runtime/runtime_api.h" 5 #include "extensions/browser/api/runtime/runtime_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP, 148 std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP,
149 runtime::OnStartup::kEventName, 149 runtime::OnStartup::kEventName,
150 std::move(event_args))); 150 std::move(event_args)));
151 EventRouter::Get(browser_context) 151 EventRouter::Get(browser_context)
152 ->DispatchEventToExtension(extension_id, std::move(event)); 152 ->DispatchEventToExtension(extension_id, std::move(event));
153 } 153 }
154 154
155 void SetUninstallURL(ExtensionPrefs* prefs, 155 void SetUninstallURL(ExtensionPrefs* prefs,
156 const std::string& extension_id, 156 const std::string& extension_id,
157 const std::string& url_string) { 157 const std::string& url_string) {
158 prefs->UpdateExtensionPref( 158 prefs->UpdateExtensionPref(extension_id, kUninstallUrl,
159 extension_id, kUninstallUrl, new base::StringValue(url_string)); 159 new base::Value(url_string));
160 } 160 }
161 161
162 std::string GetUninstallURL(ExtensionPrefs* prefs, 162 std::string GetUninstallURL(ExtensionPrefs* prefs,
163 const std::string& extension_id) { 163 const std::string& extension_id) {
164 std::string url_string; 164 std::string url_string;
165 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string); 165 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string);
166 return url_string; 166 return url_string;
167 } 167 }
168 168
169 } // namespace 169 } // namespace
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 return RespondNow(Error(kUpdatesDisabledError)); 694 return RespondNow(Error(kUpdatesDisabledError));
695 } 695 }
696 return RespondLater(); 696 return RespondLater();
697 } 697 }
698 698
699 void RuntimeRequestUpdateCheckFunction::CheckComplete( 699 void RuntimeRequestUpdateCheckFunction::CheckComplete(
700 const RuntimeAPIDelegate::UpdateCheckResult& result) { 700 const RuntimeAPIDelegate::UpdateCheckResult& result) {
701 if (result.success) { 701 if (result.success) {
702 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); 702 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue);
703 details->SetString("version", result.version); 703 details->SetString("version", result.version);
704 Respond(TwoArguments(base::MakeUnique<base::StringValue>(result.response), 704 Respond(TwoArguments(base::MakeUnique<base::Value>(result.response),
705 std::move(details))); 705 std::move(details)));
706 } else { 706 } else {
707 // HMM(kalman): Why does !success not imply Error()? 707 // HMM(kalman): Why does !success not imply Error()?
708 Respond(OneArgument(base::MakeUnique<base::StringValue>(result.response))); 708 Respond(OneArgument(base::MakeUnique<base::Value>(result.response)));
709 } 709 }
710 } 710 }
711 711
712 ExtensionFunction::ResponseAction RuntimeRestartFunction::Run() { 712 ExtensionFunction::ResponseAction RuntimeRestartFunction::Run() {
713 std::string message; 713 std::string message;
714 bool result = 714 bool result =
715 RuntimeAPI::GetFactoryInstance()->Get(browser_context())->RestartDevice( 715 RuntimeAPI::GetFactoryInstance()->Get(browser_context())->RestartDevice(
716 &message); 716 &message);
717 if (!result) { 717 if (!result) {
718 return RespondNow(Error(message)); 718 return RespondNow(Error(message));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 content::ChildProcessSecurityPolicy* policy = 781 content::ChildProcessSecurityPolicy* policy =
782 content::ChildProcessSecurityPolicy::GetInstance(); 782 content::ChildProcessSecurityPolicy::GetInstance();
783 policy->GrantReadFileSystem(renderer_id, filesystem_id); 783 policy->GrantReadFileSystem(renderer_id, filesystem_id);
784 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 784 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
785 dict->SetString("fileSystemId", filesystem_id); 785 dict->SetString("fileSystemId", filesystem_id);
786 dict->SetString("baseName", relative_path); 786 dict->SetString("baseName", relative_path);
787 return RespondNow(OneArgument(std::move(dict))); 787 return RespondNow(OneArgument(std::move(dict)));
788 } 788 }
789 789
790 } // namespace extensions 790 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698