| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef EXTENSIONS_RENDERER_STORAGE_AREA_H_ | 5 #ifndef EXTENSIONS_RENDERER_STORAGE_AREA_H_ |
| 6 #define EXTENSIONS_RENDERER_STORAGE_AREA_H_ | 6 #define EXTENSIONS_RENDERER_STORAGE_AREA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class ListValue; | 15 class ListValue; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace gin { | 18 namespace gin { |
| 19 class Arguments; | 19 class Arguments; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 class APIEventHandler; | 23 class APIEventHandler; |
| 24 class APIRequestHandler; | 24 class APIRequestHandler; |
| 25 class APITypeReferenceMap; | 25 class APITypeReferenceMap; |
| 26 class BindingAccessChecker; |
| 26 | 27 |
| 27 // Implementation of the storage.StorageArea custom type used in the | 28 // Implementation of the storage.StorageArea custom type used in the |
| 28 // chrome.storage API. | 29 // chrome.storage API. |
| 29 class StorageArea { | 30 class StorageArea { |
| 30 public: | 31 public: |
| 31 StorageArea(APIRequestHandler* request_handler, | 32 StorageArea(APIRequestHandler* request_handler, |
| 32 const APITypeReferenceMap* type_refs, | 33 const APITypeReferenceMap* type_refs, |
| 33 const std::string& name); | 34 const std::string& name, |
| 35 const BindingAccessChecker* access_checker); |
| 34 ~StorageArea(); | 36 ~StorageArea(); |
| 35 | 37 |
| 36 // Creates a StorageArea object for the given context and property name. | 38 // Creates a StorageArea object for the given context and property name. |
| 37 static v8::Local<v8::Object> CreateStorageArea( | 39 static v8::Local<v8::Object> CreateStorageArea( |
| 38 v8::Isolate* isolate, | 40 v8::Isolate* isolate, |
| 39 const std::string& property_name, | 41 const std::string& property_name, |
| 40 const base::ListValue* property_values, | 42 const base::ListValue* property_values, |
| 41 APIRequestHandler* request_handler, | 43 APIRequestHandler* request_handler, |
| 42 APIEventHandler* event_handler, | 44 APIEventHandler* event_handler, |
| 43 APITypeReferenceMap* type_refs); | 45 APITypeReferenceMap* type_refs, |
| 46 const BindingAccessChecker* access_checker); |
| 44 | 47 |
| 45 void HandleFunctionCall(const std::string& method_name, | 48 void HandleFunctionCall(const std::string& method_name, |
| 46 gin::Arguments* arguments); | 49 gin::Arguments* arguments); |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 APIRequestHandler* request_handler_; | 52 APIRequestHandler* request_handler_; |
| 50 | 53 |
| 51 const APITypeReferenceMap* type_refs_; | 54 const APITypeReferenceMap* type_refs_; |
| 52 | 55 |
| 53 std::string name_; | 56 std::string name_; |
| 54 | 57 |
| 58 const BindingAccessChecker* const access_checker_; |
| 59 |
| 55 DISALLOW_COPY_AND_ASSIGN(StorageArea); | 60 DISALLOW_COPY_AND_ASSIGN(StorageArea); |
| 56 }; | 61 }; |
| 57 | 62 |
| 58 } // namespace extensions | 63 } // namespace extensions |
| 59 | 64 |
| 60 #endif // EXTENSIONS_RENDERER_STORAGE_AREA_H_ | 65 #endif // EXTENSIONS_RENDERER_STORAGE_AREA_H_ |
| OLD | NEW |