Index: third_party/WebKit/Source/modules/webauth/NavigatorAuth.cpp |
diff --git a/third_party/WebKit/Source/modules/webauth/NavigatorAuth.cpp b/third_party/WebKit/Source/modules/webauth/NavigatorAuth.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e0146a32ea641365228ea0a06b4b54bccb3bbdcd |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/webauth/NavigatorAuth.cpp |
@@ -0,0 +1,44 @@ |
+// 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/webauth/NavigatorAuth.h" |
+ |
+#include "core/frame/Navigator.h" |
+#include "modules/webauth/WebAuthentication.h" |
+ |
+namespace blink { |
+ |
+NavigatorAuth& NavigatorAuth::from(Navigator& navigator) { |
+ NavigatorAuth* supplement = static_cast<NavigatorAuth*>( |
+ Supplement<Navigator>::from(navigator, supplementName())); |
+ if (!supplement) { |
+ supplement = new NavigatorAuth(navigator); |
+ provideTo(navigator, supplementName(), supplement); |
+ } |
+ return *supplement; |
+} |
+ |
+WebAuthentication* NavigatorAuth::authentication(Navigator& navigator) { |
+ return NavigatorAuth::from(navigator).authentication(); |
+} |
+ |
+WebAuthentication* NavigatorAuth::authentication() { |
+ return m_webauthentication; |
+} |
+ |
+DEFINE_TRACE(NavigatorAuth) { |
+ visitor->trace(m_webauthentication); |
+ Supplement<Navigator>::trace(visitor); |
+} |
+ |
+NavigatorAuth::NavigatorAuth(Navigator& navigator) { |
+ if (navigator.frame()) |
+ m_webauthentication = WebAuthentication::create(*navigator.frame()); |
+} |
+ |
+const char* NavigatorAuth::supplementName() { |
+ return "NavigatorAuth"; |
+} |
+ |
+} // namespace blink |