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 | |
88 using base::TimeDelta; | 84 using base::TimeDelta; |
89 | 85 |
90 namespace content { | 86 namespace content { |
91 | 87 |
92 namespace { | 88 namespace { |
93 | 89 |
94 // The next value to use for the accessibility reset token. | 90 // The next value to use for the accessibility reset token. |
95 int g_next_accessibility_reset_token = 1; | 91 int g_next_accessibility_reset_token = 1; |
96 | 92 |
97 // The next value to use for the javascript callback id. | 93 // The next value to use for the javascript callback id. |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 GetServiceRegistry()->AddService<mojo::MediaRenderer>( | 1572 GetServiceRegistry()->AddService<mojo::MediaRenderer>( |
1577 base::Bind(&CreateMediaRendererService)); | 1573 base::Bind(&CreateMediaRendererService)); |
1578 #endif | 1574 #endif |
1579 | 1575 |
1580 if (!frame_mojo_shell_) | 1576 if (!frame_mojo_shell_) |
1581 frame_mojo_shell_.reset(new FrameMojoShell(this)); | 1577 frame_mojo_shell_.reset(new FrameMojoShell(this)); |
1582 | 1578 |
1583 GetServiceRegistry()->AddService<mojo::Shell>(base::Bind( | 1579 GetServiceRegistry()->AddService<mojo::Shell>(base::Bind( |
1584 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); | 1580 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); |
1585 | 1581 |
1586 #if defined(ENABLE_WEBVR) | |
1587 const base::CommandLine& browser_command_line = | |
1588 *base::CommandLine::ForCurrentProcess(); | |
1589 | |
1590 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { | |
1591 GetServiceRegistry()->AddService<VRService>( | |
1592 base::Bind(&VRDeviceManager::BindRequest)); | |
1593 } | |
1594 #endif | |
1595 | |
1596 GetContentClient()->browser()->OverrideRenderFrameMojoServices( | 1582 GetContentClient()->browser()->OverrideRenderFrameMojoServices( |
1597 GetServiceRegistry(), this); | 1583 GetServiceRegistry(), this); |
1598 } | 1584 } |
1599 | 1585 |
1600 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { | 1586 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { |
1601 // Only main frames should be swapped out and retained inside a proxy host. | 1587 // Only main frames should be swapped out and retained inside a proxy host. |
1602 if (rfh_state == STATE_SWAPPED_OUT) | 1588 if (rfh_state == STATE_SWAPPED_OUT) |
1603 CHECK(!GetParent()); | 1589 CHECK(!GetParent()); |
1604 | 1590 |
1605 // We update the number of RenderFrameHosts in a SiteInstance when the swapped | 1591 // We update the number of RenderFrameHosts in a SiteInstance when the swapped |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 // We may be returning to an existing NavigationEntry that had been granted | 2092 // We may be returning to an existing NavigationEntry that had been granted |
2107 // file access. If this is a different process, we will need to grant the | 2093 // file access. If this is a different process, we will need to grant the |
2108 // access again. The files listed in the page state are validated when they | 2094 // access again. The files listed in the page state are validated when they |
2109 // are received from the renderer to prevent abuse. | 2095 // are received from the renderer to prevent abuse. |
2110 if (request_params.page_state.IsValid()) { | 2096 if (request_params.page_state.IsValid()) { |
2111 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); | 2097 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); |
2112 } | 2098 } |
2113 } | 2099 } |
2114 | 2100 |
2115 } // namespace content | 2101 } // namespace content |
OLD | NEW |