diff options
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/form_manager.cc | 16 | ||||
-rw-r--r-- | chrome/renderer/form_manager.h | 6 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc index ab9e9e7..e39c3b1 100644 --- a/chrome/renderer/form_manager.cc +++ b/chrome/renderer/form_manager.cc @@ -470,6 +470,14 @@ void FormManager::Reset() { form_elements_map_.clear(); } +void FormManager::ResetFrame(const WebFrame* frame) { + WebFrameFormElementMap::iterator iter = form_elements_map_.find(frame); + if (iter != form_elements_map_.end()) { + STLDeleteElements(&iter->second); + form_elements_map_.erase(iter); + } +} + // static bool FormManager::FormElementToFormData(const WebFrame* frame, const FormElement* form_element, @@ -515,14 +523,6 @@ bool FormManager::FormElementToFormData(const WebFrame* frame, return true; } -void FormManager::ResetFrame(const WebFrame* frame) { - WebFrameFormElementMap::iterator iter = form_elements_map_.find(frame); - if (iter != form_elements_map_.end()) { - STLDeleteElements(&iter->second); - form_elements_map_.erase(iter); - } -} - // static string16 FormManager::InferLabelForElement( const WebFormControlElement& element) { diff --git a/chrome/renderer/form_manager.h b/chrome/renderer/form_manager.h index c35d780..67d50a9 100644 --- a/chrome/renderer/form_manager.h +++ b/chrome/renderer/form_manager.h @@ -96,6 +96,9 @@ class FormManager { // Resets the stored set of forms. void Reset(); + // Resets the forms for the specified |frame|. + void ResetFrame(const WebKit::WebFrame* frame); + private: // Stores the WebFormElement and the form control elements for a form. struct FormElement { @@ -116,9 +119,6 @@ class FormManager { RequirementsMask requirements, webkit_glue::FormData* form); - // Resets the forms for the specified |frame|. - void ResetFrame(const WebKit::WebFrame* frame); - // Infers corresponding label for |element| from surrounding context in the // DOM. Contents of preceeding <p> tag or preceeding text element found in // the form. diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index d3c1744..804df48 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2205,6 +2205,8 @@ void RenderView::willClose(WebFrame* frame) { WebDataSource* ds = frame->dataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); navigation_state->user_script_idle_scheduler()->Cancel(); + + form_manager_.ResetFrame(frame); } bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { |