Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 14268004: Add overscroll edge effect animations for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 void ContentViewCoreImpl::SetBackgroundColor(JNIEnv* env, 325 void ContentViewCoreImpl::SetBackgroundColor(JNIEnv* env,
326 jobject obj, 326 jobject obj,
327 jint color) { 327 jint color) {
328 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); 328 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
329 if (!rwhva) 329 if (!rwhva)
330 return; 330 return;
331 rwhva->OnDidChangeBodyBackgroundColor(color); 331 rwhva->OnDidChangeBodyBackgroundColor(color);
332 } 332 }
333 333
334 void ContentViewCoreImpl::SetOverscrollResources(JNIEnv* env,
335 jobject obj,
336 jobject edge_bitmap,
337 jobject glow_bitmap) {
338 if (!CommandLine::ForCurrentProcess()->
339 HasSwitch(switches::kEnableOverscrollEdgeEffect))
340 return;
341
342 overscroll_edge_ = !edge_bitmap ?
343 SkBitmap() : gfx::CreateSkBitmapFromJavaBitmap(edge_bitmap);
344 overscroll_glow_ = !glow_bitmap ?
345 SkBitmap() : gfx::CreateSkBitmapFromJavaBitmap(glow_bitmap);
346
347 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
348 if (!rwhva)
349 return;
350 rwhva->OnSetOverscrollResources();
351 }
352
334 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { 353 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) {
335 Hide(); 354 Hide();
336 } 355 }
337 356
338 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { 357 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) {
339 Show(); 358 Show();
340 } 359 }
341 360
342 void ContentViewCoreImpl::Show() { 361 void ContentViewCoreImpl::Show() {
343 GetWebContents()->WasShown(); 362 GetWebContents()->WasShown();
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 reinterpret_cast<WebContents*>(native_web_contents), 1498 reinterpret_cast<WebContents*>(native_web_contents),
1480 reinterpret_cast<ui::WindowAndroid*>(native_window)); 1499 reinterpret_cast<ui::WindowAndroid*>(native_window));
1481 return reinterpret_cast<jint>(view); 1500 return reinterpret_cast<jint>(view);
1482 } 1501 }
1483 1502
1484 bool RegisterContentViewCore(JNIEnv* env) { 1503 bool RegisterContentViewCore(JNIEnv* env) {
1485 return RegisterNativesImpl(env); 1504 return RegisterNativesImpl(env);
1486 } 1505 }
1487 1506
1488 } // namespace content 1507 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698