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

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

Issue 279001: Move autofill related WebView{Delegate} methods into the WebKit API.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/api/public/WebView.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 last_indexed_page_id_(-1), 216 last_indexed_page_id_(-1),
217 opened_by_user_gesture_(true), 217 opened_by_user_gesture_(true),
218 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 218 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
219 devtools_agent_(NULL), 219 devtools_agent_(NULL),
220 devtools_client_(NULL), 220 devtools_client_(NULL),
221 file_chooser_completion_(NULL), 221 file_chooser_completion_(NULL),
222 history_back_list_count_(0), 222 history_back_list_count_(0),
223 history_forward_list_count_(0), 223 history_forward_list_count_(0),
224 has_unload_listener_(false), 224 has_unload_listener_(false),
225 decrement_shared_popup_at_destruction_(false), 225 decrement_shared_popup_at_destruction_(false),
226 form_field_autofill_request_id_(0), 226 autofill_query_id_(0),
227 form_field_autofill_node_id_(0),
228 popup_notification_visible_(false), 227 popup_notification_visible_(false),
229 spelling_panel_visible_(false), 228 spelling_panel_visible_(false),
230 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync), 229 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync),
231 preferred_width_(0), 230 preferred_width_(0),
232 send_preferred_width_changes_(false), 231 send_preferred_width_changes_(false),
233 ALLOW_THIS_IN_INITIALIZER_LIST( 232 ALLOW_THIS_IN_INITIALIZER_LIST(
234 notification_provider_(new NotificationProvider(this))), 233 notification_provider_(new NotificationProvider(this))),
235 determine_page_text_after_loading_stops_(false), 234 determine_page_text_after_loading_stops_(false),
236 view_type_(ViewType::INVALID), 235 view_type_(ViewType::INVALID),
237 browser_window_id_(-1), 236 browser_window_id_(-1),
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 routing_id_, message, default_value, frame_url, type, &success, result)); 1225 routing_id_, message, default_value, frame_url, type, &success, result));
1227 return success; 1226 return success;
1228 } 1227 }
1229 1228
1230 void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) { 1229 void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) {
1231 if (!osd_url.is_empty()) 1230 if (!osd_url.is_empty())
1232 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, 1231 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url,
1233 autodetected)); 1232 autodetected));
1234 } 1233 }
1235 1234
1236 void RenderView::QueryFormFieldAutofill(const std::wstring& field_name,
1237 const std::wstring& text,
1238 int64 node_id) {
1239 static int message_id_counter = 0;
1240 form_field_autofill_request_id_ = message_id_counter++;
1241 form_field_autofill_node_id_ = node_id;
1242 Send(new ViewHostMsg_QueryFormFieldAutofill(
1243 routing_id_, form_field_autofill_request_id_, field_name, text));
1244 }
1245
1246 void RenderView::RemoveStoredAutofillEntry(const std::wstring& name,
1247 const std::wstring& value) {
1248 Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value));
1249 }
1250
1251 void RenderView::OnQueryFormFieldAutofillAck( 1235 void RenderView::OnQueryFormFieldAutofillAck(
1252 int request_id, 1236 int query_id,
1253 const std::vector<std::wstring>& suggestions, 1237 const std::vector<string16>& suggestions,
1254 int default_suggestion_index) { 1238 int default_suggestion_index) {
1255 if (!webview() || request_id != form_field_autofill_request_id_) 1239 if (webview() && query_id == autofill_query_id_ && !suggestions.empty()) {
1256 return; 1240 webview()->applyAutofillSuggestions(
1257 1241 autofill_query_node_, suggestions, default_suggestion_index);
1258 webview()->AutofillSuggestionsForNode( 1242 }
1259 form_field_autofill_node_id_, suggestions, default_suggestion_index); 1243 autofill_query_node_.reset();
1260 } 1244 }
1261 1245
1262 void RenderView::OnPopupNotificationVisibilityChanged(bool visible) { 1246 void RenderView::OnPopupNotificationVisibilityChanged(bool visible) {
1263 popup_notification_visible_ = visible; 1247 popup_notification_visible_ = visible;
1264 } 1248 }
1265 1249
1266 uint32 RenderView::GetCPBrowsingContext() { 1250 uint32 RenderView::GetCPBrowsingContext() {
1267 uint32 context = 0; 1251 uint32 context = 0;
1268 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); 1252 Send(new ViewHostMsg_GetCPBrowsingContext(&context));
1269 return context; 1253 return context;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 1693
1710 history_back_list_count_++; 1694 history_back_list_count_++;
1711 history_forward_list_count_ = 0; 1695 history_forward_list_count_ = 0;
1712 } 1696 }
1713 1697
1714 void RenderView::didUpdateInspectorSettings() { 1698 void RenderView::didUpdateInspectorSettings() {
1715 Send(new ViewHostMsg_UpdateInspectorSettings( 1699 Send(new ViewHostMsg_UpdateInspectorSettings(
1716 routing_id_, webview()->inspectorSettings().utf8())); 1700 routing_id_, webview()->inspectorSettings().utf8()));
1717 } 1701 }
1718 1702
1703 void RenderView::queryAutofillSuggestions(const WebNode& node,
1704 const WebString& name,
1705 const WebString& value) {
1706 static int query_counter = 0;
1707 autofill_query_id_ = query_counter++;
1708 autofill_query_node_ = node;
1709 Send(new ViewHostMsg_QueryFormFieldAutofill(
1710 routing_id_, autofill_query_id_, name, value));
1711 }
1712
1713 void RenderView::removeAutofillSuggestions(const WebString& name,
1714 const WebString& value) {
1715 Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value));
1716 }
1717
1719 // WebKit::WebWidgetClient ---------------------------------------------------- 1718 // WebKit::WebWidgetClient ----------------------------------------------------
1720 1719
1721 // We are supposed to get a single call to Show for a newly created RenderView 1720 // We are supposed to get a single call to Show for a newly created RenderView
1722 // that was created via RenderView::CreateWebView. So, we wait until this 1721 // that was created via RenderView::CreateWebView. So, we wait until this
1723 // point to dispatch the ShowView message. 1722 // point to dispatch the ShowView message.
1724 // 1723 //
1725 // This method provides us with the information about how to display the newly 1724 // This method provides us with the information about how to display the newly
1726 // created RenderView (i.e., as a constrained popup or as a new tab). 1725 // created RenderView (i.e., as a constrained popup or as a new tab).
1727 // 1726 //
1728 void RenderView::show(WebNavigationPolicy policy) { 1727 void RenderView::show(WebNavigationPolicy policy) {
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 NavigationState* navigation_state = 3278 NavigationState* navigation_state =
3280 NavigationState::FromDataSource(frame->dataSource()); 3279 NavigationState::FromDataSource(frame->dataSource());
3281 html_to_load = &navigation_state->postponed_data(); 3280 html_to_load = &navigation_state->postponed_data();
3282 } 3281 }
3283 LoadNavigationErrorPage( 3282 LoadNavigationErrorPage(
3284 frame, WebURLRequest(), original_error, *html_to_load, true); 3283 frame, WebURLRequest(), original_error, *html_to_load, true);
3285 } 3284 }
3286 3285
3287 void RenderView::OnMoveOrResizeStarted() { 3286 void RenderView::OnMoveOrResizeStarted() {
3288 if (webview()) 3287 if (webview())
3289 webview()->HideAutofillPopup(); 3288 webview()->hideAutofillPopup();
3290 } 3289 }
3291 3290
3292 void RenderView::OnResize(const gfx::Size& new_size, 3291 void RenderView::OnResize(const gfx::Size& new_size,
3293 const gfx::Rect& resizer_rect) { 3292 const gfx::Rect& resizer_rect) {
3294 if (webview()) 3293 if (webview())
3295 webview()->HideAutofillPopup(); 3294 webview()->hideAutofillPopup();
3296 RenderWidget::OnResize(new_size, resizer_rect); 3295 RenderWidget::OnResize(new_size, resizer_rect);
3297 } 3296 }
3298 3297
3299 void RenderView::OnClearFocusedNode() { 3298 void RenderView::OnClearFocusedNode() {
3300 if (webview()) 3299 if (webview())
3301 webview()->clearFocusedNode(); 3300 webview()->clearFocusedNode();
3302 } 3301 }
3303 3302
3304 void RenderView::OnSetBackground(const SkBitmap& background) { 3303 void RenderView::OnSetBackground(const SkBitmap& background) {
3305 if (webview()) 3304 if (webview())
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3649 new PluginMsg_SignalModalDialogEvent(host_window_)); 3648 new PluginMsg_SignalModalDialogEvent(host_window_));
3650 3649
3651 message->EnableMessagePumping(); // Runs a nested message loop. 3650 message->EnableMessagePumping(); // Runs a nested message loop.
3652 bool rv = Send(message); 3651 bool rv = Send(message);
3653 3652
3654 PluginChannelHost::Broadcast( 3653 PluginChannelHost::Broadcast(
3655 new PluginMsg_ResetModalDialogEvent(host_window_)); 3654 new PluginMsg_ResetModalDialogEvent(host_window_));
3656 3655
3657 return rv; 3656 return rv;
3658 } 3657 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/api/public/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698