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/web_contents/web_contents_view_android.h" | 5 #include "content/browser/web_contents/web_contents_view_android.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/android/content_view_core_impl.h" | 8 #include "content/browser/android/content_view_core_impl.h" |
9 #include "content/browser/frame_host/interstitial_page_impl.h" | 9 #include "content/browser/frame_host/interstitial_page_impl.h" |
10 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return gfx::Rect(content_view_core_->GetViewSize()); | 114 return gfx::Rect(content_view_core_->GetViewSize()); |
115 | 115 |
116 return gfx::Rect(); | 116 return gfx::Rect(); |
117 } | 117 } |
118 | 118 |
119 void WebContentsViewAndroid::CreateView( | 119 void WebContentsViewAndroid::CreateView( |
120 const gfx::Size& initial_size, gfx::NativeView context) { | 120 const gfx::Size& initial_size, gfx::NativeView context) { |
121 } | 121 } |
122 | 122 |
123 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForWidget( | 123 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForWidget( |
124 RenderWidgetHost* render_widget_host) { | 124 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) { |
125 if (render_widget_host->GetView()) { | 125 if (render_widget_host->GetView()) { |
126 // During testing, the view will already be set up in most cases to the | 126 // During testing, the view will already be set up in most cases to the |
127 // test view, so we don't want to clobber it with a real one. To verify that | 127 // test view, so we don't want to clobber it with a real one. To verify that |
128 // this actually is happening (and somebody isn't accidentally creating the | 128 // this actually is happening (and somebody isn't accidentally creating the |
129 // view twice), we check for the RVH Factory, which will be set when we're | 129 // view twice), we check for the RVH Factory, which will be set when we're |
130 // making special ones (which go along with the special views). | 130 // making special ones (which go along with the special views). |
131 DCHECK(RenderViewHostFactory::has_factory()); | 131 DCHECK(RenderViewHostFactory::has_factory()); |
132 return static_cast<RenderWidgetHostViewBase*>( | 132 return static_cast<RenderWidgetHostViewBase*>( |
133 render_widget_host->GetView()); | 133 render_widget_host->GetView()); |
134 } | 134 } |
135 // Note that while this instructs the render widget host to reference | 135 // Note that while this instructs the render widget host to reference |
136 // |native_view_|, this has no effect without also instructing the | 136 // |native_view_|, this has no effect without also instructing the |
137 // native view (i.e. ContentView) how to obtain a reference to this widget in | 137 // native view (i.e. ContentView) how to obtain a reference to this widget in |
138 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an | 138 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an |
139 // example of how this is achieved for InterstitialPages. | 139 // example of how this is achieved for InterstitialPages. |
140 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 140 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); |
141 return new RenderWidgetHostViewAndroid(rwhi, content_view_core_); | 141 return new RenderWidgetHostViewAndroid(rwhi, content_view_core_); |
142 } | 142 } |
143 | 143 |
144 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( | 144 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( |
145 RenderWidgetHost* render_widget_host) { | 145 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) { |
146 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 146 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); |
147 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 147 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
148 } | 148 } |
149 | 149 |
150 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { | 150 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { |
151 } | 151 } |
152 | 152 |
153 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { | 153 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { |
154 } | 154 } |
155 | 155 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // This is called when we the renderer asks us to take focus back (i.e., it has | 206 // This is called when we the renderer asks us to take focus back (i.e., it has |
207 // iterated past the last focusable element on the page). | 207 // iterated past the last focusable element on the page). |
208 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 208 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
209 if (web_contents_->GetDelegate() && | 209 if (web_contents_->GetDelegate() && |
210 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 210 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
211 return; | 211 return; |
212 web_contents_->GetRenderWidgetHostView()->Focus(); | 212 web_contents_->GetRenderWidgetHostView()->Focus(); |
213 } | 213 } |
214 | 214 |
215 } // namespace content | 215 } // namespace content |
OLD | NEW |