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 <utility> |
| 8 #include "core/frame/LocalFrame.h" |
| 9 #include "modules/document_metadata/CopylessPasteExtractor.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 CopylessPasteServer::CopylessPasteServer(LocalFrame& frame) : m_frame(frame) {} |
| 15 |
| 16 void CopylessPasteServer::bindMojoRequest( |
| 17 LocalFrame* frame, |
| 18 mojom::blink::CopylessPasteRequest request) { |
| 19 DCHECK(frame); |
| 20 |
| 21 mojo::MakeStrongBinding(WTF::wrapUnique(new CopylessPasteServer(*frame)), |
| 22 std::move(request)); |
| 23 } |
| 24 |
| 25 void CopylessPasteServer::GetEntities(const GetEntitiesCallback& callback) { |
| 26 if (!m_frame || !m_frame->document()) { |
| 27 callback.Run(mojom::blink::WebPage::New()); |
| 28 return; |
| 29 } |
| 30 mojom::blink::WebPagePtr webpage = mojom::blink::WebPage::New(); |
| 31 // TODO(wychen): connect with CopylessPasteExtractor::extract() like: |
| 32 // CopylessPasteExtractor::extract(*m_frame->document(), webpage); |
| 33 callback.Run(std::move(webpage)); |
| 34 } |
| 35 |
| 36 } // namespace blink |
OLD | NEW |