[BlackBerry] Add enable credential autofill and enable form autofill feature control in WebSetting

https://bugs.webkit.org/show_bug.cgi?id=88513

Patch by Jonathan Dong <jonathan.dong@torchmobile.com.cn> on 2012-06-07
Reviewed by Rob Buis.

RIM PR: #163391
Implemented credential autofill setting and form autofill setting.

Internally reviewed by Leo Yang <leo.yang@torchmobile.com.cn>.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::autofillTextField):
(BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
(BlackBerry::WebKit::WebPage::clearCredentials):
(BlackBerry::WebKit::WebPage::clearAutofillData):
(BlackBerry::WebKit::WebPage::clearNeverRememberSites):
* Api/WebSettings.cpp:
(WebKit):
(BlackBerry::WebKit::WebSettings::standardSettings):
(BlackBerry::WebKit::WebSettings::isCredentialAutofillEnabled):
(BlackBerry::WebKit::WebSettings::setCredentialAutofillEnabled):
(BlackBerry::WebKit::WebSettings::isFormAutofillEnabled):
(BlackBerry::WebKit::WebSettings::setFormAutofillEnabled):
* Api/WebSettings.h:
* WebCoreSupport/EditorClientBlackBerry.cpp:
(WebCore::EditorClientBlackBerry::textFieldDidEndEditing):
(WebCore::EditorClientBlackBerry::textDidChangeInTextField):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119713 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8da2a1aa
......@@ -313,6 +313,9 @@ protected:
void WebPage::autofillTextField(const string& item)
{
if (!d->m_webSettings->isFormAutofillEnabled())
return;
d->m_autofillManager->autofillTextField(item.c_str());
}
......@@ -2157,7 +2160,7 @@ bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSp
#endif
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
if (!m_webSettings->isPrivateBrowsingEnabled())
if (m_webSettings->isCredentialAutofillEnabled() && !m_webSettings->isPrivateBrowsingEnabled())
credentialManager().autofillAuthenticationChallenge(protectionSpace, username, password);
#endif
......@@ -2165,7 +2168,7 @@ bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSp
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
Credential credential(username, password, CredentialPersistencePermanent);
if (!m_webSettings->isPrivateBrowsingEnabled() && isConfirmed)
if (m_webSettings->isCredentialAutofillEnabled() && !m_webSettings->isPrivateBrowsingEnabled() && isConfirmed)
credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, credential));
#else
Credential credential(username, password, CredentialPersistenceNone);
......@@ -5285,19 +5288,22 @@ void WebPage::clearLocalStorage()
void WebPage::clearCredentials()
{
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
credentialManager().clearCredentials();
if (d->m_webSettings->isCredentialAutofillEnabled())
credentialManager().clearCredentials();
#endif
}
void WebPage::clearAutofillData()
{
AutofillManager::clear();
if (d->m_webSettings->isFormAutofillEnabled())
AutofillManager::clear();
}
void WebPage::clearNeverRememberSites()
{
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
credentialManager().clearNeverRememberSites();
if (d->m_webSettings->isCredentialAutofillEnabled())
credentialManager().clearNeverRememberSites();
#endif
}
......
......@@ -55,6 +55,8 @@ DEFINE_STATIC_LOCAL(String, BlackBerryUserScalableEnabled, ("BlackBerryUserScala
DEFINE_STATIC_LOCAL(String, BlackBerryViewportWidth, ("BlackBerryViewportWidth"));
DEFINE_STATIC_LOCAL(String, BlackBerryZoomToFitOnLoadEnabled, ("BlackBerryZoomToFitOnLoadEnabled"));
DEFINE_STATIC_LOCAL(String, BlackBerryFullScreenVideoCapable, ("BlackBerryFullScreenVideoCapable"));
DEFINE_STATIC_LOCAL(String, BlackBerryCredentialAutofillEnabled, ("BlackBerryCredentialAutofillEnabled"));
DEFINE_STATIC_LOCAL(String, BlackBerryFormAutofillEnabled, ("BlackBerryFormAutofillEnabled"));
DEFINE_STATIC_LOCAL(String, SpatialNavigationEnabled, ("SpatialNavigationEnabled"));
DEFINE_STATIC_LOCAL(String, WebKitDatabasePath, ("WebKitDatabasePath"));
DEFINE_STATIC_LOCAL(String, WebKitDatabasesEnabled, ("WebKitDatabasesEnabled"));
......@@ -165,6 +167,8 @@ WebSettings* WebSettings::standardSettings()
settings->m_private->setBoolean(BlackBerryUserScalableEnabled, true);
settings->m_private->setBoolean(BlackBerryZoomToFitOnLoadEnabled, true);
settings->m_private->setBoolean(BlackBerryFullScreenVideoCapable, false);
settings->m_private->setBoolean(BlackBerryCredentialAutofillEnabled, false);
settings->m_private->setBoolean(BlackBerryFormAutofillEnabled, false);
settings->m_private->setInteger(WebKitDefaultFontSize, 16);
settings->m_private->setInteger(WebKitDefaultFixedFontSize, 13);
......@@ -772,5 +776,25 @@ void WebSettings::setFullScreenVideoCapable(bool enable)
m_private->setBoolean(BlackBerryFullScreenVideoCapable, enable);
}
bool WebSettings::isCredentialAutofillEnabled() const
{
return m_private->getBoolean(BlackBerryCredentialAutofillEnabled);
}
void WebSettings::setCredentialAutofillEnabled(bool enable)
{
return m_private->setBoolean(BlackBerryCredentialAutofillEnabled, enable);
}
bool WebSettings::isFormAutofillEnabled() const
{
return m_private->getBoolean(BlackBerryFormAutofillEnabled);
}
void WebSettings::setFormAutofillEnabled(bool enable)
{
return m_private->setBoolean(BlackBerryFormAutofillEnabled, enable);
}
} // namespace WebKit
} // namespace BlackBerry
......@@ -226,6 +226,12 @@ public:
bool fullScreenVideoCapable() const;
void setFullScreenVideoCapable(bool);
bool isCredentialAutofillEnabled() const;
void setCredentialAutofillEnabled(bool);
bool isFormAutofillEnabled() const;
void setFormAutofillEnabled(bool);
private:
WebSettingsPrivate* m_private;
WebSettings();
......
2012-06-07 Jonathan Dong <jonathan.dong@torchmobile.com.cn>
[BlackBerry] Add enable credential autofill and enable form autofill feature control in WebSetting
https://bugs.webkit.org/show_bug.cgi?id=88513
Reviewed by Rob Buis.
RIM PR: #163391
Implemented credential autofill setting and form autofill setting.
Internally reviewed by Leo Yang <leo.yang@torchmobile.com.cn>.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::autofillTextField):
(BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
(BlackBerry::WebKit::WebPage::clearCredentials):
(BlackBerry::WebKit::WebPage::clearAutofillData):
(BlackBerry::WebKit::WebPage::clearNeverRememberSites):
* Api/WebSettings.cpp:
(WebKit):
(BlackBerry::WebKit::WebSettings::standardSettings):
(BlackBerry::WebKit::WebSettings::isCredentialAutofillEnabled):
(BlackBerry::WebKit::WebSettings::setCredentialAutofillEnabled):
(BlackBerry::WebKit::WebSettings::isFormAutofillEnabled):
(BlackBerry::WebKit::WebSettings::setFormAutofillEnabled):
* Api/WebSettings.h:
* WebCoreSupport/EditorClientBlackBerry.cpp:
(WebCore::EditorClientBlackBerry::textFieldDidEndEditing):
(WebCore::EditorClientBlackBerry::textDidChangeInTextField):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent):
2012-06-06 Antonio Gomes <agomes@rim.com>
[BlackBerry] browser video player fullscreen mode (portrait) - Controls are off screen so cannot exit fullscreen
......
......@@ -509,14 +509,18 @@ void EditorClientBlackBerry::textFieldDidBeginEditing(Element*)
void EditorClientBlackBerry::textFieldDidEndEditing(Element* element)
{
if (HTMLInputElement* inputElement = element->toInputElement())
m_webPagePrivate->m_autofillManager->textFieldDidEndEditing(inputElement);
if (m_webPagePrivate->m_webSettings->isFormAutofillEnabled()) {
if (HTMLInputElement* inputElement = element->toInputElement())
m_webPagePrivate->m_autofillManager->textFieldDidEndEditing(inputElement);
}
}
void EditorClientBlackBerry::textDidChangeInTextField(Element* element)
{
if (HTMLInputElement* inputElement = element->toInputElement())
m_webPagePrivate->m_autofillManager->didChangeInTextField(inputElement);
if (m_webPagePrivate->m_webSettings->isFormAutofillEnabled()) {
if (HTMLInputElement* inputElement = element->toInputElement())
m_webPagePrivate->m_autofillManager->didChangeInTextField(inputElement);
}
}
bool EditorClientBlackBerry::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
......
......@@ -608,7 +608,8 @@ void FrameLoaderClientBlackBerry::dispatchDidFinishLoad()
}
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
if (m_webPagePrivate->m_webSettings->isCredentialAutofillEnabled()
&& !m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
credentialManager().autofillPasswordForms(m_frame->document()->forms());
#endif
}
......@@ -706,9 +707,11 @@ void FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad(const ResourceE
void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
{
if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) {
m_webPagePrivate->m_autofillManager->saveTextFields(formState->form());
if (m_webPagePrivate->m_webSettings->isFormAutofillEnabled())
m_webPagePrivate->m_autofillManager->saveTextFields(formState->form());
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(formState->form()));
if (m_webPagePrivate->m_webSettings->isCredentialAutofillEnabled())
credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(formState->form()));
#endif
}
......@@ -719,9 +722,11 @@ void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction fun
void FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent(PassRefPtr<FormState> prpFormState)
{
if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) {
m_webPagePrivate->m_autofillManager->saveTextFields(prpFormState->form());
if (m_webPagePrivate->m_webSettings->isFormAutofillEnabled())
m_webPagePrivate->m_autofillManager->saveTextFields(prpFormState->form());
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form()));
if (m_webPagePrivate->m_webSettings->isCredentialAutofillEnabled())
credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form()));
#endif
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment