| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #if defined(OS_WIN) |
| 22 #include "base/win/windows_version.h" |
| 23 #endif |
| 21 #include "content/browser/child_process_security_policy_impl.h" | 24 #include "content/browser/child_process_security_policy_impl.h" |
| 22 #include "content/browser/cross_site_request_manager.h" | 25 #include "content/browser/cross_site_request_manager.h" |
| 23 #include "content/browser/gpu/gpu_surface_tracker.h" | 26 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 24 #include "content/browser/host_zoom_map_impl.h" | 27 #include "content/browser/host_zoom_map_impl.h" |
| 25 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" | 28 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" |
| 26 #include "content/browser/power_save_blocker.h" | 29 #include "content/browser/power_save_blocker.h" |
| 27 #include "content/browser/renderer_host/render_process_host_impl.h" | 30 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 28 #include "content/common/accessibility_messages.h" | 31 #include "content/common/accessibility_messages.h" |
| 29 #include "content/common/desktop_notification_messages.h" | 32 #include "content/common/desktop_notification_messages.h" |
| 30 #include "content/common/drag_messages.h" | 33 #include "content/common/drag_messages.h" |
| 31 #include "content/common/inter_process_time_ticks_converter.h" | 34 #include "content/common/inter_process_time_ticks_converter.h" |
| 32 #include "content/common/speech_recognition_messages.h" | 35 #include "content/common/speech_recognition_messages.h" |
| 33 #include "content/common/swapped_out_messages.h" | 36 #include "content/common/swapped_out_messages.h" |
| 34 #include "content/common/view_messages.h" | 37 #include "content/common/view_messages.h" |
| 35 #include "content/port/browser/render_widget_host_view_port.h" | 38 #include "content/port/browser/render_widget_host_view_port.h" |
| 39 #include "content/public/browser/browser_accessibility_state.h" |
| 36 #include "content/public/browser/browser_context.h" | 40 #include "content/public/browser/browser_context.h" |
| 37 #include "content/public/browser/browser_message_filter.h" | 41 #include "content/public/browser/browser_message_filter.h" |
| 38 #include "content/public/browser/content_browser_client.h" | 42 #include "content/public/browser/content_browser_client.h" |
| 39 #include "content/public/browser/dom_operation_notification_details.h" | 43 #include "content/public/browser/dom_operation_notification_details.h" |
| 40 #include "content/public/browser/native_web_keyboard_event.h" | 44 #include "content/public/browser/native_web_keyboard_event.h" |
| 41 #include "content/public/browser/notification_details.h" | 45 #include "content/public/browser/notification_details.h" |
| 42 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 43 #include "content/public/browser/notification_types.h" | 47 #include "content/public/browser/notification_types.h" |
| 44 #include "content/public/browser/render_view_host_delegate.h" | 48 #include "content/public/browser/render_view_host_delegate.h" |
| 45 #include "content/public/browser/render_view_host_observer.h" | 49 #include "content/public/browser/render_view_host_observer.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 201 } |
| 198 | 202 |
| 199 bool RenderViewHostImpl::CreateRenderView(const string16& frame_name, | 203 bool RenderViewHostImpl::CreateRenderView(const string16& frame_name, |
| 200 int32 max_page_id) { | 204 int32 max_page_id) { |
| 201 DCHECK(!IsRenderViewLive()) << "Creating view twice"; | 205 DCHECK(!IsRenderViewLive()) << "Creating view twice"; |
| 202 | 206 |
| 203 // The process may (if we're sharing a process with another host that already | 207 // The process may (if we're sharing a process with another host that already |
| 204 // initialized it) or may not (we have our own process or the old process | 208 // initialized it) or may not (we have our own process or the old process |
| 205 // crashed) have been initialized. Calling Init multiple times will be | 209 // crashed) have been initialized. Calling Init multiple times will be |
| 206 // ignored, so this is safe. | 210 // ignored, so this is safe. |
| 207 if (!GetProcess()->Init(renderer_accessible())) | 211 if (!GetProcess()->Init()) |
| 208 return false; | 212 return false; |
| 209 DCHECK(GetProcess()->HasConnection()); | 213 DCHECK(GetProcess()->HasConnection()); |
| 210 DCHECK(GetProcess()->GetBrowserContext()); | 214 DCHECK(GetProcess()->GetBrowserContext()); |
| 211 | 215 |
| 212 renderer_initialized_ = true; | 216 renderer_initialized_ = true; |
| 213 | 217 |
| 214 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 218 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 215 surface_id(), GetCompositingSurface()); | 219 surface_id(), GetCompositingSurface()); |
| 216 | 220 |
| 217 // Ensure the RenderView starts with a next_page_id larger than any existing | 221 // Ensure the RenderView starts with a next_page_id larger than any existing |
| (...skipping 19 matching lines...) Expand all Loading... |
| 237 } else { | 241 } else { |
| 238 content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 242 content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 239 ¶ms.screen_info); | 243 ¶ms.screen_info); |
| 240 } | 244 } |
| 241 #else | 245 #else |
| 242 params.screen_info = | 246 params.screen_info = |
| 243 WebKit::WebScreenInfoFactory::screenInfo( | 247 WebKit::WebScreenInfoFactory::screenInfo( |
| 244 gfx::NativeViewFromId(GetNativeViewId())); | 248 gfx::NativeViewFromId(GetNativeViewId())); |
| 245 #endif | 249 #endif |
| 246 params.guest = guest_; | 250 params.guest = guest_; |
| 251 params.accessibility_mode = |
| 252 BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser() ? |
| 253 AccessibilityModeComplete : |
| 254 AccessibilityModeOff; |
| 255 |
| 256 #if defined(OS_WIN) |
| 257 // On Windows 8, always enable accessibility for editable text controls |
| 258 // so we can show the virtual keyboard when one is enabled. |
| 259 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
| 260 params.accessibility_mode == AccessibilityModeOff) { |
| 261 params.accessibility_mode = AccessibilityModeEditableTextOnly; |
| 262 } |
| 263 #endif |
| 247 | 264 |
| 248 Send(new ViewMsg_New(params)); | 265 Send(new ViewMsg_New(params)); |
| 249 | 266 |
| 250 // If it's enabled, tell the renderer to set up the Javascript bindings for | 267 // If it's enabled, tell the renderer to set up the Javascript bindings for |
| 251 // sending messages back to the browser. | 268 // sending messages back to the browser. |
| 252 Send(new ViewMsg_AllowBindings(GetRoutingID(), enabled_bindings_)); | 269 Send(new ViewMsg_AllowBindings(GetRoutingID(), enabled_bindings_)); |
| 253 // Let our delegate know that we created a RenderView. | 270 // Let our delegate know that we created a RenderView. |
| 254 delegate_->RenderViewCreated(this); | 271 delegate_->RenderViewCreated(this); |
| 255 | 272 |
| 256 // Invert the color scheme if the operating system's color scheme is | 273 // Invert the color scheme if the operating system's color scheme is |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 // can cause navigations to be ignored in OnMsgNavigate. | 1743 // can cause navigations to be ignored in OnMsgNavigate. |
| 1727 is_waiting_for_beforeunload_ack_ = false; | 1744 is_waiting_for_beforeunload_ack_ = false; |
| 1728 is_waiting_for_unload_ack_ = false; | 1745 is_waiting_for_unload_ack_ = false; |
| 1729 } | 1746 } |
| 1730 | 1747 |
| 1731 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1748 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
| 1732 STLDeleteValues(&power_save_blockers_); | 1749 STLDeleteValues(&power_save_blockers_); |
| 1733 } | 1750 } |
| 1734 | 1751 |
| 1735 } // namespace content | 1752 } // namespace content |
| OLD | NEW |