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)), | |
dcheng
2017/03/30 21:21:00
Nit: WTF::makeUnique?
wychen
2017/03/31 07:51:54
Done.
| |
21 std::move(request)); | |
22 } | |
23 | |
24 void CopylessPasteServer::GetEntities(const GetEntitiesCallback& callback) { | |
dcheng
2017/03/30 21:21:00
What's the expected lifetime of this service? Is i
wychen
2017/03/30 21:33:28
This service is stateless. When getting a request
wychen
2017/04/05 19:25:50
Most of the Mojo things in Blink are Mojo clients,
| |
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 |