| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 44 #include "chrome/common/window_container_type.h" | 44 #include "chrome/common/window_container_type.h" |
| 45 #include "chrome/renderer/about_handler.h" | 45 #include "chrome/renderer/about_handler.h" |
| 46 #include "chrome/renderer/audio_message_filter.h" | 46 #include "chrome/renderer/audio_message_filter.h" |
| 47 #include "chrome/renderer/autofill_helper.h" | 47 #include "chrome/renderer/autofill_helper.h" |
| 48 #include "chrome/renderer/blocked_plugin.h" | 48 #include "chrome/renderer/blocked_plugin.h" |
| 49 #include "chrome/renderer/device_orientation_dispatcher.h" | 49 #include "chrome/renderer/device_orientation_dispatcher.h" |
| 50 #include "chrome/renderer/devtools_agent.h" | 50 #include "chrome/renderer/devtools_agent.h" |
| 51 #include "chrome/renderer/devtools_client.h" | 51 #include "chrome/renderer/devtools_client.h" |
| 52 #include "chrome/renderer/extension_groups.h" | 52 #include "chrome/renderer/extension_groups.h" |
| 53 #include "chrome/renderer/extensions/bindings_utils.h" |
| 53 #include "chrome/renderer/extensions/extension_renderer_info.h" | 54 #include "chrome/renderer/extensions/extension_renderer_info.h" |
| 54 #include "chrome/renderer/extensions/event_bindings.h" | 55 #include "chrome/renderer/extensions/event_bindings.h" |
| 55 #include "chrome/renderer/extensions/extension_process_bindings.h" | 56 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| 56 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 57 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
| 57 #include "chrome/renderer/geolocation_dispatcher.h" | 58 #include "chrome/renderer/geolocation_dispatcher.h" |
| 58 #include "chrome/renderer/localized_error.h" | 59 #include "chrome/renderer/localized_error.h" |
| 59 #include "chrome/renderer/media/audio_renderer_impl.h" | 60 #include "chrome/renderer/media/audio_renderer_impl.h" |
| 60 #include "chrome/renderer/media/ipc_video_decoder.h" | 61 #include "chrome/renderer/media/ipc_video_decoder.h" |
| 61 #include "chrome/renderer/media/ipc_video_renderer.h" | 62 #include "chrome/renderer/media/ipc_video_renderer.h" |
| 62 #include "chrome/renderer/navigation_state.h" | 63 #include "chrome/renderer/navigation_state.h" |
| (...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 // created RenderView (i.e., as a constrained popup or as a new tab). | 2274 // created RenderView (i.e., as a constrained popup or as a new tab). |
| 2274 // | 2275 // |
| 2275 void RenderView::show(WebNavigationPolicy policy) { | 2276 void RenderView::show(WebNavigationPolicy policy) { |
| 2276 DCHECK(!did_show_) << "received extraneous Show call"; | 2277 DCHECK(!did_show_) << "received extraneous Show call"; |
| 2277 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 2278 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
| 2278 | 2279 |
| 2279 if (did_show_) | 2280 if (did_show_) |
| 2280 return; | 2281 return; |
| 2281 did_show_ = true; | 2282 did_show_ = true; |
| 2282 | 2283 |
| 2284 // Extensions and apps always allowed to create unrequested popups. The second |
| 2285 // check is necessary to include content scripts. |
| 2286 if (ExtensionRendererInfo::GetByURL(creator_url_) || |
| 2287 bindings_utils::GetInfoForCurrentContext()) { |
| 2288 opened_by_user_gesture_ = true; |
| 2289 } |
| 2290 |
| 2283 // Force new windows to a popup if they were not opened with a user gesture. | 2291 // Force new windows to a popup if they were not opened with a user gesture. |
| 2284 if (!opened_by_user_gesture_) { | 2292 if (!opened_by_user_gesture_) { |
| 2285 // We exempt background tabs for compat with older versions of Chrome. | 2293 // We exempt background tabs for compat with older versions of Chrome. |
| 2286 // TODO(darin): This seems bogus. These should have a user gesture, so | 2294 // TODO(darin): This seems bogus. These should have a user gesture, so |
| 2287 // we probably don't need this check. | 2295 // we probably don't need this check. |
| 2288 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) | 2296 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) |
| 2289 policy = WebKit::WebNavigationPolicyNewPopup; | 2297 policy = WebKit::WebNavigationPolicyNewPopup; |
| 2290 } | 2298 } |
| 2291 | 2299 |
| 2292 // NOTE: initial_pos_ may still have its default values at this point, but | 2300 // NOTE: initial_pos_ may still have its default values at this point, but |
| (...skipping 3385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5678 PendingOpenFileSystem* request = pending_file_system_requests_.Lookup( | 5686 PendingOpenFileSystem* request = pending_file_system_requests_.Lookup( |
| 5679 request_id); | 5687 request_id); |
| 5680 DCHECK(request); | 5688 DCHECK(request); |
| 5681 if (accepted) | 5689 if (accepted) |
| 5682 request->callbacks->didOpenFileSystem(name, root_path); | 5690 request->callbacks->didOpenFileSystem(name, root_path); |
| 5683 else | 5691 else |
| 5684 request->callbacks->didFail(WebKit::WebFileErrorSecurity); | 5692 request->callbacks->didFail(WebKit::WebFileErrorSecurity); |
| 5685 request->callbacks = NULL; | 5693 request->callbacks = NULL; |
| 5686 pending_file_system_requests_.Remove(request_id); | 5694 pending_file_system_requests_.Remove(request_id); |
| 5687 } | 5695 } |
| OLD | NEW |