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

Side by Side Diff: third_party/WebKit/Source/modules/credentialmanager/NavigatorCredentials.cpp

Issue 2596443005: Replace DOMWindowProperty in Navigator supplements with ContextClient (Closed)
Patch Set: Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/credentialmanager/NavigatorCredentials.h" 5 #include "modules/credentialmanager/NavigatorCredentials.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalDOMWindow.h" 8 #include "core/frame/LocalDOMWindow.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Navigator.h" 10 #include "core/frame/Navigator.h"
11 #include "modules/credentialmanager/CredentialsContainer.h" 11 #include "modules/credentialmanager/CredentialsContainer.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 NavigatorCredentials::NavigatorCredentials(Navigator& navigator) 15 NavigatorCredentials::NavigatorCredentials(Navigator& navigator)
16 : DOMWindowProperty(navigator.frame()) {} 16 : ContextClient(navigator.frame()) {}
17 17
18 NavigatorCredentials& NavigatorCredentials::from(Navigator& navigator) { 18 NavigatorCredentials& NavigatorCredentials::from(Navigator& navigator) {
19 NavigatorCredentials* supplement = static_cast<NavigatorCredentials*>( 19 NavigatorCredentials* supplement = static_cast<NavigatorCredentials*>(
20 Supplement<Navigator>::from(navigator, supplementName())); 20 Supplement<Navigator>::from(navigator, supplementName()));
21 if (!supplement) { 21 if (!supplement) {
22 supplement = new NavigatorCredentials(navigator); 22 supplement = new NavigatorCredentials(navigator);
23 provideTo(navigator, supplementName(), supplement); 23 provideTo(navigator, supplementName(), supplement);
24 } 24 }
25 return *supplement; 25 return *supplement;
26 } 26 }
27 27
28 const char* NavigatorCredentials::supplementName() { 28 const char* NavigatorCredentials::supplementName() {
29 return "NavigatorCredentials"; 29 return "NavigatorCredentials";
30 } 30 }
31 31
32 CredentialsContainer* NavigatorCredentials::credentials(Navigator& navigator) { 32 CredentialsContainer* NavigatorCredentials::credentials(Navigator& navigator) {
33 return NavigatorCredentials::from(navigator).credentials(); 33 return NavigatorCredentials::from(navigator).credentials();
34 } 34 }
35 35
36 CredentialsContainer* NavigatorCredentials::credentials() { 36 CredentialsContainer* NavigatorCredentials::credentials() {
37 if (!m_credentialsContainer && frame()) 37 if (!m_credentialsContainer && frame())
38 m_credentialsContainer = CredentialsContainer::create(); 38 m_credentialsContainer = CredentialsContainer::create();
39 return m_credentialsContainer.get(); 39 return m_credentialsContainer.get();
40 } 40 }
41 41
42 DEFINE_TRACE(NavigatorCredentials) { 42 DEFINE_TRACE(NavigatorCredentials) {
43 visitor->trace(m_credentialsContainer); 43 visitor->trace(m_credentialsContainer);
44 Supplement<Navigator>::trace(visitor); 44 Supplement<Navigator>::trace(visitor);
45 DOMWindowProperty::trace(visitor); 45 ContextClient::trace(visitor);
46 } 46 }
47 47
48 } // namespace blink 48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698