| Index: third_party/WebKit/Source/core/frame/NavigatorClipboard.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/NavigatorClipboard.cpp b/third_party/WebKit/Source/core/frame/NavigatorClipboard.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7743a81881ccf2e84023b497c8d4553409febe26
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/frame/NavigatorClipboard.cpp
|
| @@ -0,0 +1,44 @@
|
| +// 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 "core/frame/NavigatorClipboard.h"
|
| +
|
| +#include "core/clipboard/Clipboard.h"
|
| +#include "core/dom/Document.h"
|
| +#include "core/frame/LocalFrame.h"
|
| +
|
| +namespace blink {
|
| +
|
| +Clipboard* NavigatorClipboard::clipboard(ScriptState* scriptState,
|
| + Navigator& navigator) {
|
| + NavigatorClipboard* supplement = static_cast<NavigatorClipboard*>(
|
| + Supplement<Navigator>::from(navigator, supplementName()));
|
| + if (!supplement) {
|
| + supplement = new NavigatorClipboard(navigator);
|
| + provideTo(navigator, supplementName(), supplement);
|
| + }
|
| +
|
| + if (!supplement->m_clipboard) {
|
| + supplement->m_clipboard =
|
| + new Clipboard(supplement->supplementable()->frame()
|
| + ? supplement->supplementable()->frame()->document()
|
| + : nullptr);
|
| + }
|
| +
|
| + return supplement->m_clipboard;
|
| +}
|
| +
|
| +DEFINE_TRACE(NavigatorClipboard) {
|
| + visitor->trace(m_clipboard);
|
| + Supplement<Navigator>::trace(visitor);
|
| +}
|
| +
|
| +NavigatorClipboard::NavigatorClipboard(Navigator& navigator)
|
| + : Supplement<Navigator>(navigator) {}
|
| +
|
| +const char* NavigatorClipboard::supplementName() {
|
| + return "NavigatorClipboard";
|
| +}
|
| +
|
| +} // namespace blink
|
|
|