OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
76 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 76 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
77 #endif | 77 #endif |
78 | 78 |
79 #if defined(ENABLE_MEDIA_MOJO_RENDERER) | 79 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
80 #include "media/mojo/interfaces/media_renderer.mojom.h" | 80 #include "media/mojo/interfaces/media_renderer.mojom.h" |
81 #include "media/mojo/services/mojo_renderer_service.h" | 81 #include "media/mojo/services/mojo_renderer_service.h" |
82 #endif | 82 #endif |
83 | 83 |
| 84 #if defined(ENABLE_WEBVR) |
| 85 #include "content/browser/vr/vr_device_manager.h" |
| 86 #endif |
| 87 |
84 using base::TimeDelta; | 88 using base::TimeDelta; |
85 | 89 |
86 namespace content { | 90 namespace content { |
87 | 91 |
88 namespace { | 92 namespace { |
89 | 93 |
90 // The next value to use for the accessibility reset token. | 94 // The next value to use for the accessibility reset token. |
91 int g_next_accessibility_reset_token = 1; | 95 int g_next_accessibility_reset_token = 1; |
92 | 96 |
93 // The next value to use for the javascript callback id. | 97 // The next value to use for the javascript callback id. |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 GetServiceRegistry()->AddService<mojo::MediaRenderer>( | 1573 GetServiceRegistry()->AddService<mojo::MediaRenderer>( |
1570 base::Bind(&CreateMediaRendererService)); | 1574 base::Bind(&CreateMediaRendererService)); |
1571 #endif | 1575 #endif |
1572 | 1576 |
1573 if (!frame_mojo_shell_) | 1577 if (!frame_mojo_shell_) |
1574 frame_mojo_shell_.reset(new FrameMojoShell(this)); | 1578 frame_mojo_shell_.reset(new FrameMojoShell(this)); |
1575 | 1579 |
1576 GetServiceRegistry()->AddService<mojo::Shell>(base::Bind( | 1580 GetServiceRegistry()->AddService<mojo::Shell>(base::Bind( |
1577 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); | 1581 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); |
1578 | 1582 |
| 1583 #if defined(ENABLE_WEBVR) |
| 1584 const base::CommandLine& browser_command_line = |
| 1585 *base::CommandLine::ForCurrentProcess(); |
| 1586 |
| 1587 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { |
| 1588 GetServiceRegistry()->AddService<VRService>( |
| 1589 base::Bind(&VRDeviceManager::BindRequest)); |
| 1590 } |
| 1591 #endif |
| 1592 |
1579 GetContentClient()->browser()->OverrideRenderFrameMojoServices( | 1593 GetContentClient()->browser()->OverrideRenderFrameMojoServices( |
1580 GetServiceRegistry(), this); | 1594 GetServiceRegistry(), this); |
1581 } | 1595 } |
1582 | 1596 |
1583 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { | 1597 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { |
1584 // Only main frames should be swapped out and retained inside a proxy host. | 1598 // Only main frames should be swapped out and retained inside a proxy host. |
1585 if (rfh_state == STATE_SWAPPED_OUT) | 1599 if (rfh_state == STATE_SWAPPED_OUT) |
1586 CHECK(!GetParent()); | 1600 CHECK(!GetParent()); |
1587 | 1601 |
1588 // We update the number of RenderFrameHosts in a SiteInstance when the swapped | 1602 // We update the number of RenderFrameHosts in a SiteInstance when the swapped |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 // We may be returning to an existing NavigationEntry that had been granted | 2112 // We may be returning to an existing NavigationEntry that had been granted |
2099 // file access. If this is a different process, we will need to grant the | 2113 // file access. If this is a different process, we will need to grant the |
2100 // access again. The files listed in the page state are validated when they | 2114 // access again. The files listed in the page state are validated when they |
2101 // are received from the renderer to prevent abuse. | 2115 // are received from the renderer to prevent abuse. |
2102 if (request_params.page_state.IsValid()) { | 2116 if (request_params.page_state.IsValid()) { |
2103 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); | 2117 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); |
2104 } | 2118 } |
2105 } | 2119 } |
2106 | 2120 |
2107 } // namespace content | 2121 } // namespace content |
OLD | NEW |