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

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

Issue 3156016: Making window.focus()/blur() work only when user initiated (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix Linux compile 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 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 #if defined(WEBKIT_BUG_41283_IS_FIXED) 2198 #if defined(WEBKIT_BUG_41283_IS_FIXED)
2199 bool result = password_autocomplete_manager_.FillPassword(user_element); 2199 bool result = password_autocomplete_manager_.FillPassword(user_element);
2200 // Since this user name was selected from a suggestion list, we should always 2200 // Since this user name was selected from a suggestion list, we should always
2201 // have password for it. 2201 // have password for it.
2202 DCHECK(result); 2202 DCHECK(result);
2203 #endif 2203 #endif
2204 } 2204 }
2205 2205
2206 // WebKit::WebWidgetClient ---------------------------------------------------- 2206 // WebKit::WebWidgetClient ----------------------------------------------------
2207 2207
2208 void RenderView::didFocus() {
2209 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed
2210 // we won't have to test for user gesture anymore and we can
2211 // move that code back to render_widget.cc
2212 if (webview() && webview()->mainFrame() &&
2213 webview()->mainFrame()->isProcessingUserGesture()) {
2214 Send(new ViewHostMsg_Focus(routing_id_));
2215 }
2216 }
2217
2218 void RenderView::didBlur() {
2219 // TODO(jcivelli): see TODO above in didFocus().
2220 if (webview() && webview()->mainFrame() &&
2221 webview()->mainFrame()->isProcessingUserGesture()) {
2222 Send(new ViewHostMsg_Blur(routing_id_));
2223 }
2224 }
2225
2208 // We are supposed to get a single call to Show for a newly created RenderView 2226 // We are supposed to get a single call to Show for a newly created RenderView
2209 // that was created via RenderView::CreateWebView. So, we wait until this 2227 // that was created via RenderView::CreateWebView. So, we wait until this
2210 // point to dispatch the ShowView message. 2228 // point to dispatch the ShowView message.
2211 // 2229 //
2212 // This method provides us with the information about how to display the newly 2230 // This method provides us with the information about how to display the newly
2213 // created RenderView (i.e., as a constrained popup or as a new tab). 2231 // created RenderView (i.e., as a constrained popup or as a new tab).
2214 // 2232 //
2215 void RenderView::show(WebNavigationPolicy policy) { 2233 void RenderView::show(WebNavigationPolicy policy) {
2216 DCHECK(!did_show_) << "received extraneous Show call"; 2234 DCHECK(!did_show_) << "received extraneous Show call";
2217 DCHECK(opener_id_ != MSG_ROUTING_NONE); 2235 DCHECK(opener_id_ != MSG_ROUTING_NONE);
(...skipping 3297 matching lines...) Expand 10 before | Expand all | Expand 10 after
5515 // the origins of the two domains are different. This can be treated as a 5533 // the origins of the two domains are different. This can be treated as a
5516 // top level navigation and routed back to the host. 5534 // top level navigation and routed back to the host.
5517 WebKit::WebFrame* opener = frame->opener(); 5535 WebKit::WebFrame* opener = frame->opener();
5518 if (opener) { 5536 if (opener) {
5519 if (url.GetOrigin() != GURL(opener->url()).GetOrigin()) 5537 if (url.GetOrigin() != GURL(opener->url()).GetOrigin())
5520 return true; 5538 return true;
5521 } 5539 }
5522 } 5540 }
5523 return false; 5541 return false;
5524 } 5542 }
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