Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * vim: set ts=2 sw=2 sts=2 et tw=80:
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 :
8 : #include "nsKeygenHandlerContent.h"
9 :
10 : #include "nsIFormProcessor.h"
11 : #include "nsString.h"
12 :
13 : #include "mozilla/dom/ContentChild.h"
14 : #include "mozilla/Unused.h"
15 :
16 : #include "keythi.h"
17 : #include "nss.h"
18 : #include "secmodt.h"
19 : #include "nsKeygenHandler.h"
20 :
21 : using mozilla::dom::ContentChild;
22 : using mozilla::Unused;
23 :
24 0 : NS_IMPL_ISUPPORTS(nsKeygenFormProcessorContent, nsIFormProcessor)
25 :
26 0 : nsKeygenFormProcessorContent::nsKeygenFormProcessorContent()
27 : {
28 0 : }
29 :
30 0 : nsKeygenFormProcessorContent::~nsKeygenFormProcessorContent()
31 : {
32 0 : }
33 :
34 : nsresult
35 0 : nsKeygenFormProcessorContent::ProcessValue(nsIDOMHTMLElement* aElement,
36 : const nsAString& aName,
37 : nsAString& aValue)
38 : {
39 0 : nsAutoString challengeValue;
40 0 : nsAutoString keyTypeValue;
41 0 : nsAutoString keyParamsValue;
42 0 : nsKeygenFormProcessor::ExtractParams(aElement, challengeValue, keyTypeValue, keyParamsValue);
43 :
44 0 : ContentChild* child = ContentChild::GetSingleton();
45 :
46 0 : nsString oldValue(aValue);
47 0 : nsString newValue;
48 0 : Unused << child->SendKeygenProcessValue(oldValue, challengeValue,
49 : keyTypeValue, keyParamsValue,
50 : &newValue);
51 :
52 0 : aValue.Assign(newValue);
53 0 : return NS_OK;
54 : }
55 :
56 : nsresult
57 0 : nsKeygenFormProcessorContent::ProcessValueIPC(const nsAString& aOldValue,
58 : const nsAString& aChallenge,
59 : const nsAString& aKeyType,
60 : const nsAString& aKeyParams,
61 : nsAString& aNewValue)
62 : {
63 0 : MOZ_ASSERT(false, "should never be called in the child process");
64 : return NS_ERROR_UNEXPECTED;
65 : }
66 :
67 : nsresult
68 0 : nsKeygenFormProcessorContent::ProvideContent(const nsAString& aFormType,
69 : nsTArray<nsString>& aContent,
70 : nsAString& aAttribute)
71 : {
72 0 : nsString attribute;
73 : Unused <<
74 0 : ContentChild::GetSingleton()->SendKeygenProvideContent(&attribute,
75 : &aContent);
76 0 : aAttribute.Assign(attribute);
77 0 : return NS_OK;
78 : }
|