| 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 #ifndef EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ | 5 #ifndef EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ |
| 6 #define EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ | 6 #define EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "extensions/common/api/display_source.h" | 11 #include "extensions/common/api/display_source.h" |
| 12 #include "extensions/renderer/api/display_source/display_source_session.h" | 12 #include "extensions/renderer/api/display_source/display_source_session.h" |
| 13 #include "extensions/renderer/object_backed_native_handler.h" | 13 #include "extensions/renderer/object_backed_native_handler.h" |
| 14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 class ExtensionBindingsSystem; |
| 17 class ScriptContext; | 18 class ScriptContext; |
| 18 | 19 |
| 19 // Implements custom bindings for the displaySource API. | 20 // Implements custom bindings for the displaySource API. |
| 20 class DisplaySourceCustomBindings : public ObjectBackedNativeHandler { | 21 class DisplaySourceCustomBindings : public ObjectBackedNativeHandler { |
| 21 public: | 22 public: |
| 22 explicit DisplaySourceCustomBindings(ScriptContext* context); | 23 DisplaySourceCustomBindings(ScriptContext* context, |
| 24 ExtensionBindingsSystem* bindings_system); |
| 23 | 25 |
| 24 ~DisplaySourceCustomBindings() override; | 26 ~DisplaySourceCustomBindings() override; |
| 25 | 27 |
| 26 private: | 28 private: |
| 27 // ObjectBackedNativeHandler override. | 29 // ObjectBackedNativeHandler override. |
| 28 void Invalidate() override; | 30 void Invalidate() override; |
| 29 | 31 |
| 30 void StartSession( | 32 void StartSession( |
| 31 const v8::FunctionCallbackInfo<v8::Value>& args); | 33 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 32 void TerminateSession( | 34 void TerminateSession( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 47 | 49 |
| 48 // DisplaySession notification callbacks. | 50 // DisplaySession notification callbacks. |
| 49 void OnSessionTerminated(int sink_id); | 51 void OnSessionTerminated(int sink_id); |
| 50 void OnSessionError(int sink_id, | 52 void OnSessionError(int sink_id, |
| 51 DisplaySourceErrorType type, | 53 DisplaySourceErrorType type, |
| 52 const std::string& message); | 54 const std::string& message); |
| 53 | 55 |
| 54 DisplaySourceSession* GetDisplaySession(int sink_id) const; | 56 DisplaySourceSession* GetDisplaySession(int sink_id) const; |
| 55 | 57 |
| 56 std::map<int, std::unique_ptr<DisplaySourceSession>> session_map_; | 58 std::map<int, std::unique_ptr<DisplaySourceSession>> session_map_; |
| 59 |
| 60 ExtensionBindingsSystem* bindings_system_; |
| 61 |
| 57 base::WeakPtrFactory<DisplaySourceCustomBindings> weak_factory_; | 62 base::WeakPtrFactory<DisplaySourceCustomBindings> weak_factory_; |
| 58 | 63 |
| 59 DISALLOW_COPY_AND_ASSIGN(DisplaySourceCustomBindings); | 64 DISALLOW_COPY_AND_ASSIGN(DisplaySourceCustomBindings); |
| 60 }; | 65 }; |
| 61 | 66 |
| 62 } // extensions | 67 } // extensions |
| 63 | 68 |
| 64 #endif // EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ | 69 #endif // EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ |
| OLD | NEW |