Chromium Code Reviews| Index: third_party/WebKit/Source/modules/document_metadata/CopylessPasteServer.cpp |
| diff --git a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteServer.cpp b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteServer.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..deeb1056c9d5bfce0b5a85d10fef269f3eafdcb7 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteServer.cpp |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "modules/document_metadata/CopylessPasteServer.h" |
| + |
| +#include "core/frame/LocalFrame.h" |
| +#include "modules/document_metadata/CopylessPasteExtractor.h" |
| +#include "mojo/public/cpp/bindings/strong_binding.h" |
| + |
| +namespace blink { |
| + |
| +CopylessPasteServer::CopylessPasteServer(LocalFrame& frame) : m_frame(frame) {} |
| + |
| +void CopylessPasteServer::bindMojoRequest( |
|
haraken
2017/03/31 04:20:09
Would you help me understand why you adopted the b
wychen
2017/03/31 07:51:54
For all the visited pages, we want to collect some
haraken
2017/04/04 06:27:57
Makes sense.
|
| + LocalFrame* frame, |
| + mojom::blink::CopylessPasteRequest request) { |
| + DCHECK(frame); |
| + |
| + mojo::MakeStrongBinding(WTF::makeUnique<CopylessPasteServer>(*frame), |
| + std::move(request)); |
| +} |
| + |
| +void CopylessPasteServer::GetEntities(const GetEntitiesCallback& callback) { |
| + if (!m_frame || !m_frame->document()) { |
|
haraken
2017/03/31 04:20:09
Instead of doing this, I'd prefer making CopylessP
wychen
2017/03/31 07:51:54
I'm still trying to figure out whether it makes mo
haraken
2017/04/04 06:27:57
I'd prefer this CL.
Here I'm just asking making C
wychen
2017/04/05 19:25:50
I gave it a try using ContextClient, but it seems
|
| + callback.Run(mojom::blink::WebPage::New()); |
| + return; |
| + } |
| + mojom::blink::WebPagePtr webpage = mojom::blink::WebPage::New(); |
| + // TODO(wychen): connect with CopylessPasteExtractor::extract() like: |
| + // CopylessPasteExtractor::extract(*m_frame->document(), webpage); |
| + callback.Run(std::move(webpage)); |
| +} |
| + |
| +} // namespace blink |