OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/document_metadata/CopylessPasteServer.h" |
| 6 |
| 7 #include "core/frame/LocalFrame.h" |
| 8 #include "modules/document_metadata/CopylessPasteExtractor.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 CopylessPasteServer::CopylessPasteServer(LocalFrame& frame) : m_frame(frame) {} |
| 14 |
| 15 void CopylessPasteServer::bindMojoRequest( |
| 16 LocalFrame* frame, |
| 17 mojom::document_metadata::blink::CopylessPasteRequest request) { |
| 18 DCHECK(frame); |
| 19 |
| 20 // TODO(wychen): remove bindMojoRequest pattern, and make this a service |
| 21 // associated with frame lifetime. |
| 22 mojo::MakeStrongBinding(WTF::makeUnique<CopylessPasteServer>(*frame), |
| 23 std::move(request)); |
| 24 } |
| 25 |
| 26 void CopylessPasteServer::GetEntities(const GetEntitiesCallback& callback) { |
| 27 if (!m_frame || !m_frame->document()) { |
| 28 callback.Run(nullptr); |
| 29 return; |
| 30 } |
| 31 // TODO(wychen): connect with CopylessPasteExtractor::extract() like: |
| 32 // callback.Run(CopylessPasteExtractor::extract(*m_frame->document())); |
| 33 callback.Run(nullptr); |
| 34 } |
| 35 |
| 36 } // namespace blink |
OLD | NEW |