Implement support for autofill feature.
authorMichał Obrembski <m.obrembski@samsung.com>
Mon, 22 Dec 2014 13:27:47 +0000 (14:27 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This patch adds all autofill
functionality to the browser, such as Autofill Profiles, Form Password
Generation, Form Password save.

Merged patches:
a60760ca50a4deeaa0b56e4bc093de597ea3740f
Fix for APIs for Form Autofill Profiles.
Author: Jan Zakrzewski <j.zakrzewski@samsung.com>  2014-06-23 13:12:20

http://165.213.202.130:8080/#/c/68885/
fixup! Crash when adding profile
Author: Piotr Grad <p.grad@samsung.com>  2014-08-28 16:11:40

http://165.213.202.130:8080/#/c/69737/
fixup! Fix autofill profiles management
Author: Robert Jadczak <r.jadczak@samsung.com>  2014-09-20 14:35:20
Reviewed by: Piotr Grad, Piotr Tworek, arno renevier

Change-Id: I2de842151904438f3e75ecdb58087b816f2c47a9
Signed-off-by: Michał Obrembski <m.obrembski@samsung.com>
36 files changed:
tizen_src/ewk/efl_integration/public/ewk_autofill_profile.cc
tizen_src/ewk/efl_integration/public/ewk_context.cc
tizen_src/impl/API/ewk_autofill_profile_private.cc
tizen_src/impl/API/ewk_autofill_profile_private.h
tizen_src/impl/API/ewk_context_form_autofill_profile_private.cc [new file with mode: 0644]
tizen_src/impl/API/ewk_context_form_autofill_profile_private.h [new file with mode: 0644]
tizen_src/impl/autofill_popup_view_efl.cc
tizen_src/impl/autofill_popup_view_efl.h
tizen_src/impl/browser/autofill/autofill_manager_delegate_efl.cc
tizen_src/impl/browser/autofill/autofill_manager_delegate_efl.h
tizen_src/impl/browser/autofill/autofill_pref_store_efl.cc [new file with mode: 0644]
tizen_src/impl/browser/autofill/autofill_pref_store_efl.h [new file with mode: 0644]
tizen_src/impl/browser/autofill/personal_data_manager_factory.cc
tizen_src/impl/browser/password_manager/content_password_manager_driver.cc
tizen_src/impl/browser/password_manager/content_password_manager_driver.h
tizen_src/impl/browser/password_manager/password_form_manager.cc
tizen_src/impl/browser/password_manager/password_form_manager.h
tizen_src/impl/browser/password_manager/password_generation_manager.cc
tizen_src/impl/browser/password_manager/password_generation_manager.h
tizen_src/impl/browser/password_manager/password_manager.cc
tizen_src/impl/browser/password_manager/password_manager.h
tizen_src/impl/browser/password_manager/password_manager_client.cc
tizen_src/impl/browser/password_manager/password_manager_client.h
tizen_src/impl/browser/password_manager/password_manager_client_efl.cc
tizen_src/impl/browser/password_manager/password_manager_client_efl.h
tizen_src/impl/browser/password_manager/password_manager_driver.h
tizen_src/impl/browser/password_manager/password_store_factory.cc
tizen_src/impl/browser/password_manager/password_store_factory.h
tizen_src/impl/browser/webdata/web_data_service_factory.cc
tizen_src/impl/browser/webdata/web_data_service_factory.h
tizen_src/impl/browser_context_efl.cc
tizen_src/impl/browser_context_efl.h
tizen_src/impl/chromium-efl.gyp
tizen_src/impl/chromium-efl.gypi
tizen_src/impl/eweb_context.cc
tizen_src/impl/web_contents_delegate_efl.cc

index bb9bd6e..dd7b177 100644 (file)
@@ -37,6 +37,7 @@ const char* ewk_autofill_profile_data_get(Ewk_Autofill_Profile* profile,
     Ewk_Autofill_Profile_Data_Type name)
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(profile, 0);
-  return (profile->getData(DataType(name)).empty()) ?
-          NULL : profile->getData(DataType(name)).c_str();
+  std::string retVal = profile->getData(DataType(name));
+  return (retVal.empty()) ?
+          NULL : strdup(retVal.c_str());
 }
index 190ceda..2d47d71 100644 (file)
@@ -10,9 +10,7 @@
 #include <../impl/browser_context_efl.h>
 #include <../impl/http_user_agent_settings_efl.h>
 #include <../impl/API/ewk_cookie_manager_private.h>
-#if !defined(EWK_BRINGUP)
 #include <../impl/API/ewk_context_form_autofill_profile_private.h>
-#endif
 
 #include <tizen_webview/public/tw_security_origin.h>
 #include <tizen_webview/public/tw_web_context.h>
@@ -399,12 +397,7 @@ Eina_List* ewk_context_form_autofill_profile_get_all(Ewk_Context* context)
   if (NULL == context) {
     return NULL;
   }
-#if !defined(EWK_BRINGUP)
   return EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get_all(context);
-#else
-  LOG_EWK_API_MOCKUP();
-  return NULL;
-#endif
 }
 
 Ewk_Autofill_Profile* ewk_context_form_autofill_profile_get(Ewk_Context* context, unsigned id)
@@ -412,12 +405,7 @@ Ewk_Autofill_Profile* ewk_context_form_autofill_profile_get(Ewk_Context* context
   if (NULL == context) {
     return NULL;
   }
-#if !defined(EWK_BRINGUP)
   return EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get(context, id);
-#else
-  LOG_EWK_API_MOCKUP();
-  return NULL;
-#endif
 }
 
 Eina_Bool ewk_context_form_autofill_profile_set(Ewk_Context* context, unsigned id, Ewk_Autofill_Profile* profile)
@@ -425,12 +413,7 @@ Eina_Bool ewk_context_form_autofill_profile_set(Ewk_Context* context, unsigned i
   if (NULL == context || NULL == profile) {
     return EINA_FALSE;
   }
-#if !defined(EWK_BRINGUP)
   return EwkContextFormAutofillProfileManager::priv_form_autofill_profile_set(context, id, profile);
-#else
-  LOG_EWK_API_MOCKUP();
-  return NULL;
-#endif
 }
 
 Eina_Bool ewk_context_form_autofill_profile_add(Ewk_Context* context, Ewk_Autofill_Profile* profile)
@@ -438,12 +421,7 @@ Eina_Bool ewk_context_form_autofill_profile_add(Ewk_Context* context, Ewk_Autofi
   if (NULL == context || NULL == profile) {
     return EINA_FALSE;
   }
-#if !defined(EWK_BRINGUP)
   return EwkContextFormAutofillProfileManager::priv_form_autofill_profile_add(context, profile);
-#else
-  LOG_EWK_API_MOCKUP();
-  return NULL;
-#endif
 }
 
 Eina_Bool ewk_context_form_autofill_profile_remove(Ewk_Context* context, unsigned id)
@@ -451,12 +429,7 @@ Eina_Bool ewk_context_form_autofill_profile_remove(Ewk_Context* context, unsigne
   if (NULL == context) {
     return EINA_FALSE;
   }
-#if !defined(EWK_BRINGUP)
   return EwkContextFormAutofillProfileManager::priv_form_autofill_profile_remove(context, id);
-#else
-  LOG_EWK_API_MOCKUP();
-  return NULL;
-#endif
 }
 
 void ewk_context_vibration_client_callbacks_set(Ewk_Context* context,
index b7e466f..966ad07 100644 (file)
@@ -2,30 +2,42 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ewk_autofill_profile_private.h"
+#include <sstream>
 
-unsigned _Ewk_Autofill_Profile::s_currentID = 0;
+#include "ewk_autofill_profile_private.h"
 
 _Ewk_Autofill_Profile::_Ewk_Autofill_Profile() {
-  m_profileID = s_currentID;
-  ++s_currentID;
+  m_profileID_ = 0;
+  m_data[PROFILE_ID] = "0";
 }
 
 _Ewk_Autofill_Profile::~_Ewk_Autofill_Profile() {
 }
 
 unsigned _Ewk_Autofill_Profile::getProfileID() const {
-  return m_profileID;
+  return m_profileID_;
 }
 
 std::string _Ewk_Autofill_Profile::getData(
     DataType name) const {
-  const AutofillDataMap::const_iterator it = m_data.find(name);
+  AutofillDataMap::const_iterator it = m_data.find(name);
+  if (it != m_data.end())
+    return (*it).second;
+  return "";
+}
 
-  return (it != m_data.end()) ? (*it).second : std::string();
+base::string16 _Ewk_Autofill_Profile::get16Data(
+    DataType name) const {
+  std::string value = getData(name);
+  return base::string16(value.begin(), value.end());
 }
 
 void _Ewk_Autofill_Profile::setData(DataType name,
     const std::string& value) {
+  if (PROFILE_ID == name) {
+    std::stringstream stream;
+    stream << value;
+    stream >> m_profileID_;
+  }
   m_data[name] = value;
 }
index 8301bff..81d2c32 100644 (file)
@@ -5,8 +5,10 @@
 #ifndef EWK_AUTOFILL_PROFILE_PRIVATE_H_
 #define EWK_AUTOFILL_PROFILE_PRIVATE_H_
 
-#include <string>
 #include <map>
+#include <string>
+
+#include "base/strings/utf_string_conversions.h"
 
 enum DataType {
   PROFILE_ID = 0,
@@ -24,7 +26,7 @@ enum DataType {
 };
 
 class _Ewk_Autofill_Profile {
-public:
+ public:
   _Ewk_Autofill_Profile();
   ~_Ewk_Autofill_Profile();
 
@@ -32,12 +34,12 @@ public:
 
   unsigned getProfileID() const;
   std::string getData(DataType name) const;
+  base::string16 get16Data(DataType name) const;
 
   void setData(DataType name, const std::string& value);
 
-private:
-  static unsigned s_currentID;
-  unsigned m_profileID;
+ private:
+  unsigned m_profileID_;
   AutofillDataMap m_data;
 };
 
diff --git a/tizen_src/impl/API/ewk_context_form_autofill_profile_private.cc b/tizen_src/impl/API/ewk_context_form_autofill_profile_private.cc
new file mode 100644 (file)
index 0000000..43a22dc
--- /dev/null
@@ -0,0 +1,247 @@
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ewk_context_form_autofill_profile_private.h"
+
+#include <vector>
+#include <string>
+#include <sstream>
+#include <Eina.h>
+
+#include "browser/autofill/personal_data_manager_factory.h"
+#include "components/autofill/core/browser/personal_data_manager.h"
+#include "eweb_view.h"
+#include "ewk_autofill_profile_private.h"
+
+template <class T>
+std::string to_string(T value) {
+  std::stringstream out;
+  out << value;
+  return out.str();
+};
+
+namespace autofill {
+class PersonalDataManagerFactory;
+std::string hash_string(const char *str) {
+  unsigned val = 0;
+  for (unsigned i = 0; str[i]; i++)
+    val = (val << 3) + static_cast<unsigned>(str[i]);
+  return to_string(val);
+}
+
+std::string generate_hash(Ewk_Autofill_Profile* profile) {
+  std::string hash_str;
+  for (int i = PROFILE_NAME; i < MAX_AUTOFILL; ++i)
+    hash_str.append(profile->getData(static_cast<DataType>(i)));
+  return hash_string(hash_str.c_str());
+}
+
+}
+
+static std::map<DataType, autofill::ServerFieldType> create_EWK_to_Autofill_profile_map() {
+  std::map<DataType, autofill::ServerFieldType> profile_map;
+  profile_map[PROFILE_COMPANY] = autofill::COMPANY_NAME;
+  profile_map[PROFILE_ADDRESS1] = autofill::ADDRESS_HOME_LINE1;
+  profile_map[PROFILE_ADDRESS2] = autofill::ADDRESS_HOME_LINE2;
+  profile_map[PROFILE_CITY_TOWN] = autofill::ADDRESS_HOME_CITY;
+  profile_map[PROFILE_STATE_PROVINCE_REGION] = autofill::ADDRESS_HOME_STATE;
+  profile_map[PROFILE_ZIPCODE] = autofill::ADDRESS_HOME_ZIP;
+  profile_map[PROFILE_COUNTRY] = autofill::ADDRESS_HOME_COUNTRY;
+  profile_map[PROFILE_PHONE] = autofill::PHONE_HOME_WHOLE_NUMBER;
+  profile_map[PROFILE_EMAIL] = autofill::EMAIL_ADDRESS;
+  profile_map[MAX_AUTOFILL] = autofill::NAME_MIDDLE;
+  return profile_map;
+}
+
+void to_Autofill_Profile_set_data(const Ewk_Autofill_Profile* oldStyleProfile,
+    DataType DataName,
+    std::string locale,
+    autofill::AutofillProfile &ret) {
+  base::string16 value;
+  static map<DataType, autofill::ServerFieldType> profile_map =
+      create_EWK_to_Autofill_profile_map();
+  if (0 < (value = oldStyleProfile->get16Data(DataName)).length()) {
+    ret.SetInfo(autofill::AutofillType(profile_map.find(DataName)->second),
+        value, locale);
+  }
+}
+
+autofill::AutofillProfile to_Autofill_Profile(const Ewk_Autofill_Profile* oldStyleProfile) {
+  autofill::AutofillProfile ret("0", "");
+  std::string locale = EWebView::GetPlatformLocale();
+  if (oldStyleProfile) {
+    std::string temp = to_string(0);
+    ret.SetInfo(autofill::AutofillType(autofill::ADDRESS_HOME_SORTING_CODE),
+        base::string16(temp.begin(), temp.end()), locale);
+    return ret;
+  }
+  std::string value;
+  // store id
+  if (0 < (value = oldStyleProfile->getData(PROFILE_ID)).length()) {
+    ret = autofill::AutofillProfile(value, "");
+    ret.SetInfo(autofill::AutofillType(autofill::ADDRESS_HOME_SORTING_CODE),
+        base::string16(value.begin(), value.end()), locale);
+  }
+  // store name
+  if (0 < (value = oldStyleProfile->getData(PROFILE_NAME)).length()) {
+      ret.SetInfo(autofill::AutofillType(autofill::NAME_FULL),
+          base::string16(value.begin(), value.end()), locale);
+
+    if (value.find(" ") != std::string::npos) {
+      unsigned found_first = value.find_first_of(" ");
+      unsigned found_last = value.find_last_of(" ");
+      ret.SetInfo(autofill::AutofillType(autofill::NAME_FIRST),
+          base::string16(value.begin(), value.begin() + found_first), locale);
+
+      if (found_first < found_last)
+        ret.SetInfo(autofill::AutofillType(autofill::NAME_MIDDLE),
+            base::string16(value.begin() + found_first + 1,
+                value.begin()+found_last), locale);
+
+      ret.SetInfo(autofill::AutofillType(autofill::NAME_LAST),
+          base::string16(value.begin() + found_last + 1, value.end()), locale);
+    }
+  }
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_COMPANY,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_ADDRESS1,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_ADDRESS2,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_CITY_TOWN,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_STATE_PROVINCE_REGION,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_ZIPCODE,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_COUNTRY,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_PHONE,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, PROFILE_EMAIL,
+    locale, ret);
+  to_Autofill_Profile_set_data(oldStyleProfile, MAX_AUTOFILL,
+    locale, ret);
+  return ret;
+}
+
+static std::map<autofill::ServerFieldType, DataType> create_Autofill_to_EWK_profile_map() {
+  std::map<autofill::ServerFieldType, DataType> profile_map;
+  std::map<DataType, autofill::ServerFieldType> autofill_map =
+      create_EWK_to_Autofill_profile_map();
+  for (std::map<DataType, autofill::ServerFieldType>::iterator it =
+      autofill_map.begin(); it!=autofill_map.end(); ++it)
+    profile_map[it->second] = it->first;
+  profile_map[autofill::NAME_FULL] = PROFILE_NAME;
+  return profile_map;
+}
+
+void to_EWK_Profile_set_data(const autofill::AutofillProfile& newStyleProfile,
+    autofill::ServerFieldType DataName,
+    std::string locale,
+    Ewk_Autofill_Profile *ret) {
+  base::string16 value;
+  static map<autofill::ServerFieldType, DataType> profile_map =
+      create_Autofill_to_EWK_profile_map();
+  if (0 < (value = newStyleProfile.GetInfo(autofill::AutofillType(
+      DataName), locale)).length()) {
+    ret->setData(profile_map.find(DataName)->second,
+        std::string(value.begin(), value.end()));
+  }
+}
+
+Ewk_Autofill_Profile* to_Ewk_Autofill_Profile(
+      const autofill::AutofillProfile& newStyleProfile) {
+  Ewk_Autofill_Profile *ret = new Ewk_Autofill_Profile();
+  std::string locale = EWebView::GetPlatformLocale();
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_SORTING_CODE, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::NAME_FULL, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::COMPANY_NAME, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_LINE1, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_LINE2, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_CITY, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_STATE, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_ZIP, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::ADDRESS_HOME_COUNTRY, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::PHONE_HOME_WHOLE_NUMBER, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::EMAIL_ADDRESS, locale, ret);
+  to_EWK_Profile_set_data(newStyleProfile,
+      autofill::NAME_MIDDLE, locale, ret);
+  return ret;
+}
+
+
+Eina_List* EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get_all(
+    Ewk_Context* /*context*/) {
+  autofill::PersonalDataManager *dataManager =
+      autofill::PersonalDataManagerFactory::GetInstance()->GetDataManager();
+  std::vector<autofill::AutofillProfile*> dataVector = dataManager->GetProfiles();
+  Eina_List *ret = NULL;
+  Eina_List *work = NULL;
+  for (unsigned i = 0; i < dataVector.size(); ++i) {
+    autofill::AutofillProfile *profile = dataVector[i];
+    if (profile) {
+      work = eina_list_append(work, to_Ewk_Autofill_Profile(*profile));
+      if (ret)
+        ret = work;
+    }
+  }
+  return ret;
+}
+
+Ewk_Autofill_Profile* EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get(
+    Ewk_Context* /*context*/, unsigned id) {
+  autofill::PersonalDataManagerFactory *dataManager =
+      autofill::PersonalDataManagerFactory::GetInstance();
+  autofill::AutofillProfile *profile =
+      dataManager->GetProfileByGUID(to_string(id));
+  Ewk_Autofill_Profile *ret = NULL;
+  if (profile)
+    ret = to_Ewk_Autofill_Profile(*profile);
+  return ret;
+}
+
+Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_set(
+    Ewk_Context* /*context*/, unsigned id, Ewk_Autofill_Profile* profile) {
+  autofill::PersonalDataManagerFactory *personalDataManagerFactory =
+      autofill::PersonalDataManagerFactory::GetInstance();
+  // set proper member of profile to id
+  profile->setData(PROFILE_ID, autofill::generate_hash(profile));
+  // check if such profile already exists??
+  if (personalDataManagerFactory->GetProfileByGUID(to_string(id))) {
+    personalDataManagerFactory->AddProfile(to_Autofill_Profile(profile));
+  } else {
+    personalDataManagerFactory->RemoveByGUID(to_string(id));
+    personalDataManagerFactory->AddProfile(to_Autofill_Profile(profile));
+  }
+  return EINA_TRUE;
+}
+
+Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_add(
+    Ewk_Context* /*context*/, Ewk_Autofill_Profile* profile) {
+  autofill::PersonalDataManagerFactory *personalDataManagerFactory =
+      autofill::PersonalDataManagerFactory::GetInstance();
+  profile->setData(PROFILE_ID, autofill::generate_hash(profile));
+  personalDataManagerFactory->AddProfile(to_Autofill_Profile(profile));
+  return EINA_TRUE;
+}
+
+Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_remove(
+    Ewk_Context* /*context*/, unsigned id) {
+  autofill::PersonalDataManagerFactory *personalDataManagerFactory =
+      autofill::PersonalDataManagerFactory::GetInstance();
+  personalDataManagerFactory->RemoveByGUID(to_string(id));
+  return EINA_TRUE;
+}
diff --git a/tizen_src/impl/API/ewk_context_form_autofill_profile_private.h b/tizen_src/impl/API/ewk_context_form_autofill_profile_private.h
new file mode 100644 (file)
index 0000000..7142da9
--- /dev/null
@@ -0,0 +1,86 @@
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ewk_context_form_autofill_profile_private_h
+#define ewk_context_form_autofill_profile_private_h
+
+#include <Evas.h>
+
+class Ewk_Context;
+
+typedef struct _Ewk_Autofill_Profile Ewk_Autofill_Profile;
+
+class EwkContextFormAutofillProfileManager
+{
+ public:
+  /**
+   * Gets a list of all existing profiles
+   *
+   * The obtained profile must be deleted by ewk_autofill_profile_delete.
+   * @param context context object
+   *
+   * @return @c Eina_List of Ewk_Autofill_Profile @c NULL otherwise
+   * @see ewk_autofill_profile_delete
+   */
+  static Eina_List* priv_form_autofill_profile_get_all(Ewk_Context* context);
+
+  /**
+   * Gets the existing profile for given index
+   *
+   * The obtained profile must be deleted by ewk_autofill_profile_delete.
+   *
+   * @param context context object
+   * @param profile id
+   *
+   * @return @c Ewk_Autofill_Profile if profile exists, @c NULL otherwise
+   * @see ewk_autofill_profile_delete
+   */
+  static Ewk_Autofill_Profile* priv_form_autofill_profile_get(Ewk_Context* context,
+      unsigned id);
+
+  /**
+   * Sets the given profile for the given id
+   *
+   * Data can be added to the created profile by ewk_autofill_profile_data_set.
+   *
+   * @param context context object
+   * @param profile id
+   * @param profile Ewk_Autofill_Profile
+   *
+   * @return @c EINA_TRUE if the profile data is set successfully, @c EINA_FALSE otherwise
+   * @see ewk_autofill_profile_new
+   * @see ewk_context_form_autofill_profile_add
+   */
+  static Eina_Bool priv_form_autofill_profile_set(Ewk_Context* context,
+      unsigned id, Ewk_Autofill_Profile* profile);
+
+  /**
+   * Saves the created profile into permenant storage
+   *
+   * The profile used to save must be created by ewk_autofill_profile_new.
+   * Data can be added to the created profile by ewk_autofill_profile_data_set.
+   *
+   * @param context context object
+   * @param profile Ewk_Autofill_Profile
+   *
+   * @return @c EINA_TRUE if the profile data is saved successfully, @c EINA_FALSE otherwise
+   * @see ewk_autofill_profile_new
+   */
+  static Eina_Bool priv_form_autofill_profile_add(Ewk_Context* context,
+      Ewk_Autofill_Profile* profile);
+
+  /**
+   * Removes Autofill Form profile completely
+   *
+   * @param context context object
+   * @param index profile id
+   *
+   * @return @c EINA_TRUE if the profile data is removed successfully, @c EINA_FALSE otherwise
+   * @see ewk_context_form_autofill_profile_get_all
+   */
+  static EAPI Eina_Bool priv_form_autofill_profile_remove(Ewk_Context* context,
+      unsigned id);
+};
+
+#endif // ewk_context_form_autofill_profile_private_h
index 805638b..b47c012 100644 (file)
@@ -14,6 +14,8 @@
 #define AUTOFILL_POPUP_LABEL_COUNT  6 // Autofill component send 6 at max
 #define AUTOFILL_POPUP_LABEL_LEN    100
 
+using namespace password_manager;
+
 namespace autofill {
 namespace {
   // const values taken from webkit2-efl
@@ -34,53 +36,48 @@ AutofillPopupViewEfl::AutofillPopupViewEfl(EWebView* view)
   , autofill_list_(NULL)
   , password_popup_(NULL)
   , form_manager_(NULL) {
-  Evas_Object* widgetWin_ = elm_object_top_widget_get(elm_object_parent_widget_get(view->evas_object()));
-  if (!widgetWin_) {
+  Evas_Object* widgetWin_ = elm_object_top_widget_get(
+      elm_object_parent_widget_get(view->evas_object()));
+  if (!widgetWin_)
     widgetWin_ = view->evas_object();
-  }
   autofill_popup_ = elm_layout_add(widgetWin_);
-  if (!autofill_popup_) {
+  if (!autofill_popup_)
     return;
-  }
   base::FilePath edj_dir;
   base::FilePath autofill_edj;
   PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir);
   autofill_edj = edj_dir.Append(FILE_PATH_LITERAL("AutofillPopup.edj"));
-  elm_layout_file_set(autofill_popup_, autofill_edj.AsUTF8Unsafe().c_str(), "formdata_list");
+  elm_layout_file_set(autofill_popup_,
+      autofill_edj.AsUTF8Unsafe().c_str(),
+      "formdata_list");
   autofill_list_ = elm_genlist_add(autofill_popup_);
 }
 
 AutofillPopupViewEfl::~AutofillPopupViewEfl()
 {
-  if (autofill_popup_) {
+  if (autofill_popup_)
     evas_object_del(autofill_popup_);
-  }
-  if (password_popup_) {
+  if (password_popup_)
     evas_object_del(password_popup_);
-  }
 }
 
 void AutofillPopupViewEfl::Show()
 {
-  if (autofill_popup_) {
+  if (autofill_popup_)
     evas_object_show(autofill_popup_);
-  }
-  if (delegate_) {
+  if (delegate_)
     delegate_->OnPopupShown();
-  }
 }
 
 void AutofillPopupViewEfl::Hide()
 {
-  if (autofill_popup_) {
+  if (autofill_popup_)
     evas_object_hide(autofill_popup_);
-  }
-  if (delegate_) {
+  if (delegate_)
     delegate_->OnPopupHidden();
-  }
 }
 
-void AutofillPopupViewEfl::ShowSavePasswordPopup(PasswordFormManager * form_to_save)
+void AutofillPopupViewEfl::ShowSavePasswordPopup(PasswordFormManager* form_to_save)
 {
   if (password_popup_) {
     evas_object_del(password_popup_);
@@ -96,26 +93,34 @@ void AutofillPopupViewEfl::ShowSavePasswordPopup(PasswordFormManager * form_to_s
   Evas_Object *btn_never = elm_button_add(password_popup_);
   elm_object_text_set(btn_never, "Never");
   elm_object_part_content_set(password_popup_, "button1", btn_never);
-  evas_object_smart_callback_add(btn_never, "clicked", savePasswordNeverCb, (void*)this);
+  evas_object_smart_callback_add(btn_never,
+      "clicked",
+      savePasswordNeverCb,
+      static_cast<void*>(this));
 
   Evas_Object *btn_yes = elm_button_add(password_popup_);
   elm_object_text_set(btn_yes, "Yes");
   elm_object_part_content_set(password_popup_, "button2", btn_yes);
-  evas_object_smart_callback_add(btn_yes, "clicked", savePasswordYesCb, (void*)this);
+  evas_object_smart_callback_add(btn_yes,
+      "clicked",
+      savePasswordYesCb,
+      static_cast<void*>(this));
 
   Evas_Object *btn_not_now = elm_button_add(password_popup_);
   elm_object_text_set(btn_not_now, "Not Now");
   elm_object_part_content_set(password_popup_, "button3", btn_not_now);
-  evas_object_smart_callback_add(btn_not_now, "clicked", savePasswordNotNowCb, (void*)this);
+  evas_object_smart_callback_add(btn_not_now,
+      "clicked",
+      savePasswordNotNowCb,
+      static_cast<void*>(this));
 }
            
 void AutofillPopupViewEfl::UpdateFormDataPopup(const gfx::RectF& bounds)
 {
   Elm_Genlist_Item_Class* list_Items = NULL;
   double scale_factor = 1.0;
-  if (!autofill_list_) {
+  if (!autofill_list_)
     return;
-  }
   Evas_Object* border_up = elm_bg_add(autofill_popup_);
   Evas_Object* border_down = elm_bg_add(autofill_popup_);
   Evas_Object* border_left = elm_bg_add(autofill_popup_);
@@ -129,10 +134,17 @@ void AutofillPopupViewEfl::UpdateFormDataPopup(const gfx::RectF& bounds)
   list_Items->func.state_get = NULL;
   list_Items->func.del = NULL;
   for (size_t i = 0; i < values_.size(); ++i) {
-    elm_genlist_item_append(autofill_list_, list_Items, (void*)(long)i, NULL, ELM_GENLIST_ITEM_NONE, itemSelectCb, (void*)this);
+    elm_genlist_item_append(autofill_list_,
+        list_Items,
+        reinterpret_cast<void*>(static_cast<long>(i)),
+        NULL,
+        ELM_GENLIST_ITEM_NONE,
+        itemSelectCb,
+        static_cast<void*>(this));
   }
 #if defined(OS_TIZEN_MOBILE)
-  scale_factor = (double)gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor();
+  scale_factor = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().
+      device_scale_factor();
 #elif defined(OS_TIZEN_TV)
   scale_factor = webview_->GetScale();
 #endif
@@ -207,9 +219,8 @@ void AutofillPopupViewEfl::InitFormData(
 void AutofillPopupViewEfl::AcceptSuggestion(size_t index)
 {
   if (delegate_) {
-    if (index < values_.size()) {
+    if (index < values_.size())
       delegate_->DidAcceptSuggestion(values_[index], identifiers_[index]);
-    }
   }
 }
 
@@ -219,9 +230,8 @@ void AutofillPopupViewEfl::AcceptPasswordSuggestion(int option)
     evas_object_del(password_popup_);
     password_popup_ = NULL;
   }
-  if (!form_manager_) {
+  if (!form_manager_)
     return;
-  }
   switch (static_cast<AutofillSavePassword>(option)) {
     case AUTOFILL_SAVE_PASS_NEVER: {
       form_manager_->PermanentlyBlacklist();
@@ -240,13 +250,13 @@ void AutofillPopupViewEfl::AcceptPasswordSuggestion(int option)
 
 void AutofillPopupViewEfl::SetSelectedLine(size_t selected_line)
 {
-  if (selected_line_ == selected_line) {
+  if (selected_line_ == selected_line)
     return;
-  }
   selected_line_ = selected_line;
   if(delegate_) {
     if (selected_line_ < values_.size()) {
-      delegate_->DidSelectSuggestion(identifiers_[selected_line_]);
+      delegate_->DidSelectSuggestion(values_[selected_line],
+          identifiers_[selected_line_]);
     }
     else {
       delegate_->ClearPreviewedForm();
@@ -265,33 +275,29 @@ void AutofillPopupViewEfl::itemSelectCb(void* data, Evas_Object* obj, void* even
 {
   size_t index = (size_t)elm_object_item_data_get(static_cast<Elm_Object_Item*>(event_info));
   AutofillPopupViewEfl* autofill_popup = static_cast<AutofillPopupViewEfl*>(data);
-  if (autofill_popup) {
+  if (autofill_popup)
     autofill_popup->AcceptSuggestion(index);
-  }
 }
 
 void AutofillPopupViewEfl::savePasswordNeverCb(void *data, Evas_Object *obj, void *event_info)
 {
   AutofillPopupViewEfl * autofill_popup = static_cast<AutofillPopupViewEfl*>(data);
-  if (autofill_popup) {
+  if (autofill_popup)
     autofill_popup->AcceptPasswordSuggestion(AUTOFILL_SAVE_PASS_NEVER);
-  }
 }
 
 void AutofillPopupViewEfl::savePasswordYesCb(void *data, Evas_Object *obj, void *event_info)
 {
   AutofillPopupViewEfl * autofill_popup = static_cast<AutofillPopupViewEfl*>(data);
-  if (autofill_popup) {
+  if (autofill_popup)
     autofill_popup->AcceptPasswordSuggestion(AUTOFILL_SAVE_PASS_YES);
-  }
 }
 
 void AutofillPopupViewEfl::savePasswordNotNowCb(void *data, Evas_Object *obj, void *event_info)
 {
   AutofillPopupViewEfl * autofill_popup = static_cast<AutofillPopupViewEfl*>(data);
-  if (autofill_popup) {
+  if (autofill_popup)
     autofill_popup->AcceptPasswordSuggestion(AUTOFILL_SAVE_PASS_NOTNOW);
-  }
 }
 
 } // namespace autofill
index 779c933..3976ba6 100644 (file)
@@ -19,6 +19,7 @@
 #include "ui/gfx/image/image_skia.h"
 #include "ui/gfx/point.h"
 
+using namespace password_manager;
 class EWebView;
 
 namespace autofill {
index af54aba..94b1547 100644 (file)
@@ -4,27 +4,30 @@
 
 #ifdef TIZEN_AUTOFILL_SUPPORT
 
+#include "browser/autofill/autofill_manager_delegate_efl.h"
+
 #include "browser/autofill/personal_data_manager_factory.h"
 #include "browser/webdata/web_data_service_factory.h"
 #include "browser/password_manager/password_manager_client_efl.h"
 #include "browser/password_manager/password_generation_manager.h"
-
 #include "base/logging.h"
 #include "base/prefs/pref_service.h"
 #include "base/strings/utf_string_conversions.h"
-#include "components/autofill/content/browser/autofill_driver_impl.h"
 #include "components/autofill/content/common/autofill_messages.h"
 #include "components/autofill/core/common/autofill_pref_names.h"
+#include "components/autofill/core/browser/autofill_client.h"
 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
+#include "components/user_prefs/user_prefs.h"
 #include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents_view.h"
 #include "content/public/browser/browser_thread.h"
 #include "ui/gfx/rect.h"
 #include <Elementary.h>
-#include "browser/autofill/autofill_manager_delegate_efl.h"
+#include "tizen_webview/public/tw_web_context.h"
 
 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillManagerDelegateEfl);
 
+using namespace password_manager;
+
 namespace autofill {
 
 AutofillManagerDelegateEfl::AutofillManagerDelegateEfl(content::WebContents* web_contents)
@@ -32,7 +35,6 @@ AutofillManagerDelegateEfl::AutofillManagerDelegateEfl(content::WebContents* web
     , webview_(NULL)
     , web_contents_(web_contents)
     , database_(WebDataServiceFactory::GetInstance()->GetAutofillWebDataForProfile())
-    , is_autofill_enabled_(true)
     , popup_controller_(NULL) {
   DCHECK(web_contents);
 }
@@ -56,8 +58,8 @@ scoped_refptr<AutofillWebDataService> AutofillManagerDelegateEfl::GetDatabase()
 }
 
 PrefService* AutofillManagerDelegateEfl::GetPrefs() {
-  //TODO: Need to implement using Ewk_Settings
-  return prefs_.get();
+  if(webview_)
+    return webview_->context()->GetImpl()->browser_context()->GetUserPrefService();
 }
 
 void AutofillManagerDelegateEfl::ShowAutofillSettings() {
@@ -68,7 +70,10 @@ void AutofillManagerDelegateEfl::ConfirmSaveCreditCard(const AutofillMetrics& me
   NOTIMPLEMENTED();
 }
 
-void AutofillManagerDelegateEfl::ShowRequestAutocompleteDialog(const FormData& form, const GURL& source_url, const base::Callback<void(const FormStructure*)>& callback) {
+void AutofillManagerDelegateEfl::ShowRequestAutocompleteDialog(
+    const autofill::FormData& form,
+    const GURL& source_url,
+    const ResultCallback& callback) {
   HideRequestAutocompleteDialog();
   NOTIMPLEMENTED();
 }
@@ -83,9 +88,9 @@ void AutofillManagerDelegateEfl::ShowAutofillPopup(
     base::WeakPtr<AutofillPopupDelegate> delegate) {
   DCHECK(web_contents_);
 #if defined(OS_TIZEN)
-  gfx::Rect client_area;
-  web_contents_->GetView()->GetContainerBounds(&client_area);
-  gfx::RectF element_bounds_in_screen_space = element_bounds + client_area.OffsetFromOrigin();
+  gfx::Rect client_area = web_contents_->GetContainerBounds();
+  gfx::RectF element_bounds_in_screen_space = element_bounds + 
+      client_area.OffsetFromOrigin();
 #endif
 
   if (GetOrCreatePopupController()) {
@@ -107,37 +112,27 @@ void AutofillManagerDelegateEfl::HideAutofillPopup() {
   DCHECK(web_contents_);
   if (popup_controller_) {
     popup_controller_->Hide();
-    PasswordGenerationManager * manager = PasswordManagerClientEfl::GetGenerationManagerFromWebContents(web_contents_);
+    PasswordGenerationManager* manager =
+        PasswordManagerClientEfl::GetGenerationManagerFromWebContents(
+            web_contents_);
     if (manager)
       manager->HidePopup();
   }
 }
 
 bool AutofillManagerDelegateEfl::IsAutocompleteEnabled() {
-  return is_autofill_enabled_;
-}
-
-void AutofillManagerDelegateEfl::SetAutocompleteEnabled(bool enable) {
-  PersonalDataManager * data_manager = GetPersonalDataManager();
-  if(data_manager)
-    data_manager->SetAutofillEnabled(enable);
-  is_autofill_enabled_ = enable;
+  return GetPrefs()->GetBoolean(autofill::prefs::kAutofillEnabled);
 }
 
 bool AutofillManagerDelegateEfl::IsAutocompleteSavingEnabled() {
-  return webview_->GetSettings()->formCandidateData();
+  if(webview_)
+    return webview_->GetSettings()->formCandidateData();
 }
 
 void AutofillManagerDelegateEfl::HideRequestAutocompleteDialog() {
   NOTIMPLEMENTED();
 }
 
-void AutofillManagerDelegateEfl::WasShown() {
-  content::RenderViewHost* host = web_contents()->GetRenderViewHost();
-  if (host)
-    host->Send(new AutofillMsg_PageShown(host->GetRoutingID()));
-}
-
 void AutofillManagerDelegateEfl::DidNavigateMainFrame(const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) {
   HideRequestAutocompleteDialog();
 }
@@ -147,13 +142,15 @@ void AutofillManagerDelegateEfl::ShowSavePasswordPopup(PasswordFormManager * for
     popup_controller_->ShowSavePasswordPopup(form_to_save);
 }
 
-void AutofillManagerDelegateEfl::WebContentsDestroyed(content::WebContents* web_contents) {
+void AutofillManagerDelegateEfl::WebContentsDestroyed() {
   HideAutofillPopup();
 }
 
 void AutofillManagerDelegateEfl::DetectAccountCreationForms(const std::vector<autofill::FormStructure*>& forms) {
   DCHECK(web_contents_);
-  PasswordGenerationManager * manager = PasswordManagerClientEfl::GetGenerationManagerFromWebContents(web_contents_);
+  PasswordGenerationManager* manager =
+      PasswordManagerClientEfl::GetGenerationManagerFromWebContents(
+          web_contents_);
   if (manager)
     manager->DetectAccountCreationForms(forms);
 }
@@ -164,6 +161,12 @@ AutofillPopupViewEfl * AutofillManagerDelegateEfl::GetOrCreatePopupController()
   return popup_controller_;
 }
 
+void AutofillManagerDelegateEfl::DidFillOrPreviewField(
+    const base::string16& autofilled_value,
+    const base::string16& profile_full_name) {
+  NOTIMPLEMENTED();
+}
+
 }  // namespace autofill
 
 #endif // TIZEN_AUTOFILL_SUPPORT
index dbca126..a57dc7e 100644 (file)
@@ -11,7 +11,7 @@
 #include "base/compiler_specific.h"
 #include "base/i18n/rtl.h"
 #include "base/memory/weak_ptr.h"
-#include "components/autofill/core/browser/autofill_manager_delegate.h"
+#include "components/autofill/core/browser/autofill_client.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
 #include "browser/password_manager/password_form_manager.h"
@@ -30,21 +30,25 @@ struct FormData;
 // Chrome implementation of AutofillManagerDelegate.
 class AutofillManagerDelegateEfl
     : public content::WebContentsUserData<AutofillManagerDelegateEfl>,
-      public AutofillManagerDelegate,
+      public autofill::AutofillClient,
       public content::WebContentsObserver {
  public:
   virtual ~AutofillManagerDelegateEfl();
   // Called when the tab corresponding to |this| instance is activated.
   void TabActivated();
   // AutofillManagerDelegate implementation.
-  virtual PersonalDataManager* GetPersonalDataManager() override;
-  virtual scoped_refptr<AutofillWebDataService> GetDatabase() override;
-  virtual PrefService* GetPrefs() override;
-  virtual void HideRequestAutocompleteDialog() override;
-  virtual void ShowAutofillSettings() override;
-  virtual void ConfirmSaveCreditCard(const AutofillMetrics& metric_logger, const base::Closure& save_card_callback) override;
-  virtual void ShowRequestAutocompleteDialog(const FormData& form, const GURL& source_url, const base::Callback<void(const FormStructure*)>& callback) override;
-  virtual void ShowAutofillPopup(
+  PersonalDataManager* GetPersonalDataManager() override;
+  scoped_refptr<AutofillWebDataService> GetDatabase() override;
+  PrefService* GetPrefs() override;
+  void HideRequestAutocompleteDialog() override;
+  void ShowAutofillSettings() override;
+  void ConfirmSaveCreditCard(const AutofillMetrics& metric_logger,
+      const base::Closure& save_card_callback) override;
+  void ShowRequestAutocompleteDialog(
+      const autofill::FormData& form,
+      const GURL& source_url,
+      const ResultCallback& callback) override;
+  void ShowAutofillPopup(
       const gfx::RectF& element_bounds,
       base::i18n::TextDirection text_direction,
       const std::vector<base::string16>& values,
@@ -52,31 +56,33 @@ class AutofillManagerDelegateEfl
       const std::vector<base::string16>& icons,
       const std::vector<int>& identifiers,
       base::WeakPtr<AutofillPopupDelegate> delegate) override;
-  virtual void UpdateAutofillPopupDataListValues(const std::vector<base::string16>& values, const std::vector<base::string16>& labels) override;
-  virtual void HideAutofillPopup() override;
-  virtual bool IsAutocompleteEnabled() override;
-  virtual bool IsAutocompleteSavingEnabled() override;
-  virtual void DetectAccountCreationForms(const std::vector<autofill::FormStructure*>& forms) override;
+  void UpdateAutofillPopupDataListValues(
+      const std::vector<base::string16>& values,
+      const std::vector<base::string16>& labels) override;
+  void HideAutofillPopup() override;
+  bool IsAutocompleteEnabled() override;
+  bool IsAutocompleteSavingEnabled() override;
+  void DetectAccountCreationForms(
+      const std::vector<autofill::FormStructure*>& forms) override;
   // content::WebContentsObserver implementation.
-  virtual void DidNavigateMainFrame(const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) override;
-  virtual void WebContentsDestroyed(content::WebContents* web_contents) override;
-  virtual void WasShown() override;
-  void SetAutocompleteEnabled(bool enable);
-  void ShowSavePasswordPopup(PasswordFormManager * form_to_save);
-  void SetEWebView(EWebView * view) { webview_ = view; }
-  AutofillPopupViewEfl * GetOrCreatePopupController();
+  void DidNavigateMainFrame(const content::LoadCommittedDetails& details,
+      const content::FrameNavigateParams& params) override;
+  void WebContentsDestroyed() override;
+  void ShowSavePasswordPopup(password_manager::PasswordFormManager* form_to_save);
+  void SetEWebView(EWebView* view) { webview_ = view; }
+  AutofillPopupViewEfl* GetOrCreatePopupController();
+  void DidFillOrPreviewField(
+      const base::string16& autofilled_value,
+      const base::string16& profile_full_name) override;
 
  private:
   explicit AutofillManagerDelegateEfl(content::WebContents* web_contents);
   friend class content::WebContentsUserData<AutofillManagerDelegateEfl>;
 
- private:
   content::WebContents* const web_contents_;
-  EWebView * webview_;
+  EWebView* webview_;
   scoped_refptr<AutofillWebDataService> database_;
-  scoped_ptr<PrefService> prefs_;
-  bool is_autofill_enabled_;
-  AutofillPopupViewEfl * popup_controller_;
+  AutofillPopupViewEfl* popup_controller_;
 
   DISALLOW_COPY_AND_ASSIGN(AutofillManagerDelegateEfl);
 };
diff --git a/tizen_src/impl/browser/autofill/autofill_pref_store_efl.cc b/tizen_src/impl/browser/autofill/autofill_pref_store_efl.cc
new file mode 100644 (file)
index 0000000..c2a6cf7
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (c) 2013 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 "autofill_pref_store_efl.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+
+AutofillPrefStore::AutofillPrefStore() {}
+
+AutofillPrefStore::~AutofillPrefStore() {}
+
+bool AutofillPrefStore::GetValue(const std::string& key,
+    const base::Value** value) const {
+  return prefs_.GetValue(key, value);
+}
+
+bool AutofillPrefStore::GetMutableValue(const std::string& key,
+    base::Value** value) {
+  return prefs_.GetValue(key, value);
+}
+
+void AutofillPrefStore::AddObserver(PrefStore::Observer* observer) {
+  observers_.AddObserver(observer);
+}
+
+void AutofillPrefStore::RemoveObserver(PrefStore::Observer* observer) {
+  observers_.RemoveObserver(observer);
+}
+
+bool AutofillPrefStore::HasObservers() const {
+  return observers_.might_have_observers();
+}
+
+bool AutofillPrefStore::IsInitializationComplete() const {
+  return true;
+}
+
+void AutofillPrefStore::SetValue(const std::string& key, base::Value* value) {
+  DCHECK(value);
+  if (prefs_.SetValue(key, value))
+    ReportValueChanged(key);
+}
+
+void AutofillPrefStore::SetValueSilently(const std::string& key, base::Value* value) {
+  prefs_.SetValue(key, value);
+}
+
+void AutofillPrefStore::RemoveValue(const std::string& key) {
+  if (prefs_.RemoveValue(key))
+    ReportValueChanged(key);
+}
+
+bool AutofillPrefStore::ReadOnly() const {
+  return false;
+}
+
+PersistentPrefStore::PrefReadError AutofillPrefStore::GetReadError() const {
+  return PersistentPrefStore::PREF_READ_ERROR_NONE;
+}
+
+PersistentPrefStore::PrefReadError AutofillPrefStore::ReadPrefs() {
+  return PersistentPrefStore::PREF_READ_ERROR_NONE;
+}
+
+void AutofillPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) {
+}
+
+void AutofillPrefStore::ReportValueChanged(const std::string& key) {
+  FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
+}
diff --git a/tizen_src/impl/browser/autofill/autofill_pref_store_efl.h b/tizen_src/impl/browser/autofill/autofill_pref_store_efl.h
new file mode 100644 (file)
index 0000000..0246732
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef AUTOFILL_PREF_STORE_H_
+#define AUTOFILL_PREF_STORE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/observer_list.h"
+#include "base/prefs/persistent_pref_store.h"
+#include "base/prefs/pref_value_map.h"
+
+// A light-weight prefstore implementation that keeps preferences
+// in a memory backed store. This is not a persistent prefstore -- we
+// subclass the PersistentPrefStore here since it is needed by the
+// PrefService, which in turn is needed by the Autofill component.
+class AutofillPrefStore : public PersistentPrefStore {
+ public:
+  AutofillPrefStore();
+
+  // Overriden from PrefStore.
+  bool GetValue(const std::string& key,
+                const base::Value** result) const override;
+  void AddObserver(PrefStore::Observer* observer) override;
+  void RemoveObserver(PrefStore::Observer* observer) override;
+  bool HasObservers() const override;
+  bool IsInitializationComplete() const override;
+
+  // PersistentPrefStore overrides:
+  bool GetMutableValue(const std::string& key,
+                       base::Value** result) override;
+  void ReportValueChanged(const std::string& key) override;
+  void SetValue(const std::string& key, base::Value* value) override;
+  void SetValueSilently(const std::string& key,
+                        base::Value* value) override;
+  void RemoveValue(const std::string& key) override;
+  bool ReadOnly() const override;
+  PrefReadError GetReadError() const override;
+  PersistentPrefStore::PrefReadError ReadPrefs() override;
+  void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
+  void CommitPendingWrite() override {}
+
+ protected:
+  virtual ~AutofillPrefStore();
+
+ private:
+  // Stores the preference values.
+  PrefValueMap prefs_;
+
+  ObserverList<PrefStore::Observer, true> observers_;
+
+  DISALLOW_COPY_AND_ASSIGN(AutofillPrefStore);
+};
+
+#endif  // AUTOFILL_PREF_STORE_H_
index 9f15678..3bdf0f8 100644 (file)
 #include "browser/webdata/web_data_service_factory.h"
 #include "components/autofill/core/browser/personal_data_manager.h"
 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
+#include "tizen_webview/public/tw_web_context.h"
 
 namespace autofill {
 namespace {
+  using tizen_webview::WebContext;
 
 class PersonalDataManagerServiceImpl : public PersonalDataManagerService {
- public:
+public:
   explicit PersonalDataManagerServiceImpl();
   virtual ~PersonalDataManagerServiceImpl();
 
   // PersonalDataManagerService:
-  virtual void Shutdown() override;
-  virtual PersonalDataManager* GetPersonalDataManager() override;
+  PersonalDataManager* GetPersonalDataManager() override;
   static PersonalDataManagerServiceImpl* GetInstance() {
     return Singleton<PersonalDataManagerServiceImpl>::get();
   }
- private:
+private:
   friend struct DefaultSingletonTraits<PersonalDataManagerServiceImpl>;
   scoped_ptr<PersonalDataManager> personal_data_manager_;
   DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerServiceImpl);
@@ -34,16 +35,17 @@ class PersonalDataManagerServiceImpl : public PersonalDataManagerService {
 
 PersonalDataManagerServiceImpl::PersonalDataManagerServiceImpl() {
   personal_data_manager_.reset(new PersonalDataManager(EWebView::GetPlatformLocale()));
-  personal_data_manager_->Init(WebDataServiceFactory::GetAutofillWebDataForProfile(), false);
+  content::BrowserContextEfl* default_context =
+      WebContext::DefaultContext()->browser_context();
+  personal_data_manager_->Init(
+      WebDataServiceFactory::GetAutofillWebDataForProfile(),
+      default_context->GetUserPrefService(),
+      false);
 }
 
 PersonalDataManagerServiceImpl::~PersonalDataManagerServiceImpl() {
 }
 
-void PersonalDataManagerServiceImpl::Shutdown() {
-  personal_data_manager_.reset();
-}
-
 PersonalDataManager* PersonalDataManagerServiceImpl::GetPersonalDataManager() {
   return personal_data_manager_.get();
 }
index 1ca7593..d93610d 100644 (file)
@@ -7,25 +7,27 @@
 
 #include "browser/password_manager/content_password_manager_driver.h"
 
-#include "components/autofill/content/browser/autofill_driver_impl.h"
+#include "components/autofill/content/browser/content_autofill_driver.h"
 #include "components/autofill/content/common/autofill_messages.h"
+#include "components/autofill/core/browser/autofill_client.h"
 #include "components/autofill/core/common/password_form.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/navigation_details.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/common/page_transition_types.h"
 #include "content/public/common/ssl_status.h"
 #include "ipc/ipc_message_macros.h"
 #include "net/cert/cert_status_flags.h"
 
+namespace password_manager {
 ContentPasswordManagerDriver::ContentPasswordManagerDriver(
     content::WebContents* web_contents,
     PasswordManagerClient* client)
     : WebContentsObserver(web_contents),
       password_manager_(client),
-      password_generation_manager_(web_contents, client) {
+      password_generation_manager_(web_contents, client),
+      next_free_key_(0) {
   DCHECK(web_contents);
 }
 
@@ -34,8 +36,9 @@ ContentPasswordManagerDriver::~ContentPasswordManagerDriver() {}
 void ContentPasswordManagerDriver::FillPasswordForm(
     const autofill::PasswordFormFillData& form_data) {
   DCHECK(web_contents());
+  const int key = next_free_key_++;
   web_contents()->GetRenderViewHost()->Send(new AutofillMsg_FillPasswordForm(
-      web_contents()->GetRenderViewHost()->GetRoutingID(), form_data));
+      web_contents()->GetRenderViewHost()->GetRoutingID(), key, form_data));
 }
 
 bool ContentPasswordManagerDriver::DidLastPageLoadEncounterSSLErrors() {
@@ -99,8 +102,8 @@ bool ContentPasswordManagerDriver::OnMessageReceived(
 }
 
 autofill::AutofillManager* ContentPasswordManagerDriver::GetAutofillManager() {
-  autofill::AutofillDriverImpl* driver =
-      autofill::AutofillDriverImpl::FromWebContents(web_contents());
+  autofill::ContentAutofillDriver* driver =
+      autofill::ContentAutofillDriver::FromWebContents(web_contents());
   return driver ? driver->autofill_manager() : NULL;
 }
 
@@ -109,5 +112,6 @@ void ContentPasswordManagerDriver::AllowPasswordGenerationForForm(
   content::RenderViewHost* host = web_contents()->GetRenderViewHost();
   host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), *form));
 }
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
index 2d3db43..b36aeca 100644 (file)
@@ -14,6 +14,7 @@
 #include "browser/password_manager/password_generation_manager.h"
 #include "browser/password_manager/password_manager.h"
 #include "browser/password_manager/password_manager_driver.h"
+#include "browser/password_manager/password_manager_client.h"
 #include "content/public/browser/web_contents_observer.h"
 
 namespace autofill {
@@ -25,6 +26,7 @@ namespace content {
 class WebContents;
 }
 
+namespace password_manager {
 class ContentPasswordManagerDriver : public PasswordManagerDriver,
                                      public content::WebContentsObserver {
  public:
@@ -55,9 +57,11 @@ class ContentPasswordManagerDriver : public PasswordManagerDriver,
 
   PasswordManager password_manager_;
   PasswordGenerationManager password_generation_manager_;
+  int next_free_key_;
 
   DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver);
 };
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index 574cff6..d902e1c 100644 (file)
@@ -26,6 +26,7 @@ using autofill::PasswordForm;
 using autofill::PasswordFormMap;
 using base::Time;
 
+namespace password_manager {
 PasswordFormManager::PasswordFormManager(PasswordManager* password_manager,
                                          PasswordManagerClient* client,
                                          PasswordManagerDriver* driver,
@@ -155,12 +156,6 @@ void PasswordFormManager::PermanentlyBlacklist() {
   SaveAsNewLogin(false);
 }
 
-void PasswordFormManager::SetUseAdditionalPasswordAuthentication(
-    bool use_additional_authentication) {
-  pending_credentials_.use_additional_authentication =
-      use_additional_authentication;
-}
-
 bool PasswordFormManager::IsNewLogin() {
   DCHECK_EQ(state_, POST_MATCHING_PHASE);
   return is_new_login_;
@@ -339,9 +334,8 @@ void PasswordFormManager::OnRequestDone(
   // We're done matching now.
   state_ = POST_MATCHING_PHASE;
 
-  if (best_score <= 0) {
+  if (best_score <= 0)
     return;
-  }
 
   for (std::vector<PasswordForm>::const_iterator it =
            credentials_to_keep.begin();
@@ -409,14 +403,12 @@ void PasswordFormManager::OnGetPasswordStoreResults(
 bool PasswordFormManager::IgnoreResult(const PasswordForm& form) const {
   // Ignore change password forms until we have some change password
   // functionality
-  if (observed_form_.old_password_element.length() != 0) {
+  if (observed_form_.password_element.length() != 0)
     return true;
-  }
   // Don't match an invalid SSL form with one saved under secure
   // circumstances.
-  if (form.ssl_valid && !observed_form_.ssl_valid) {
+  if (form.ssl_valid && !observed_form_.ssl_valid)
     return true;
-  }
   return false;
 }
 
@@ -440,9 +432,8 @@ void PasswordFormManager::SaveAsNewLogin(bool reset_preferred_login) {
   SanitizePossibleUsernames(&pending_credentials_);
   password_store->AddLogin(pending_credentials_);
 
-  if (reset_preferred_login) {
+  if (reset_preferred_login)
     UpdatePreferredLoginState(password_store);
-  }
 }
 
 void PasswordFormManager::SanitizePossibleUsernames(PasswordForm* form) {
@@ -579,7 +570,8 @@ void PasswordFormManager::CheckForAccountCreationForm(
         // Note that this doesn't guarantee that the upload succeeded, only that
         // |pending.form_data| is considered uploadable.
         bool success =
-            autofill_manager->UploadPasswordGenerationForm(pending.form_data);
+            autofill_manager->UploadPasswordForm(
+                pending.form_data,autofill::ACCOUNT_CREATION_PASSWORD);
         UMA_HISTOGRAM_BOOLEAN("PasswordGeneration.UploadStarted", success);
       }
     }
@@ -646,4 +638,5 @@ void PasswordFormManager::SubmitPassed() {
 void PasswordFormManager::SubmitFailed() {
   submit_result_ = kSubmitResultFailed;
 }
+}
 #endif // TIZEN_AUTOFILL_SUPPORT
index 3827254..97763fc 100644 (file)
@@ -23,6 +23,7 @@ namespace content {
 class WebContents;
 }  // namespace content
 
+namespace password_manager {
 class PasswordManager;
 class PasswordManagerClient;
 
@@ -111,11 +112,6 @@ class PasswordFormManager : public PasswordStoreConsumer {
   // TODO: Make this private once we switch to the new UI.
   void PermanentlyBlacklist();
 
-  // Sets whether the password form should use additional password
-  // authentication if available before being used for autofill.
-  void SetUseAdditionalPasswordAuthentication(
-      bool use_additional_authentication);
-
   // If the user has submitted observed_form_, provisionally hold on to
   // the submitted credentials until we are told by PasswordManager whether
   // or not the login was successful. |action| describes how we deal with
@@ -315,6 +311,7 @@ class PasswordFormManager : public PasswordStoreConsumer {
 
   DISALLOW_COPY_AND_ASSIGN(PasswordFormManager);
 };
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index de38900..de12fb6 100755 (executable)
@@ -19,9 +19,9 @@
 #include "components/autofill/core/common/password_form.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
 #include "ui/gfx/rect.h"
 
+namespace password_manager {
 PasswordGenerationManager::PasswordGenerationManager(
     content::WebContents* contents,
     PasswordManagerClient* client)
@@ -86,13 +86,6 @@ void PasswordGenerationManager::SendAccountCreationFormsToRenderer(
       host->GetRoutingID(), forms));
 }
 
-gfx::RectF PasswordGenerationManager::GetBoundsInScreenSpace(
-    const gfx::RectF& bounds) {
-  gfx::Rect client_area;
-  web_contents_->GetView()->GetContainerBounds(&client_area);
-  return bounds + client_area.OffsetFromOrigin();
-}
-
 void PasswordGenerationManager::OnShowPasswordGenerationPopup(
     const gfx::RectF& bounds,
     int max_length,
@@ -117,5 +110,6 @@ void PasswordGenerationManager::HidePopup()
 {
   // TODO: Call Popup Hide
 }
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
index 036d13e..9de9c2c 100644 (file)
@@ -15,9 +15,6 @@
 #include "base/memory/weak_ptr.h"
 #include "ui/gfx/rect.h"
 
-class PasswordManager;
-class PasswordManagerClient;
-class PasswordManagerDriver;
 
 namespace autofill {
 struct FormData;
@@ -36,6 +33,7 @@ namespace user_prefs {
 class PrefRegistrySyncable;
 }
 
+namespace password_manager {
 // Per-tab manager for password generation. Will enable this feature only if
 //
 // -  Password manager is enabled
@@ -49,6 +47,9 @@ class PrefRegistrySyncable;
 // This class is used to determine what forms we should offer to generate
 // passwords for and manages the popup which is created if the user chooses to
 // generate a password.
+class PasswordManager;
+class PasswordManagerClient;
+class PasswordManagerDriver;
 class PasswordGenerationManager {
  public:
   PasswordGenerationManager(content::WebContents* contents,
@@ -93,10 +94,6 @@ class PasswordGenerationManager {
       content::RenderViewHost* host,
       const std::vector<autofill::FormData>& forms);
 
-  // Given |bounds| in the renderers coordinate system, return the same bounds
-  // in the screens coordinate system.
-  gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds);
-
   // The WebContents instance associated with this instance. Scoped to the
   // lifetime of this class, as this class is indirectly a WCUD via
   // ChromePasswordManagerClient.
@@ -123,6 +120,7 @@ class PasswordGenerationManager {
 
   DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager);
 };
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index a251449..28ef9a0 100644 (file)
 #include "browser/password_manager/password_form_manager.h"
 #include "browser/password_manager/password_manager_client.h"
 #include "browser/password_manager/password_manager_driver.h"
-#include "components/autofill/core/common/password_autofill_util.h"
+#include "components/password_manager/core/browser/password_autofill_manager.h"
 #include "components/password_manager/core/browser/password_manager_metrics_util.h"
 #include "components/password_manager/core/common/password_manager_pref_names.h"
-#include "components/user_prefs/pref_registry_syncable.h"
+#include "components/pref_registry/pref_registry_syncable.h"
 
 using autofill::PasswordForm;
 using autofill::PasswordFormMap;
 
+namespace password_manager {
 namespace {
 
 const char kSpdyProxyRealm[] = "/SpdyProxy";
@@ -176,8 +177,7 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form)
   // Always save generated passwords, as the user expresses explicit intent for
   // Chrome to manage such passwords. For other passwords, respect the
   // autocomplete attribute if autocomplete='off' is not ignored.
-  if (!autofill::ShouldIgnoreAutocompleteOffForPasswordFields() &&
-      !manager->HasGeneratedPassword() &&
+  if (!manager->HasGeneratedPassword() &&
       !form.password_autocomplete_set) {
     RecordFailure(AUTOCOMPLETE_OFF, form.origin.host());
     return;
@@ -232,7 +232,7 @@ void PasswordManager::OnPasswordFormSubmitted(
 
 void PasswordManager::OnPasswordFormsParsed(
     const std::vector<PasswordForm>& forms) {
-  if(!IsPasswordManagerFillingEnabled()) {
+  if (!IsPasswordManagerFillingEnabled()) {
     return;
   }
   // Ask the SSLManager for current security.
@@ -267,7 +267,8 @@ bool PasswordManager::ShouldPromptUserToSavePassword() const {
 }
 
 void PasswordManager::OnPasswordFormsRendered(
-    const std::vector<PasswordForm>& visible_forms) {
+    const std::vector<PasswordForm>& visible_forms,
+    bool did_stop_loading) {
   if(!IsPasswordManagerFillingEnabled()) {
     return;
   }
@@ -351,12 +352,6 @@ void PasswordManager::Autofill(
   // TODO(tedchoc): Switch to only requesting authentication if the user is
   //                acting on the autofilled forms (crbug.com/342594) instead
   //                of on page load.
-  bool authentication_required = preferred_match.use_additional_authentication;
-  for (autofill::PasswordFormMap::const_iterator it = best_matches.begin();
-       !authentication_required && it != best_matches.end(); ++it) {
-    if (it->second->use_additional_authentication)
-      authentication_required = true;
-  }
 
   switch (form_for_autofill.scheme) {
     case PasswordForm::SCHEME_HTML: {
@@ -370,9 +365,6 @@ void PasswordManager::Autofill(
                                wait_for_username,
                                OtherPossibleUsernamesEnabled(),
                                fill_data.get());
-      if (authentication_required)
-        client_->AuthenticateAutofillAndFillForm(fill_data.Pass());
-      else
         driver_->FillPasswordForm(*fill_data.get());
       break;
     }
@@ -387,6 +379,7 @@ void PasswordManager::Autofill(
 
   client_->PasswordWasAutofilled(best_matches);
 }
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index ae8435b..533b38c 100644 (file)
 #include "components/autofill/core/common/password_form_fill_data.h"
 #include "components/password_manager/core/browser/login_model.h"
 
-class PasswordManagerClient;
-class PasswordManagerDriver;
-class PasswordManagerTest;
-class PasswordFormManager;
 class PrefRegistrySimple;
 
 namespace content {
@@ -39,8 +35,9 @@ class PrefRegistrySyncable;
 // receiving password form data from the renderer and managing the password
 // database through the PasswordStore. The PasswordManager is a LoginModel
 // for purposes of supporting HTTP authentication dialogs.
+namespace password_manager {
 class PasswordManager : public LoginModel {
- public:
+public:
   static const char kOtherPossibleUsernamesExperiment[];
 
   static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
@@ -95,13 +92,14 @@ class PasswordManager : public LoginModel {
 
   // Handles password forms being rendered.
   void OnPasswordFormsRendered(
-      const std::vector<autofill::PasswordForm>& visible_forms);
+      const std::vector<autofill::PasswordForm>& visible_forms,
+      bool did_stop_loading);
 
   // Handles a password form being submitted.
   virtual void OnPasswordFormSubmitted(
       const autofill::PasswordForm& password_form);
 
- private:
+private:
   enum ProvisionalSaveFailure {
     SAVING_DISABLED,
     EMPTY_PASSWORD,
@@ -182,6 +180,7 @@ class PasswordManager : public LoginModel {
 
   DISALLOW_COPY_AND_ASSIGN(PasswordManager);
 };
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index 7553e6f..ec7a3e9 100644 (file)
@@ -7,12 +7,15 @@
 
 #include "browser/password_manager/password_manager_client.h"
 
+namespace password_manager {
 base::FieldTrial::Probability
-PasswordManagerClient::GetProbabilityForExperiment(
-    const std::string& experiment_name) {
-  return 0;
+    PasswordManagerClient::GetProbabilityForExperiment(
+        const std::string& experiment_name) {
+    return 0;
 }
 
+
 bool PasswordManagerClient::IsPasswordSyncEnabled() { return false; }
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
\ No newline at end of file
index 9d2ca4d..345ef27 100644 (file)
 #include "components/autofill/core/common/password_form.h"
 #include "components/autofill/core/common/password_form_fill_data.h"
 
+namespace password_manager {
 class PasswordFormManager;
 class PasswordManagerDriver;
 class PasswordStore;
-class PrefService;
 
 // An abstraction of operations that depend on the embedders (e.g. Chrome)
 // environment.
@@ -56,6 +56,7 @@ class PasswordManagerClient {
  private:
   DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient);
 };
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index 037f6a1..41b5365 100644 (file)
@@ -19,6 +19,7 @@
 #include "components/password_manager/core/browser/password_manager_metrics_util.h"
 #include "content/public/browser/web_contents.h"
 
+namespace password_manager {
 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PasswordManagerClientEfl);
 
 PasswordManagerClientEfl::PasswordManagerClientEfl(content::WebContents* web_contents)
@@ -113,4 +114,5 @@ void PasswordManagerClientEfl::CommitFillPasswordForm(autofill::PasswordFormFill
 {
   driver_.FillPasswordForm(*data);
 }
+}
 #endif // TIZEN_AUTOFILL_SUPPORT
index 3e37c92..0b2dc27 100644 (file)
@@ -14,7 +14,6 @@
 #include "browser/password_manager/password_manager_client.h"
 #include "content/public/browser/web_contents_user_data.h"
 
-class PasswordGenerationManager;
 class PasswordManager;
 class Profile;
 
@@ -23,20 +22,25 @@ class WebContents;
 }
 
 // PasswordManagerClientEfl implements the PasswordManagerClient interface.
+namespace password_manager {
 class PasswordManagerClientEfl
     : public PasswordManagerClient,
       public content::WebContentsUserData<PasswordManagerClientEfl> {
- public:
+public:
   virtual ~PasswordManagerClientEfl();
 
   // PasswordManagerClient implementation.
-  virtual void PromptUserToSavePassword(PasswordFormManager* form_to_save) override;
-  virtual void PasswordWasAutofilled(const autofill::PasswordFormMap& best_matches) const override;
-  virtual void AuthenticateAutofillAndFillForm(scoped_ptr<autofill::PasswordFormFillData> fill_data) override;
-  virtual PasswordStore* GetPasswordStore() override;
-  virtual PasswordManagerDriver* GetDriver() override;
-  virtual base::FieldTrial::Probability GetProbabilityForExperiment(const std::string& experiment_name) override;
-  virtual bool IsPasswordSyncEnabled() override;
+  void PromptUserToSavePassword(
+      PasswordFormManager* form_to_save) override;
+  void PasswordWasAutofilled(
+      const autofill::PasswordFormMap& best_matches) const override;
+  void AuthenticateAutofillAndFillForm(
+      scoped_ptr<autofill::PasswordFormFillData> fill_data) override;
+  PasswordStore* GetPasswordStore() override;
+  PasswordManagerDriver* GetDriver() override;
+  base::FieldTrial::Probability GetProbabilityForExperiment(
+      const std::string& experiment_name) override;
+  bool IsPasswordSyncEnabled() override;
 
   bool IsPasswordManagerSavingEnabled();
   void SetPasswordManagerSavingEnabled(bool enabled);
@@ -50,9 +54,10 @@ class PasswordManagerClientEfl
 
   // Convenience method to allow //chrome code easy access to a
   // PasswordGenerationManager from a WebContents instance.
-  static PasswordGenerationManager* GetGenerationManagerFromWebContents(content::WebContents* contents);
+  static PasswordGenerationManager* GetGenerationManagerFromWebContents(
+      content::WebContents* contents);
 
- private:
+private:
   explicit PasswordManagerClientEfl(content::WebContents* web_contents);
   friend class content::WebContentsUserData<PasswordManagerClientEfl>;
 
@@ -69,6 +74,7 @@ class PasswordManagerClientEfl
 
   DISALLOW_COPY_AND_ASSIGN(PasswordManagerClientEfl);
 };
+}
 
 #endif // TIZEN_AUTOFILL_SUPPORT
 
index 64c8aaf..e48deab 100644 (file)
@@ -8,17 +8,17 @@
 
 #ifdef TIZEN_AUTOFILL_SUPPORT
 
-class PasswordGenerationManager;
-class PasswordManager;
-
 namespace autofill {
 class AutofillManager;
 struct PasswordForm;
 struct PasswordFormFillData;
 }  // namespace autofill
 
+namespace password_manager {
 // Interface that allows PasswordManager core code to interact with its driver
 // (i.e., obtain information from it and give information to it).
+class PasswordGenerationManager;
+class PasswordManager;
 class PasswordManagerDriver {
  public:
   PasswordManagerDriver() {}
@@ -50,7 +50,7 @@ class PasswordManagerDriver {
  private:
   DISALLOW_COPY_AND_ASSIGN(PasswordManagerDriver);
 };
-
+}
 #endif // TIZEN_AUTOFILL_SUPPORT
 
 #endif  // PASSWORD_MANAGER_DRIVER_H
index c510f7c..c40ccfd 100755 (executable)
 #include "paths_efl.h"
 #include "browser/webdata/web_data_service.h"
 #include "browser/webdata/web_data_service_factory.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
 #include "components/password_manager/core/browser/login_database.h"
 #include "components/password_manager/core/browser/password_store.h"
 #include "components/password_manager/core/browser/password_store_default.h"
-#include "components/user_prefs/pref_registry_syncable.h"
 #include "content/public/browser/browser_thread.h"
 
+using namespace password_manager;
+using password_manager::PasswordStore;
+
 PasswordStoreService::PasswordStoreService(
     scoped_refptr<PasswordStore> password_store)
     : password_store_(password_store)
@@ -37,12 +38,6 @@ scoped_refptr<PasswordStore> PasswordStoreService::GetPasswordStore()
   return password_store_;
 }
 
-void PasswordStoreService::Shutdown()
-{
-  if (password_store_)
-    password_store_->Shutdown();
-}
-
 // static
 scoped_refptr<PasswordStore> PasswordStoreFactory::GetPasswordStore()
 {
@@ -97,8 +92,7 @@ void PasswordStoreFactory::Init()
 
   ps = new PasswordStoreDefault(
       main_thread_runner, db_thread_runner, login_db.release());
-
-  if (!ps || !ps->Init()) {
+  if (!ps.get() || !ps->Init(syncer::SyncableService::StartSyncFlare())) {
     NOTREACHED() << "Could not initialize password manager.";
     return;
   }
@@ -106,8 +100,4 @@ void PasswordStoreFactory::Init()
   service_ = new PasswordStoreService(ps);
 }
 
-bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const
-{
-  return true;
-}
 #endif // TIZEN_AUTOFILL_SUPPORT
index d5fef82..a60cce8 100644 (file)
@@ -10,7 +10,9 @@
 
 #include "base/basictypes.h"
 #include "base/memory/singleton.h"
+#include "browser/password_manager/password_manager_driver.h"
 
+namespace password_manager {
 class PasswordStore;
 
 // A wrapper of PasswordStore so we can use it as a profiled keyed service.
@@ -23,8 +25,6 @@ class PasswordStoreService {
 
   scoped_refptr<PasswordStore> GetPasswordStore();
 
-  virtual void Shutdown() override;
-
  private:
   scoped_refptr<PasswordStore> password_store_;
   DISALLOW_COPY_AND_ASSIGN(PasswordStoreService);
@@ -45,12 +45,11 @@ class PasswordStoreFactory {
   PasswordStoreFactory();
   virtual ~PasswordStoreFactory();
 
-  virtual bool ServiceIsNULLWhileTesting() const override;
-  PasswordStoreService * service_;
+  PasswordStoreService* service_;
 
   DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory);
 };
-
+}
 #endif // TIZEN_AUTOFILL_SUPPORT
 
 #endif  // PASSWORD_STORE_FACTORY_H
index cb0d6e1..024c196 100644 (file)
@@ -12,7 +12,6 @@
 #include "base/path_service.h"
 #include "base/files/file_path.h"
 #include "paths_efl.h"
-#include "browser/webdata/web_data_service.h"
 #include "components/autofill/core/browser/autofill_country.h"
 #include "components/autofill/core/browser/webdata/autofill_table.h"
 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
@@ -27,6 +26,7 @@ namespace {
 // Callback to show error dialog on profile load error.
 void ProfileErrorCallback(int type, sql::InitStatus status) {
   //TODO:Need to check what type of error to show
+  NOTIMPLEMENTED();
 }
 
 void InitSyncableServicesOnDBThread(
@@ -87,12 +87,6 @@ WebDataServiceWrapper::WebDataServiceWrapper() {
 WebDataServiceWrapper::~WebDataServiceWrapper() {
 }
 
-void WebDataServiceWrapper::Shutdown() {
-  autofill_web_data_->ShutdownOnUIThread();
-  web_data_->ShutdownOnUIThread();
-  web_database_->ShutdownDatabase();
-}
-
 scoped_refptr<AutofillWebDataService>
 WebDataServiceWrapper::GetAutofillWebData() {
   return autofill_web_data_.get();
@@ -120,7 +114,6 @@ WebDataServiceFactory::WebDataServiceFactory(){
 WebDataServiceFactory::~WebDataServiceFactory() {}
 
 // static
-
 WebDataServiceWrapper* WebDataServiceFactory::GetDataService() {
   return WebDataServiceWrapper::GetInstance();
 }
index af51002..e307dbd 100644 (file)
@@ -12,6 +12,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/singleton.h"
 #include "components/webdata/common/web_database_service.h"
+#include "web_data_service.h"
 
 class WebDataService;
 
@@ -25,8 +26,6 @@ class WebDataServiceWrapper{
 
   virtual ~WebDataServiceWrapper();
 
-  virtual void Shutdown() override;
-
   virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
 
   virtual scoped_refptr<WebDataService> GetWebData();
index 07ca688..7b0d2c2 100644 (file)
@@ -7,7 +7,13 @@
 #include "base/bind.h"
 #include "base/files/file_util.h"
 #include "base/path_service.h"
+#include "base/prefs/pref_registry_simple.h"
+#include "base/prefs/pref_service.h"
+#include "base/prefs/pref_service_factory.h"
+#include "browser/autofill/autofill_pref_store_efl.h"
 #include "browser/geolocation/geolocation_permission_context_efl.h"
+#include "components/autofill/core/common/autofill_pref_names.h"
+#include "components/user_prefs/user_prefs.h"
 #include "components/visitedlink/browser/visitedlink_master.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/render_view_host.h"
@@ -15,6 +21,7 @@
 #include "eweb_context.h"
 #include "paths_efl.h"
 
+using namespace autofill::prefs;
 using std::pair;
 
 namespace content {
@@ -102,6 +109,10 @@ void BrowserContextEfl::ResourceContextEfl::set_notification_controller_efl(
 }
 #endif
 
+PrefService* BrowserContextEfl::GetUserPrefService() const {
+  return user_pref_service_.get();
+}
+
 BrowserContextEfl::BrowserContextEfl(EWebContext* web_context, bool incognito)
   : resource_context_(NULL),
     web_context_(web_context),
@@ -251,4 +262,29 @@ const GeolocationPermissionContextEfl&
   return *(geolocation_permission_context_.get());
 }
 
+// Shows notifications which correspond to PersistentPrefStore's reading errors.
+void HandleReadError(PersistentPrefStore::PrefReadError error) {
+  NOTIMPLEMENTED();
+}
+
+// Create user pref service for autofill functionality.
+void BrowserContextEfl::CreateUserPrefServiceIfNecessary() {
+  if (user_pref_service_)
+    return;
+
+  PrefRegistrySimple* pref_registry = new PrefRegistrySimple();
+
+  pref_registry->RegisterBooleanPref(kAutofillEnabled, true);
+  pref_registry->RegisterBooleanPref(kAutofillAuxiliaryProfilesEnabled, true);
+  pref_registry->RegisterDoublePref(kAutofillPositiveUploadRate, 0.0);
+  pref_registry->RegisterDoublePref(kAutofillNegativeUploadRate, 0.0);
+
+  base::PrefServiceFactory pref_service_factory;
+  pref_service_factory.set_user_prefs(make_scoped_refptr(new AutofillPrefStore()));
+  pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError));
+  user_pref_service_ = pref_service_factory.Create(pref_registry).Pass();
+
+  user_prefs::UserPrefs::Set(this, user_pref_service_.get());
+}
+
 }
index 318c6dc..844cc8a 100644 (file)
@@ -24,6 +24,7 @@
 #include "net/url_request/url_request_context.h"
 
 class CookieManager;
+class PrefService;
 class EWebContext;
 
 namespace visitedlink {
@@ -130,6 +131,9 @@ class BrowserContextEfl
   scoped_refptr<content::NotificationControllerEfl>
       GetNotificationController() const;
 #endif
+  PrefService* GetUserPrefService() const;
+
+  void CreateUserPrefServiceIfNecessary();
 
  private:
   static void ReadCertificateAndAdd(base::FilePath* file_path);
@@ -137,6 +141,7 @@ class BrowserContextEfl
   mutable scoped_ptr<GeolocationPermissionContextEfl>
       geolocation_permission_context_;
   scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
+
   ResourceContextEfl* resource_context_;
   scoped_refptr<URLRequestContextGetterEfl> request_context_getter_;
   EWebContext* web_context_;
@@ -146,6 +151,7 @@ class BrowserContextEfl
   DownloadManagerDelegateEfl download_manager_delegate_;
   base::ScopedTempDir temp_dir_;
   bool temp_dir_creation_attempted_;
+  scoped_ptr<PrefService> user_pref_service_;
   const bool incognito_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserContextEfl);
index 5c2dd47..9fca391 100644 (file)
       '<(chrome_src_dir)/components/components.gyp:visitedlink_renderer',
       '<(chrome_src_dir)/third_party/icu/icu.gyp:icuuc',
       '<(chrome_src_dir)/components/components.gyp:sessions_content',
-# [M37] TODO:Autofill related code chagned. Need to enable after Fixing.
-      #'<(chrome_src_dir)/components/components.gyp:autofill_content_renderer',
-      #'<(chrome_src_dir)/components/components.gyp:autofill_content_browser',
-      #'<(chrome_src_dir)/components/components.gyp:password_manager_core_common',
-      #'<(chrome_src_dir)/components/components.gyp:password_manager_core_browser',
+      '<(chrome_src_dir)/components/components.gyp:autofill_content_renderer',
+      '<(chrome_src_dir)/components/components.gyp:autofill_content_browser',
+      '<(chrome_src_dir)/components/components.gyp:password_manager_core_common',
+      '<(chrome_src_dir)/components/components.gyp:password_manager_core_browser',
     ],
     'defines': [
       'CHROMIUMCORE_IMPLEMENTATION=1',
       'API/ewk_web_application_icon_data_private.h',
       'API/ewk_web_application_icon_data_private.cc',
       'API/ewk_window_features_private.h',
+      'API/ewk_context_form_autofill_profile_private.h',
+      'API/ewk_context_form_autofill_profile_private.cc',
       'EdgeEffect.cpp',
       'EdgeEffect.h',
       'browser/autofill/autofill_manager_delegate_efl.cc',
       'browser/autofill/autofill_manager_delegate_efl.h',
       'browser/autofill/personal_data_manager_factory.cc',
       'browser/autofill/personal_data_manager_factory.h',
+      'browser/autofill/autofill_pref_store_efl.cc',
+      'browser/autofill/autofill_pref_store_efl.h',
       'browser/device_sensors/data_fetcher_impl_tizen.cc',
       'browser/device_sensors/data_fetcher_impl_tizen.h',
       'browser/device_sensors/data_fetcher_shared_memory_tizen.cc',
index 80b9608..36dd596 100644 (file)
@@ -25,8 +25,7 @@
       'BUILDING_V8_SHARED=1',
       'V8_SHARED=1',
       'USE_DL_PREFIX=1',
-# [M37] TODO:Autofill related code chagned. Need to enable after Fixing.
-      #'TIZEN_AUTOFILL_SUPPORT=1',
+      'TIZEN_AUTOFILL_SUPPORT=1',
     ],
     # use_aura is enabled but clipboard_efl.cc implements clipboard.
     'sources/': [
       ['exclude', 'browser/web_contents/web_contents_view_aura\\.cc$'],
       ['exclude', 'clipboard/clipboard_aurax11\\.cc$'],
       ['exclude', 'gl_context_egl\\.cc$'],
+      ['exclude', 'password_manager/core/browser/password_autofill_manager.(h|cc)$'],
+      ['exclude', 'password_manager/core/browser/password_form_manager.(h|cc)$'],
+      ['exclude', 'password_manager/core/browser/password_generation_manager.(h|cc)$'],
+      ['exclude', 'password_manager/core/browser/password_manager.(h|cc)$'],
+      ['exclude', 'password_manager/core/browser/password_manager_client.(h|cc)$'],
+      ['exclude', 'password_manager/core/browser/password_manager_driver.h'],
+      ['exclude', 'password_manager/core/browser/password_manager_internals_service.(h|cc)$'],
       ['exclude', 'x11_event_source_glib\\.cc$'],
       ['exclude', 'x11_event_source_libevent\\.cc$'],
       ['exclude', 'x11_types\\.cc$'],
index 41dd534..ba64593 100644 (file)
@@ -235,6 +235,7 @@ EWebContext::EWebContext(bool incognito)
   CHECK(EwkGlobalData::GetInstance());
 
   browser_context_.reset(new BrowserContextEfl(this));
+  browser_context_.get()->CreateUserPrefServiceIfNecessary();
   // Notification Service gets init in BrowserMainRunner init,
   // so cache manager can register for notifications only after that.
   web_cache_manager_.reset(new WebCacheManagerEfl(browser_context_.get()));
@@ -252,11 +253,13 @@ void EWebContext::ClearNetworkCache() {
 }
 
 void EWebContext::ClearWebkitCache() {
-  web_cache_manager_->ClearCache();
+  if (web_cache_manager_)
+    web_cache_manager_->ClearCache();
 }
 
 void EWebContext::SetCacheModel(Cache_Model model) {
-  web_cache_manager_->SetCacheModel(model);
+  if (web_cache_manager_)
+    web_cache_manager_->SetCacheModel(model);
 }
 
 Cache_Model EWebContext::GetCacheModel() const {
@@ -470,11 +473,16 @@ Evas_Object *EWebContext::AddFaviconObject(const char* uri, Evas* canvas) const
 
 void EWebContext::ClearCandidateData() {
 #ifdef TIZEN_AUTOFILL_SUPPORT
-  WebDataServiceFactory* webDataServiceInstance = WebDataServiceFactory::GetInstance();
-  scoped_refptr<autofill::AutofillWebDataService> autofillWebDataService = webDataServiceInstance->GetAutofillWebDataForProfile();
-  if(autofillWebDataService) {
-    //RemoveFormElementsAddedBetween will schedule task on proper thread, it is done in WebDatabaseService::ScheduleDBTask
-    autofillWebDataService->RemoveFormElementsAddedBetween(base::Time(), base::Time::Max());
+  WebDataServiceFactory* webDataServiceInstance =
+      WebDataServiceFactory::GetInstance();
+  scoped_refptr<autofill::AutofillWebDataService> autofillWebDataService =
+      webDataServiceInstance->GetAutofillWebDataForProfile();
+  if (autofillWebDataService.get()) {
+    // RemoveFormElementsAddedBetween will schedule task on proper thread,
+    // it is done in WebDatabaseService::ScheduleDBTask
+    autofillWebDataService->RemoveFormElementsAddedBetween(
+        base::Time(), 
+        base::Time::Max());
   } else {
     DLOG(WARNING) << "AutofillWebDataService is NULL";
   }
@@ -485,8 +493,9 @@ void EWebContext::ClearCandidateData() {
 
 void EWebContext::ClearPasswordData() {
 #if defined(TIZEN_AUTOFILL_SUPPORT)
-  PasswordStore* store = PasswordStoreFactory::GetPasswordStore();
-  if (store)
+  scoped_refptr<password_manager::PasswordStore> store =
+      password_manager::PasswordStoreFactory::GetPasswordStore();
+  if (store.get())
     store->RemoveLoginsCreatedBetween(base::Time(), base::Time::Max());
 #else
   DLOG(WARNING) << "TIZEN_AUTOFILL_SUPPORT is not enabled";
index 36cfe0f..a4e8e72 100644 (file)
 #ifdef TIZEN_AUTOFILL_SUPPORT
 #include "browser/autofill/autofill_manager_delegate_efl.h"
 #include "browser/password_manager/password_manager_client_efl.h"
-#include "components/autofill/content/browser/autofill_driver_impl.h"
+#include "components/autofill/content/browser/content_autofill_driver.h"
+#include "components/autofill/core/browser/autofill_client.h"
 #include "components/autofill/core/browser/autofill_manager.h"
 #include "components/web_modal/web_contents_modal_dialog_manager.h"
 
-using autofill::AutofillDriverImpl;
 using autofill::AutofillManager;
 using autofill::AutofillManagerDelegateEfl;
+using autofill::ContentAutofillDriver;
+using password_manager::PasswordManagerClientEfl;
 #endif
-
 using base::string16;
 using namespace tizen_webview;
 using namespace ui;
@@ -72,11 +73,13 @@ WebContentsDelegateEfl::WebContentsDelegateEfl(EWebView* view)
     , weak_ptr_factory_(this) {
 #ifdef TIZEN_AUTOFILL_SUPPORT
   AutofillManagerDelegateEfl::CreateForWebContents(&web_contents_);
-  AutofillManagerDelegateEfl * autofill_manager =
-    AutofillManagerDelegateEfl::FromWebContents(&web_contents_);
+  AutofillManagerDelegateEfl* autofill_manager =
+      AutofillManagerDelegateEfl::FromWebContents(&web_contents_);
   autofill_manager->SetEWebView(view);
-  AutofillDriverImpl::CreateForWebContentsAndDelegate(&web_contents_,
-    autofill_manager, EWebView::GetPlatformLocale(), AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
+  ContentAutofillDriver::CreateForWebContentsAndDelegate(&web_contents_,
+      autofill_manager,
+      EWebView::GetPlatformLocale(),
+      AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
   PasswordManagerClientEfl::CreateForWebContents(&web_contents_);
 #endif
 }