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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 651002: AutoFill forms. We do this by responding to a message from WebKit which send... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/glue/form_field_values.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) 560 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
561 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) 561 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged)
562 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, 562 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost,
563 OnMessageFromExternalHost) 563 OnMessageFromExternalHost)
564 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, 564 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount,
565 OnDisassociateFromPopupCount) 565 OnDisassociateFromPopupCount)
566 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned, 566 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned,
567 OnAutoFillSuggestionsReturned) 567 OnAutoFillSuggestionsReturned)
568 IPC_MESSAGE_HANDLER(ViewMsg_AutocompleteSuggestionsReturned, 568 IPC_MESSAGE_HANDLER(ViewMsg_AutocompleteSuggestionsReturned,
569 OnAutocompleteSuggestionsReturned) 569 OnAutocompleteSuggestionsReturned)
570 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillFormDataFilled,
571 OnAutoFillFormDataFilled)
570 IPC_MESSAGE_HANDLER(ViewMsg_PopupNotificationVisibilityChanged, 572 IPC_MESSAGE_HANDLER(ViewMsg_PopupNotificationVisibilityChanged,
571 OnPopupNotificationVisibilityChanged) 573 OnPopupNotificationVisibilityChanged)
572 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) 574 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
573 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) 575 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse)
574 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, 576 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke,
575 OnExtensionMessageInvoke) 577 OnExtensionMessageInvoke)
576 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) 578 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode)
577 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) 579 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground)
578 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, 580 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode,
579 OnEnablePreferredSizeChangedMode) 581 OnEnablePreferredSizeChangedMode)
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 int query_id, 1431 int query_id,
1430 const std::vector<string16>& suggestions, 1432 const std::vector<string16>& suggestions,
1431 int default_suggestion_index) { 1433 int default_suggestion_index) {
1432 if (webview() && query_id == autofill_query_id_) { 1434 if (webview() && query_id == autofill_query_id_) {
1433 webview()->applyAutocompleteSuggestions( 1435 webview()->applyAutocompleteSuggestions(
1434 autofill_query_node_, suggestions, default_suggestion_index); 1436 autofill_query_node_, suggestions, default_suggestion_index);
1435 } 1437 }
1436 autofill_query_node_.reset(); 1438 autofill_query_node_.reset();
1437 } 1439 }
1438 1440
1441 void RenderView::OnAutoFillFormDataFilled(int query_id, const FormData& form) {
1442 if (query_id != autofill_query_id_)
1443 return;
1444
1445 form_manager_.FillForm(form);
1446 }
1447
1439 void RenderView::OnPopupNotificationVisibilityChanged(bool visible) { 1448 void RenderView::OnPopupNotificationVisibilityChanged(bool visible) {
1440 popup_notification_visible_ = visible; 1449 popup_notification_visible_ = visible;
1441 } 1450 }
1442 1451
1443 uint32 RenderView::GetCPBrowsingContext() { 1452 uint32 RenderView::GetCPBrowsingContext() {
1444 uint32 context = 0; 1453 uint32 context = 0;
1445 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); 1454 Send(new ViewHostMsg_GetCPBrowsingContext(&context));
1446 return context; 1455 return context;
1447 } 1456 }
1448 1457
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 node.toConstElement<WebInputElement>(); 1948 node.toConstElement<WebInputElement>();
1940 Send(new ViewHostMsg_QueryFormFieldAutofill( 1949 Send(new ViewHostMsg_QueryFormFieldAutofill(
1941 routing_id_, autofill_query_id_, FormField(input_element))); 1950 routing_id_, autofill_query_id_, FormField(input_element)));
1942 } 1951 }
1943 1952
1944 void RenderView::removeAutofillSuggestions(const WebString& name, 1953 void RenderView::removeAutofillSuggestions(const WebString& name,
1945 const WebString& value) { 1954 const WebString& value) {
1946 Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value)); 1955 Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value));
1947 } 1956 }
1948 1957
1958 void RenderView::didAcceptAutoFillSuggestion(
1959 const WebKit::WebNode& node,
1960 const WebKit::WebString& name,
1961 const WebKit::WebString& label) {
1962 static int query_counter = 0;
1963 autofill_query_id_ = query_counter++;
1964
1965 FormData form;
1966 const WebInputElement element = node.toConstElement<WebInputElement>();
1967 if (!form_manager_.FindForm(element, &form))
1968 return;
1969
1970 Send(new ViewHostMsg_FillAutoFillFormData(
1971 routing_id_, autofill_query_id_, form, name, label));
1972 }
1973
1949 // WebKit::WebWidgetClient ---------------------------------------------------- 1974 // WebKit::WebWidgetClient ----------------------------------------------------
1950 1975
1951 // We are supposed to get a single call to Show for a newly created RenderView 1976 // We are supposed to get a single call to Show for a newly created RenderView
1952 // that was created via RenderView::CreateWebView. So, we wait until this 1977 // that was created via RenderView::CreateWebView. So, we wait until this
1953 // point to dispatch the ShowView message. 1978 // point to dispatch the ShowView message.
1954 // 1979 //
1955 // This method provides us with the information about how to display the newly 1980 // This method provides us with the information about how to display the newly
1956 // created RenderView (i.e., as a constrained popup or as a new tab). 1981 // created RenderView (i.e., as a constrained popup or as a new tab).
1957 // 1982 //
1958 void RenderView::show(WebNavigationPolicy policy) { 1983 void RenderView::show(WebNavigationPolicy policy) {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 WebDataSource* ds = frame->dataSource(); 2580 WebDataSource* ds = frame->dataSource();
2556 NavigationState* navigation_state = NavigationState::FromDataSource(ds); 2581 NavigationState* navigation_state = NavigationState::FromDataSource(ds);
2557 DCHECK(navigation_state); 2582 DCHECK(navigation_state);
2558 navigation_state->set_finish_document_load_time(Time::Now()); 2583 navigation_state->set_finish_document_load_time(Time::Now());
2559 2584
2560 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_)); 2585 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_));
2561 2586
2562 // The document has now been fully loaded. Scan for forms to be sent up to 2587 // The document has now been fully loaded. Scan for forms to be sent up to
2563 // the browser. 2588 // the browser.
2564 // TODO(jhawkins): Make these use the FormManager. 2589 // TODO(jhawkins): Make these use the FormManager.
2590 form_manager_.ExtractForms(frame);
2565 SendForms(frame); 2591 SendForms(frame);
2566 SendPasswordForms(frame); 2592 SendPasswordForms(frame);
2567 2593
2568 // Check whether we have new encoding name. 2594 // Check whether we have new encoding name.
2569 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 2595 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
2570 2596
2571 if (RenderThread::current()) { // Will be NULL during unit tests. 2597 if (RenderThread::current()) { // Will be NULL during unit tests.
2572 RenderThread::current()->user_script_slave()->InjectScripts( 2598 RenderThread::current()->user_script_slave()->InjectScripts(
2573 frame, UserScript::DOCUMENT_END); 2599 frame, UserScript::DOCUMENT_END);
2574 } 2600 }
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
4482 int32 height, 4508 int32 height,
4483 uint64 io_surface_identifier) { 4509 uint64 io_surface_identifier) {
4484 Send(new ViewHostMsg_GPUPluginSetIOSurface( 4510 Send(new ViewHostMsg_GPUPluginSetIOSurface(
4485 routing_id(), window, width, height, io_surface_identifier)); 4511 routing_id(), window, width, height, io_surface_identifier));
4486 } 4512 }
4487 4513
4488 void RenderView::GPUPluginBuffersSwapped(gfx::PluginWindowHandle window) { 4514 void RenderView::GPUPluginBuffersSwapped(gfx::PluginWindowHandle window) {
4489 Send(new ViewHostMsg_GPUPluginBuffersSwapped(routing_id(), window)); 4515 Send(new ViewHostMsg_GPUPluginBuffersSwapped(routing_id(), window));
4490 } 4516 }
4491 #endif 4517 #endif
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/glue/form_field_values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698