| 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> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "extensions/common/api/display_source.h" | 11 #include "extensions/common/api/display_source.h" |
| 11 #include "extensions/renderer/api/display_source/display_source_session.h" | 12 #include "extensions/renderer/api/display_source/display_source_session.h" |
| 12 #include "extensions/renderer/object_backed_native_handler.h" | 13 #include "extensions/renderer/object_backed_native_handler.h" |
| 13 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 14 | 15 |
| 15 namespace extensions { | 16 namespace extensions { |
| 16 class ScriptContext; | 17 class ScriptContext; |
| 17 | 18 |
| 18 // Implements custom bindings for the displaySource API. | 19 // Implements custom bindings for the displaySource API. |
| 19 class DisplaySourceCustomBindings : public ObjectBackedNativeHandler { | 20 class DisplaySourceCustomBindings : public ObjectBackedNativeHandler { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 const std::string& message) const; | 46 const std::string& message) const; |
| 46 | 47 |
| 47 // DisplaySession notification callbacks. | 48 // DisplaySession notification callbacks. |
| 48 void OnSessionTerminated(int sink_id); | 49 void OnSessionTerminated(int sink_id); |
| 49 void OnSessionError(int sink_id, | 50 void OnSessionError(int sink_id, |
| 50 DisplaySourceErrorType type, | 51 DisplaySourceErrorType type, |
| 51 const std::string& message); | 52 const std::string& message); |
| 52 | 53 |
| 53 DisplaySourceSession* GetDisplaySession(int sink_id) const; | 54 DisplaySourceSession* GetDisplaySession(int sink_id) const; |
| 54 | 55 |
| 55 std::map<int, scoped_ptr<DisplaySourceSession>> session_map_; | 56 std::map<int, std::unique_ptr<DisplaySourceSession>> session_map_; |
| 56 base::WeakPtrFactory<DisplaySourceCustomBindings> weak_factory_; | 57 base::WeakPtrFactory<DisplaySourceCustomBindings> weak_factory_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(DisplaySourceCustomBindings); | 59 DISALLOW_COPY_AND_ASSIGN(DisplaySourceCustomBindings); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // extensions | 62 } // extensions |
| 62 | 63 |
| 63 #endif // EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ | 64 #endif // EXTENSIONS_RENDERER_DISPLAY_SOURCE_CUSTOM_BINDINGS_H_ |
| OLD | NEW |