| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/module/module.h" | 5 #include "chrome/browser/extensions/api/module/module.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 std::string GetUpdateURLData(const ExtensionPrefs* prefs, | 31 std::string GetUpdateURLData(const ExtensionPrefs* prefs, |
| 32 const std::string& extension_id) { | 32 const std::string& extension_id) { |
| 33 std::string data; | 33 std::string data; |
| 34 prefs->ReadPrefAsString(extension_id, kUpdateURLData, &data); | 34 prefs->ReadPrefAsString(extension_id, kUpdateURLData, &data); |
| 35 return data; | 35 return data; |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace extension | 38 } // namespace extension |
| 39 | 39 |
| 40 bool ExtensionSetUpdateUrlDataFunction::RunSync() { | 40 ExtensionFunction::ResponseAction ExtensionSetUpdateUrlDataFunction::Run() { |
| 41 std::string data; | 41 std::string data; |
| 42 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data)); | 42 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data)); |
| 43 | 43 |
| 44 if (ManifestURL::UpdatesFromGallery(extension())) { | 44 if (ManifestURL::UpdatesFromGallery(extension())) { |
| 45 return false; | 45 return RespondNow(Error(kUnknownErrorDoNotUse)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ExtensionPrefs::Get(GetProfile())->UpdateExtensionPref( | 48 ExtensionPrefs::Get(browser_context()) |
| 49 extension_id(), extension::kUpdateURLData, new base::StringValue(data)); | 49 ->UpdateExtensionPref(extension_id(), extension::kUpdateURLData, |
| 50 return true; | 50 new base::StringValue(data)); |
| 51 return RespondNow(NoArguments()); |
| 51 } | 52 } |
| 52 | 53 |
| 53 bool ExtensionIsAllowedIncognitoAccessFunction::RunSync() { | 54 ExtensionFunction::ResponseAction |
| 54 SetResult(base::MakeUnique<base::FundamentalValue>( | 55 ExtensionIsAllowedIncognitoAccessFunction::Run() { |
| 55 util::IsIncognitoEnabled(extension_id(), GetProfile()))); | 56 return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>( |
| 56 return true; | 57 util::IsIncognitoEnabled(extension_id(), browser_context())))); |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool ExtensionIsAllowedFileSchemeAccessFunction::RunSync() { | 60 ExtensionFunction::ResponseAction |
| 60 SetResult(base::MakeUnique<base::FundamentalValue>( | 61 ExtensionIsAllowedFileSchemeAccessFunction::Run() { |
| 61 util::AllowFileAccess(extension_id(), GetProfile()))); | 62 return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>( |
| 62 return true; | 63 util::AllowFileAccess(extension_id(), browser_context())))); |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace extensions | 66 } // namespace extensions |
| OLD | NEW |