| Index: third_party/WebKit/Source/modules/extensions/WindowChrome.cpp
|
| diff --git a/third_party/WebKit/Source/modules/extensions/WindowChrome.cpp b/third_party/WebKit/Source/modules/extensions/WindowChrome.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5e6e33ef5c124378a62ae7e0c66a09f7929605b1
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/extensions/WindowChrome.cpp
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2016 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/extensions/WindowChrome.h"
|
| +
|
| +#include "core/frame/LocalDOMWindow.h"
|
| +#include "core/frame/LocalFrame.h"
|
| +#include "modules/extensions/Chrome.h"
|
| +
|
| +namespace blink {
|
| +
|
| +WindowChrome::WindowChrome(LocalDOMWindow& window)
|
| + : DOMWindowProperty(window.frame())
|
| +{
|
| +}
|
| +
|
| +const char* WindowChrome::supplementName()
|
| +{
|
| + return "WindowChrome";
|
| +}
|
| +
|
| +// static
|
| +WindowChrome& WindowChrome::from(LocalDOMWindow& window)
|
| +{
|
| + WindowChrome* supplement = static_cast<WindowChrome*>(Supplement<LocalDOMWindow>::from(window, supplementName()));
|
| + if (!supplement) {
|
| + supplement = new WindowChrome(window);
|
| + provideTo(window, supplementName(), supplement);
|
| + }
|
| + return *supplement;
|
| +}
|
| +
|
| +// static
|
| +Chrome* WindowChrome::chromex(DOMWindow& window)
|
| +{
|
| + return from(toLocalDOMWindow(window)).chromex();
|
| +}
|
| +
|
| +Chrome* WindowChrome::chromex() const
|
| +{
|
| + if (!m_chrome && frame())
|
| + m_chrome = Chrome::create(frame());
|
| + return m_chrome.get();
|
| +}
|
| +
|
| +DEFINE_TRACE(WindowChrome)
|
| +{
|
| + visitor->trace(m_chrome);
|
| + Supplement<LocalDOMWindow>::trace(visitor);
|
| + DOMWindowProperty::trace(visitor);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|