| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/android/compositor/compositor_view.h" | 5 #include "chrome/browser/android/compositor/compositor_view.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 current_surface_format_ = format; | 160 current_surface_format_ = format; |
| 161 compositor_->SetSurface(surface); | 161 compositor_->SetSurface(surface); |
| 162 } | 162 } |
| 163 gfx::Size size = gfx::Size(width, height); | 163 gfx::Size size = gfx::Size(width, height); |
| 164 compositor_->SetWindowBounds(size); | 164 compositor_->SetWindowBounds(size); |
| 165 content_width_ = size.width(); | 165 content_width_ = size.width(); |
| 166 content_height_ = size.height(); | 166 content_height_ = size.height(); |
| 167 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); | 167 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void CompositorView::OnPhysicalBackingSizeChanged( |
| 171 JNIEnv* env, |
| 172 const JavaParamRef<jobject>& obj, |
| 173 const JavaParamRef<jobject>& jweb_contents, |
| 174 jint width, |
| 175 jint height) { |
| 176 content::WebContents* web_contents = |
| 177 content::WebContents::FromJavaWebContents(jweb_contents); |
| 178 gfx::Size size(width, height); |
| 179 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); |
| 180 } |
| 181 |
| 170 void CompositorView::SetLayoutBounds(JNIEnv* env, | 182 void CompositorView::SetLayoutBounds(JNIEnv* env, |
| 171 const JavaParamRef<jobject>& object) { | 183 const JavaParamRef<jobject>& object) { |
| 172 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); | 184 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); |
| 173 } | 185 } |
| 174 | 186 |
| 175 void CompositorView::SetBackground(bool visible, SkColor color) { | 187 void CompositorView::SetBackground(bool visible, SkColor color) { |
| 176 if (overlay_video_mode_) | 188 if (overlay_video_mode_) |
| 177 visible = false; | 189 visible = false; |
| 178 root_layer_->SetBackgroundColor(color); | 190 root_layer_->SetBackgroundColor(color); |
| 179 root_layer_->SetIsDrawable(visible); | 191 root_layer_->SetIsDrawable(visible); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go | 270 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go |
| 259 // through here but through BrowserChildProcessHostDisconnected() instead. | 271 // through here but through BrowserChildProcessHostDisconnected() instead. |
| 260 } | 272 } |
| 261 | 273 |
| 262 // Register native methods | 274 // Register native methods |
| 263 bool RegisterCompositorView(JNIEnv* env) { | 275 bool RegisterCompositorView(JNIEnv* env) { |
| 264 return RegisterNativesImpl(env); | 276 return RegisterNativesImpl(env); |
| 265 } | 277 } |
| 266 | 278 |
| 267 } // namespace android | 279 } // namespace android |
| OLD | NEW |