diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 19:36:16 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 19:36:16 +0000 |
commit | e768baf6ebf5a49cc19d58d1761321b175c82c18 (patch) | |
tree | c29fb1ebcef46d9ad929ed1fd68f954a04f97b06 /chrome/renderer | |
parent | a850e9592bb1a8c43275116ff565c91b4b1cb66b (diff) | |
download | chromium_src-e768baf6ebf5a49cc19d58d1761321b175c82c18.zip chromium_src-e768baf6ebf5a49cc19d58d1761321b175c82c18.tar.gz chromium_src-e768baf6ebf5a49cc19d58d1761321b175c82c18.tar.bz2 |
Separate the PasswordManagerDelegate out of PasswordManager.
Previously, anyone who included tab_contents.h would bring in a bunch of
implementation details of the password manager from webkit_glue. This breaks
the delegate interface out of the rest of password manager system and makes
FillData not an inner-class so anyone can forward declare FillData instead of
having to include the header to meet a delegate interface.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2877022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/password_autocomplete_manager.cc | 21 | ||||
-rw-r--r-- | chrome/renderer/password_autocomplete_manager.h | 14 | ||||
-rw-r--r-- | chrome/renderer/password_autocomplete_manager_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 2 |
5 files changed, 24 insertions, 20 deletions
diff --git a/chrome/renderer/password_autocomplete_manager.cc b/chrome/renderer/password_autocomplete_manager.cc index a715a58..f8f10ec 100644 --- a/chrome/renderer/password_autocomplete_manager.cc +++ b/chrome/renderer/password_autocomplete_manager.cc @@ -169,9 +169,12 @@ PasswordAutocompleteManager::PasswordAutocompleteManager( : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { } +PasswordAutocompleteManager::~PasswordAutocompleteManager() { +} + void PasswordAutocompleteManager::ReceivedPasswordFormFillData( WebKit::WebView* view, - const webkit_glue::PasswordFormDomManager::FillData& form_data) { + const webkit_glue::PasswordFormFillData& form_data) { FormElementsList forms; // We own the FormElements* in forms. FindFormElements(view, form_data.basic_data, &forms); @@ -222,7 +225,7 @@ void PasswordAutocompleteManager::TextFieldDidEndEditing( if (iter == login_to_password_info_.end()) return; - const webkit_glue::PasswordFormDomManager::FillData& fill_data = + const webkit_glue::PasswordFormFillData& fill_data = iter->second.fill_data; // If wait_for_username is false, we should have filled when the text changed. @@ -303,7 +306,7 @@ bool PasswordAutocompleteManager::FillPassword( login_to_password_info_.find(user_input); if (iter == login_to_password_info_.end()) return false; - const webkit_glue::PasswordFormDomManager::FillData& fill_data = + const webkit_glue::PasswordFormFillData& fill_data = iter->second.fill_data; WebKit::WebInputElement password = iter->second.password_field; WebKit::WebInputElement non_const_user_input(user_input); @@ -314,7 +317,7 @@ bool PasswordAutocompleteManager::FillPassword( void PasswordAutocompleteManager::PerformInlineAutocomplete( const WebKit::WebInputElement& username_input, const WebKit::WebInputElement& password_input, - const webkit_glue::PasswordFormDomManager::FillData& fill_data) { + const webkit_glue::PasswordFormFillData& fill_data) { DCHECK(!fill_data.wait_for_username); // We need non-const versions of the username and password inputs. @@ -339,13 +342,13 @@ void PasswordAutocompleteManager::PerformInlineAutocomplete( // PasswordAutocompleteManager, private: void PasswordAutocompleteManager::GetSuggestions( - const webkit_glue::PasswordFormDomManager::FillData& fill_data, + const webkit_glue::PasswordFormFillData& fill_data, const string16& input, std::vector<string16>* suggestions) { if (StartsWith(fill_data.basic_data.fields[0].value(), input, false)) suggestions->push_back(fill_data.basic_data.fields[0].value()); - webkit_glue::PasswordFormDomManager::LoginCollection::const_iterator iter; + webkit_glue::PasswordFormFillData::LoginCollection::const_iterator iter; for (iter = fill_data.additional_logins.begin(); iter != fill_data.additional_logins.end(); ++iter) { if (StartsWith(iter->first, input, false)) @@ -354,7 +357,7 @@ void PasswordAutocompleteManager::GetSuggestions( } bool PasswordAutocompleteManager::ShowSuggestionPopup( - const webkit_glue::PasswordFormDomManager::FillData& fill_data, + const webkit_glue::PasswordFormFillData& fill_data, const WebKit::WebInputElement& user_input) { std::vector<string16> suggestions; GetSuggestions(fill_data, user_input.value(), &suggestions); @@ -372,7 +375,7 @@ bool PasswordAutocompleteManager::ShowSuggestionPopup( bool PasswordAutocompleteManager::FillUserNameAndPassword( WebKit::WebInputElement* username_element, WebKit::WebInputElement* password_element, - const webkit_glue::PasswordFormDomManager::FillData& fill_data, + const webkit_glue::PasswordFormFillData& fill_data, bool exact_username_match) { string16 current_username = username_element->value(); // username and password will contain the match found if any. @@ -386,7 +389,7 @@ bool PasswordAutocompleteManager::FillUserNameAndPassword( password = fill_data.basic_data.fields[1].value(); } else { // Scan additional logins for a match. - webkit_glue::PasswordFormDomManager::LoginCollection::const_iterator iter; + webkit_glue::PasswordFormFillData::LoginCollection::const_iterator iter; for (iter = fill_data.additional_logins.begin(); iter != fill_data.additional_logins.end(); ++iter) { if (DoUsernamesMatch(iter->first, current_username, diff --git a/chrome/renderer/password_autocomplete_manager.h b/chrome/renderer/password_autocomplete_manager.h index a931026..5e2eee2 100644 --- a/chrome/renderer/password_autocomplete_manager.h +++ b/chrome/renderer/password_autocomplete_manager.h @@ -23,13 +23,13 @@ class WebView; class PasswordAutocompleteManager { public: explicit PasswordAutocompleteManager(RenderView* render_view); - virtual ~PasswordAutocompleteManager() {} + virtual ~PasswordAutocompleteManager(); // Invoked by the renderer when it receives the password info from the // browser. This triggers a password autocomplete (if wait_for_username is // false on |form_data|). void ReceivedPasswordFormFillData(WebKit::WebView* view, - const webkit_glue::PasswordFormDomManager::FillData& form_data); + const webkit_glue::PasswordFormFillData& form_data); // Invoked when the passed frame is closing. Gives us a chance to clear any // reference we may have to elements in that frame. @@ -46,7 +46,7 @@ class PasswordAutocompleteManager { void PerformInlineAutocomplete( const WebKit::WebInputElement& username, const WebKit::WebInputElement& password, - const webkit_glue::PasswordFormDomManager::FillData& fill_data); + const webkit_glue::PasswordFormFillData& fill_data); // WebViewClient editor related calls forwarded by the RenderView. void TextFieldDidBeginEditing(const WebKit::WebInputElement& element); @@ -58,25 +58,25 @@ class PasswordAutocompleteManager { private: struct PasswordInfo { WebKit::WebInputElement password_field; - webkit_glue::PasswordFormDomManager::FillData fill_data; + webkit_glue::PasswordFormFillData fill_data; bool backspace_pressed_last; PasswordInfo() : backspace_pressed_last(false) {} }; typedef std::map<WebKit::WebElement, PasswordInfo> LoginToPasswordInfoMap; void GetSuggestions( - const webkit_glue::PasswordFormDomManager::FillData& fill_data, + const webkit_glue::PasswordFormFillData& fill_data, const string16& input, std::vector<string16>* suggestions); bool ShowSuggestionPopup( - const webkit_glue::PasswordFormDomManager::FillData& fill_data, + const webkit_glue::PasswordFormFillData& fill_data, const WebKit::WebInputElement& user_input); bool FillUserNameAndPassword( WebKit::WebInputElement* username_element, WebKit::WebInputElement* password_element, - const webkit_glue::PasswordFormDomManager::FillData& fill_data, + const webkit_glue::PasswordFormFillData& fill_data, bool exact_username_match); // The logins we have filled so far with their associated info. diff --git a/chrome/renderer/password_autocomplete_manager_unittest.cc b/chrome/renderer/password_autocomplete_manager_unittest.cc index fc32332..3106704 100644 --- a/chrome/renderer/password_autocomplete_manager_unittest.cc +++ b/chrome/renderer/password_autocomplete_manager_unittest.cc @@ -18,6 +18,7 @@ #include "webkit/glue/form_field.h" using webkit_glue::FormField; +using webkit_glue::PasswordFormFillData; using webkit_glue::PasswordForm; using webkit_glue::PasswordFormDomManager; using WebKit::WebDocument; @@ -53,7 +54,7 @@ class PasswordAutocompleteManagerTest : public RenderViewTest { // We use that so we don't have to make RenderView::OnFillPasswordForm() // protected. void SimulateOnFillPasswordForm( - const PasswordFormDomManager::FillData& fill_data) { + const PasswordFormFillData& fill_data) { ViewMsg_FillPasswordForm msg(0, fill_data); view_->OnMessageReceived(msg); } @@ -141,7 +142,7 @@ class PasswordAutocompleteManagerTest : public RenderViewTest { string16 username2_; string16 password1_; string16 password2_; - PasswordFormDomManager::FillData fill_data_; + PasswordFormFillData fill_data_; WebInputElement username_element_; WebInputElement password_element_; diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index c725aa4..3d766a3 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -3904,7 +3904,7 @@ void RenderView::OnDragSourceSystemDragEnded() { } void RenderView::OnFillPasswordForm( - const webkit_glue::PasswordFormDomManager::FillData& form_data) { + const webkit_glue::PasswordFormFillData& form_data) { #if defined(WEBKIT_BUG_41283_IS_FIXED) password_autocomplete_manager_.ReceivedPasswordFormFillData(webview(), form_data); diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 5320c52..01fac5b 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -775,7 +775,7 @@ class RenderView : public RenderWidget, void OnNavigate(const ViewMsg_Navigate_Params& params); void OnNotifyRendererViewType(ViewType::Type view_type); void OnFillPasswordForm( - const webkit_glue::PasswordFormDomManager::FillData& form_data); + const webkit_glue::PasswordFormFillData& form_data); void OnPaste(); void OnPrintingDone(int document_cookie, bool success); void OnPrintPages(); |