OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/settings_private/settings_private_api.h" | 5 #include "chrome/browser/extensions/api/settings_private/settings_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 std::unique_ptr<api::settings_private::GetPref::Params> parameters = | 92 std::unique_ptr<api::settings_private::GetPref::Params> parameters = |
93 api::settings_private::GetPref::Params::Create(*args_); | 93 api::settings_private::GetPref::Params::Create(*args_); |
94 EXTENSION_FUNCTION_VALIDATE(parameters.get()); | 94 EXTENSION_FUNCTION_VALIDATE(parameters.get()); |
95 | 95 |
96 SettingsPrivateDelegate* delegate = | 96 SettingsPrivateDelegate* delegate = |
97 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); | 97 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
98 if (delegate == nullptr) | 98 if (delegate == nullptr) |
99 return RespondNow(Error(kDelegateIsNull)); | 99 return RespondNow(Error(kDelegateIsNull)); |
100 | 100 |
101 std::unique_ptr<base::Value> value = delegate->GetPref(parameters->name); | 101 std::unique_ptr<base::Value> value = delegate->GetPref(parameters->name); |
102 if (value->IsType(base::Value::TYPE_NULL)) | 102 if (value->IsType(base::Value::Type::NONE)) |
103 return RespondNow(Error("Pref * does not exist", parameters->name)); | 103 return RespondNow(Error("Pref * does not exist", parameters->name)); |
104 else | 104 else |
105 return RespondNow(OneArgument(std::move(value))); | 105 return RespondNow(OneArgument(std::move(value))); |
106 } | 106 } |
107 | 107 |
108 //////////////////////////////////////////////////////////////////////////////// | 108 //////////////////////////////////////////////////////////////////////////////// |
109 // SettingsPrivateGetDefaultZoomFunction | 109 // SettingsPrivateGetDefaultZoomFunction |
110 //////////////////////////////////////////////////////////////////////////////// | 110 //////////////////////////////////////////////////////////////////////////////// |
111 | 111 |
112 SettingsPrivateGetDefaultZoomFunction:: | 112 SettingsPrivateGetDefaultZoomFunction:: |
(...skipping 29 matching lines...) Expand all Loading... |
142 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); | 142 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
143 if (delegate == nullptr) | 143 if (delegate == nullptr) |
144 return RespondNow(Error(kDelegateIsNull)); | 144 return RespondNow(Error(kDelegateIsNull)); |
145 | 145 |
146 delegate->SetDefaultZoom(parameters->zoom); | 146 delegate->SetDefaultZoom(parameters->zoom); |
147 return RespondNow( | 147 return RespondNow( |
148 OneArgument(base::MakeUnique<base::FundamentalValue>(true))); | 148 OneArgument(base::MakeUnique<base::FundamentalValue>(true))); |
149 } | 149 } |
150 | 150 |
151 } // namespace extensions | 151 } // namespace extensions |
OLD | NEW |