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::blink::CopylessPasteRequest request) { |
| 18 DCHECK(frame); |
| 19 |
| 20 mojo::MakeStrongBinding(WTF::wrapUnique(new CopylessPasteServer(*frame)), |
| 21 std::move(request)); |
| 22 } |
| 23 |
| 24 void CopylessPasteServer::GetEntities(const GetEntitiesCallback& callback) { |
| 25 if (!m_frame || !m_frame->document()) { |
| 26 callback.Run(mojom::blink::WebPage::New()); |
| 27 return; |
| 28 } |
| 29 mojom::blink::WebPagePtr webpage = mojom::blink::WebPage::New(); |
| 30 // TODO(wychen): connect with CopylessPasteExtractor::extract() like: |
| 31 // CopylessPasteExtractor::extract(*m_frame->document(), webpage); |
| 32 callback.Run(std::move(webpage)); |
| 33 } |
| 34 |
| 35 } // namespace blink |
OLD | NEW |