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

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

Issue 2695593006: Initial stub version of Async Clipboard API (Closed)
Patch Set: Expected layout tests results for mac Created 3 years, 5 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* script_state,
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 return supplement->clipboard_;
23 }
24
25 DEFINE_TRACE(NavigatorClipboard) {
26 visitor->Trace(clipboard_);
27 Supplement<Navigator>::Trace(visitor);
28 }
29
30 NavigatorClipboard::NavigatorClipboard(Navigator& navigator)
31 : Supplement<Navigator>(navigator) {
32 clipboard_ =
33 new Clipboard(GetSupplementable()->GetFrame()
34 ? GetSupplementable()->GetFrame()->GetDocument()
35 : nullptr);
36 }
37
38 const char* NavigatorClipboard::SupplementName() {
39 return "NavigatorClipboard";
40 }
41
42 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/NavigatorClipboard.h ('k') | third_party/WebKit/Source/core/frame/NavigatorClipboard.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698