Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/core/frame/NavigatorClipboard.cpp

Issue 2695593006: Initial stub version of Async Clipboard API (Closed)
Patch Set: Address review comments; improve tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "core/frame/NavigatorClipboard.h"
6
7 #include "core/clipboard/Clipboard.h"
8 #include "core/dom/Document.h"
9 #include "core/frame/LocalFrame.h"
10
11 namespace blink {
12
13 Clipboard* NavigatorClipboard::clipboard(ScriptState* scriptState,
14 Navigator& navigator) {
15 NavigatorClipboard* supplement = static_cast<NavigatorClipboard*>(
16 Supplement<Navigator>::From(navigator, SupplementName()));
17 if (!supplement) {
18 supplement = new NavigatorClipboard(navigator);
19 ProvideTo(navigator, SupplementName(), supplement);
20 }
21
22 if (!supplement->m_clipboard) {
dcheng 2017/06/06 23:33:38 Nit: let's just have NavigatorClipboard construct
garykac 2017/06/09 20:38:59 Done.
23 supplement->m_clipboard = new Clipboard(
24 supplement->GetSupplementable()->GetFrame()
25 ? supplement->GetSupplementable()->GetFrame()->GetDocument()
26 : nullptr);
27 }
28
29 return supplement->m_clipboard;
30 }
31
32 DEFINE_TRACE(NavigatorClipboard) {
33 visitor->Trace(m_clipboard);
34 Supplement<Navigator>::Trace(visitor);
35 }
36
37 NavigatorClipboard::NavigatorClipboard(Navigator& navigator)
38 : Supplement<Navigator>(navigator) {}
39
40 const char* NavigatorClipboard::SupplementName() {
41 return "NavigatorClipboard";
42 }
43
44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698