Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10907021: Fix a memory leak in PasswordGenerationManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 NavigationState* navigation_state = document_state->navigation_state(); 2818 NavigationState* navigation_state = document_state->navigation_state();
2819 2819
2820 if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK) 2820 if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK)
2821 navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT); 2821 navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT);
2822 2822
2823 // Save these to be processed when the ensuing navigation is committed. 2823 // Save these to be processed when the ensuing navigation is committed.
2824 WebSearchableFormData web_searchable_form_data(form); 2824 WebSearchableFormData web_searchable_form_data(form);
2825 document_state->set_searchable_form_url(web_searchable_form_data.url()); 2825 document_state->set_searchable_form_url(web_searchable_form_data.url());
2826 document_state->set_searchable_form_encoding( 2826 document_state->set_searchable_form_encoding(
2827 web_searchable_form_data.encoding().utf8()); 2827 web_searchable_form_data.encoding().utf8());
2828 PasswordForm* password_form_data = 2828 scoped_ptr<PasswordForm> password_form_data =
2829 PasswordFormDomManager::CreatePasswordForm(form); 2829 PasswordFormDomManager::CreatePasswordForm(form);
2830 document_state->set_password_form_data(password_form_data);
2831 2830
2832 // In order to save the password that the user actually typed and not one 2831 // In order to save the password that the user actually typed and not one
2833 // that may have gotten transformed by the site prior to submit, recover it 2832 // that may have gotten transformed by the site prior to submit, recover it
2834 // from the form contents already stored by |willSendSubmitEvent| into the 2833 // from the form contents already stored by |willSendSubmitEvent| into the
2835 // dataSource's NavigationState (as opposed to the provisionalDataSource's, 2834 // dataSource's NavigationState (as opposed to the provisionalDataSource's,
2836 // which is what we're storing into now.) 2835 // which is what we're storing into now.)
2837 if (password_form_data) { 2836 if (password_form_data.get()) {
2838 DocumentState* old_document_state = 2837 DocumentState* old_document_state =
2839 DocumentState::FromDataSource(frame->dataSource()); 2838 DocumentState::FromDataSource(frame->dataSource());
2840 if (old_document_state) { 2839 if (old_document_state) {
2841 PasswordForm* old_form_data = old_document_state->password_form_data(); 2840 PasswordForm* old_form_data = old_document_state->password_form_data();
2842 if (old_form_data && old_form_data->action == password_form_data->action) 2841 if (old_form_data && old_form_data->action == password_form_data->action)
2843 password_form_data->password_value = old_form_data->password_value; 2842 password_form_data->password_value = old_form_data->password_value;
2844 } 2843 }
2845 } 2844 }
2846 2845
2846 document_state->set_password_form_data(password_form_data.Pass());
2847
2847 FOR_EACH_OBSERVER( 2848 FOR_EACH_OBSERVER(
2848 RenderViewObserver, observers_, WillSubmitForm(frame, form)); 2849 RenderViewObserver, observers_, WillSubmitForm(frame, form));
2849 } 2850 }
2850 2851
2851 void RenderViewImpl::willPerformClientRedirect( 2852 void RenderViewImpl::willPerformClientRedirect(
2852 WebFrame* frame, const WebURL& from, const WebURL& to, double interval, 2853 WebFrame* frame, const WebURL& from, const WebURL& to, double interval,
2853 double fire_time) { 2854 double fire_time) {
2854 FOR_EACH_OBSERVER( 2855 FOR_EACH_OBSERVER(
2855 RenderViewObserver, observers_, 2856 RenderViewObserver, observers_,
2856 WillPerformClientRedirect(frame, from, to, interval, fire_time)); 2857 WillPerformClientRedirect(frame, from, to, interval, fire_time));
(...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after
6045 6046
6046 updating_frame_tree_ = true; 6047 updating_frame_tree_ = true;
6047 active_frame_id_map_.clear(); 6048 active_frame_id_map_.clear();
6048 6049
6049 target_process_id_ = process_id; 6050 target_process_id_ = process_id;
6050 target_routing_id_ = route_id; 6051 target_routing_id_ = route_id;
6051 CreateFrameTree(webview()->mainFrame(), frames); 6052 CreateFrameTree(webview()->mainFrame(), frames);
6052 6053
6053 updating_frame_tree_ = false; 6054 updating_frame_tree_ = false;
6054 } 6055 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698