Chromium Code Reviews| 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 "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); | |
|
dcheng
2017/06/14 18:56:22
Btw, can we combine Clipboard and NavigatorClipboa
garykac
2017/06/29 01:37:26
We have 2 separate IDL files (Navigator supplement
dcheng1
2017/06/29 05:08:17
OK, that's a good reason =)
| |
| 36 } | |
| 37 | |
| 38 const char* NavigatorClipboard::SupplementName() { | |
| 39 return "NavigatorClipboard"; | |
| 40 } | |
| 41 | |
| 42 } // namespace blink | |
| OLD | NEW |