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

Unified Diff: third_party/WebKit/Source/modules/extensions/WindowChrome.cpp

Issue 2074263002: [Experimental] Fool around with exposing extension bindings via blink Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698