Home | History | Annotate | Download | only in extensions
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/extensions/extension_module.h"
      6 
      7 #include <string>
      8 
      9 #include "chrome/browser/extensions/extension_prefs.h"
     10 #include "chrome/browser/extensions/extension_service.h"
     11 #include "chrome/browser/profiles/profile.h"
     12 
     13 ExtensionPrefs* SetUpdateUrlDataFunction::extension_prefs() {
     14   return profile()->GetExtensionService()->extension_prefs();
     15 }
     16 
     17 bool SetUpdateUrlDataFunction::RunImpl() {
     18   std::string data;
     19   EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data));
     20 
     21   extension_prefs()->SetUpdateUrlData(extension_id(), data);
     22   return true;
     23 }
     24 
     25 bool IsAllowedIncognitoAccessFunction::RunImpl() {
     26   ExtensionService* ext_service = profile()->GetExtensionService();
     27   const Extension* extension = GetExtension();
     28 
     29   result_.reset(Value::CreateBooleanValue(
     30       ext_service->IsIncognitoEnabled(extension->id())));
     31   return true;
     32 }
     33 
     34 bool IsAllowedFileSchemeAccessFunction::RunImpl() {
     35   ExtensionService* ext_service = profile()->GetExtensionService();
     36   const Extension* extension = GetExtension();
     37 
     38   result_.reset(Value::CreateBooleanValue(
     39         ext_service->AllowFileAccess(extension)));
     40   return true;
     41 }
     42