OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return adoptRef(new PasswordInputType(element)); | 48 return adoptRef(new PasswordInputType(element)); |
49 } | 49 } |
50 | 50 |
51 HTMLElement* PasswordInputType::passwordGeneratorButtonElement() const | 51 HTMLElement* PasswordInputType::passwordGeneratorButtonElement() const |
52 { | 52 { |
53 return m_generatorButton.get(); | 53 return m_generatorButton.get(); |
54 } | 54 } |
55 | 55 |
56 bool PasswordInputType::isPasswordGenerationEnabled() const | 56 bool PasswordInputType::isPasswordGenerationEnabled() const |
57 { | 57 { |
58 if (Page* page = element()->document()->page()) | 58 if (Page* page = element()->document().page()) |
59 return page->chrome().client().isPasswordGenerationEnabled(); | 59 return page->chrome().client().isPasswordGenerationEnabled(); |
60 return false; | 60 return false; |
61 } | 61 } |
62 | 62 |
63 bool PasswordInputType::needsContainer() const | 63 bool PasswordInputType::needsContainer() const |
64 { | 64 { |
65 return BaseTextInputType::needsContainer() || isPasswordGenerationEnabled(); | 65 return BaseTextInputType::needsContainer() || isPasswordGenerationEnabled(); |
66 } | 66 } |
67 | 67 |
68 void PasswordInputType::createShadowSubtree() | 68 void PasswordInputType::createShadowSubtree() |
69 { | 69 { |
70 BaseTextInputType::createShadowSubtree(); | 70 BaseTextInputType::createShadowSubtree(); |
71 if (isPasswordGenerationEnabled()) { | 71 if (isPasswordGenerationEnabled()) { |
72 m_generatorButton = PasswordGeneratorButtonElement::create(element()->do
cument()); | 72 m_generatorButton = PasswordGeneratorButtonElement::create(&element()->d
ocument()); |
73 m_generatorButton->decorate(element()); | 73 m_generatorButton->decorate(element()); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void PasswordInputType::destroyShadowSubtree() | 77 void PasswordInputType::destroyShadowSubtree() |
78 { | 78 { |
79 BaseTextInputType::destroyShadowSubtree(); | 79 BaseTextInputType::destroyShadowSubtree(); |
80 m_generatorButton = 0; | 80 m_generatorButton = 0; |
81 } | 81 } |
82 | 82 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 bool PasswordInputType::isPasswordField() const | 128 bool PasswordInputType::isPasswordField() const |
129 { | 129 { |
130 return true; | 130 return true; |
131 } | 131 } |
132 | 132 |
133 void PasswordInputType::enableSecureTextInput() | 133 void PasswordInputType::enableSecureTextInput() |
134 { | 134 { |
135 if (element()->document()->frame()) | 135 if (element()->document().frame()) |
136 element()->document()->setUseSecureKeyboardEntryWhenActive(true); | 136 element()->document().setUseSecureKeyboardEntryWhenActive(true); |
137 } | 137 } |
138 | 138 |
139 void PasswordInputType::disableSecureTextInput() | 139 void PasswordInputType::disableSecureTextInput() |
140 { | 140 { |
141 if (element()->document()->frame()) | 141 if (element()->document().frame()) |
142 element()->document()->setUseSecureKeyboardEntryWhenActive(false); | 142 element()->document().setUseSecureKeyboardEntryWhenActive(false); |
143 } | 143 } |
144 | 144 |
145 } // namespace WebCore | 145 } // namespace WebCore |
OLD | NEW |