| 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/values.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 12 | 14 |
| 13 namespace extensions { | 15 namespace extensions { |
| 14 | 16 |
| 15 ExtensionPrefs* ExtensionSetUpdateUrlDataFunction::extension_prefs() { | 17 namespace extension { |
| 16 return profile()->GetExtensionService()->extension_prefs(); | 18 const char kUpdateURLData[] = "update_url_data"; |
| 17 } | 19 } |
| 18 | 20 |
| 19 bool ExtensionSetUpdateUrlDataFunction::RunImpl() { | 21 bool ExtensionSetUpdateUrlDataFunction::RunImpl() { |
| 20 std::string data; | 22 std::string data; |
| 21 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data)); | 23 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data)); |
| 22 | 24 |
| 23 extension_prefs()->SetUpdateUrlData(extension_id(), data); | 25 ExtensionSystem::Get(profile())->extension_prefs()->UpdateExtensionPref( |
| 26 extension_id(), |
| 27 extension::kUpdateURLData, |
| 28 base::Value::CreateStringValue(data)); |
| 24 return true; | 29 return true; |
| 25 } | 30 } |
| 26 | 31 |
| 27 bool ExtensionIsAllowedIncognitoAccessFunction::RunImpl() { | 32 bool ExtensionIsAllowedIncognitoAccessFunction::RunImpl() { |
| 28 ExtensionService* ext_service = profile()->GetExtensionService(); | 33 ExtensionService* ext_service = |
| 34 ExtensionSystem::Get(profile())->extension_service(); |
| 29 const Extension* extension = GetExtension(); | 35 const Extension* extension = GetExtension(); |
| 30 | 36 |
| 31 SetResult(Value::CreateBooleanValue( | 37 SetResult(Value::CreateBooleanValue( |
| 32 ext_service->IsIncognitoEnabled(extension->id()))); | 38 ext_service->IsIncognitoEnabled(extension->id()))); |
| 33 return true; | 39 return true; |
| 34 } | 40 } |
| 35 | 41 |
| 36 bool ExtensionIsAllowedFileSchemeAccessFunction::RunImpl() { | 42 bool ExtensionIsAllowedFileSchemeAccessFunction::RunImpl() { |
| 37 ExtensionService* ext_service = profile()->GetExtensionService(); | 43 ExtensionService* ext_service = |
| 44 ExtensionSystem::Get(profile())->extension_service(); |
| 38 const Extension* extension = GetExtension(); | 45 const Extension* extension = GetExtension(); |
| 39 | 46 |
| 40 SetResult(Value::CreateBooleanValue( | 47 SetResult(Value::CreateBooleanValue( |
| 41 ext_service->AllowFileAccess(extension))); | 48 ext_service->AllowFileAccess(extension))); |
| 42 return true; | 49 return true; |
| 43 } | 50 } |
| 44 | 51 |
| 45 } // namespace extensions | 52 } // namespace extensions |
| OLD | NEW |