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

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

Issue 3174030: Making window.focus()/blur() work only when there is a user gesture. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 4 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_widget.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 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 #if defined(WEBKIT_BUG_41283_IS_FIXED) 2215 #if defined(WEBKIT_BUG_41283_IS_FIXED)
2216 bool result = password_autocomplete_manager_.FillPassword(user_element); 2216 bool result = password_autocomplete_manager_.FillPassword(user_element);
2217 // Since this user name was selected from a suggestion list, we should always 2217 // Since this user name was selected from a suggestion list, we should always
2218 // have password for it. 2218 // have password for it.
2219 DCHECK(result); 2219 DCHECK(result);
2220 #endif 2220 #endif
2221 } 2221 }
2222 2222
2223 // WebKit::WebWidgetClient ---------------------------------------------------- 2223 // WebKit::WebWidgetClient ----------------------------------------------------
2224 2224
2225 void RenderView::didFocus() {
2226 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed
2227 // we won't have to test for user gesture anymore and we can
2228 // move that code back to render_widget.cc
2229 if (webview() && webview()->mainFrame() &&
2230 webview()->mainFrame()->isProcessingUserGesture()) {
2231 Send(new ViewHostMsg_Focus(routing_id_));
2232 }
2233 }
2234
2235 void RenderView::didBlur() {
2236 // TODO(jcivelli): see TODO above in didFocus().
2237 if (webview() && webview()->mainFrame() &&
2238 webview()->mainFrame()->isProcessingUserGesture()) {
2239 Send(new ViewHostMsg_Blur(routing_id_));
2240 }
2241 }
2242
2225 // We are supposed to get a single call to Show for a newly created RenderView 2243 // We are supposed to get a single call to Show for a newly created RenderView
2226 // that was created via RenderView::CreateWebView. So, we wait until this 2244 // that was created via RenderView::CreateWebView. So, we wait until this
2227 // point to dispatch the ShowView message. 2245 // point to dispatch the ShowView message.
2228 // 2246 //
2229 // This method provides us with the information about how to display the newly 2247 // This method provides us with the information about how to display the newly
2230 // created RenderView (i.e., as a constrained popup or as a new tab). 2248 // created RenderView (i.e., as a constrained popup or as a new tab).
2231 // 2249 //
2232 void RenderView::show(WebNavigationPolicy policy) { 2250 void RenderView::show(WebNavigationPolicy policy) {
2233 DCHECK(!did_show_) << "received extraneous Show call"; 2251 DCHECK(!did_show_) << "received extraneous Show call";
2234 DCHECK(opener_id_ != MSG_ROUTING_NONE); 2252 DCHECK(opener_id_ != MSG_ROUTING_NONE);
(...skipping 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after
5549 PendingOpenFileSystem* request = pending_file_system_requests_.Lookup( 5567 PendingOpenFileSystem* request = pending_file_system_requests_.Lookup(
5550 request_id); 5568 request_id);
5551 DCHECK(request); 5569 DCHECK(request);
5552 if (accepted) 5570 if (accepted)
5553 request->callbacks->didOpenFileSystem(name, root_path); 5571 request->callbacks->didOpenFileSystem(name, root_path);
5554 else 5572 else
5555 request->callbacks->didFail(WebKit::WebFileErrorSecurity); 5573 request->callbacks->didFail(WebKit::WebFileErrorSecurity);
5556 request->callbacks = NULL; 5574 request->callbacks = NULL;
5557 pending_file_system_requests_.Remove(request_id); 5575 pending_file_system_requests_.Remove(request_id);
5558 } 5576 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698