| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "blimp/client/public/blimp_client_context.h" | 14 #include "blimp/client/public/blimp_client_context.h" |
| 15 #include "blimp/client/public/contents/blimp_contents.h" | 15 #include "blimp/client/public/contents/blimp_contents.h" |
| 16 #include "blimp/client/public/contents/blimp_contents_view.h" |
| 16 #include "blimp/client/public/contents/blimp_navigation_controller.h" | 17 #include "blimp/client/public/contents/blimp_navigation_controller.h" |
| 17 #include "cc/layers/layer.h" | 18 #include "cc/layers/layer.h" |
| 18 #include "chrome/browser/android/blimp/blimp_client_context_factory.h" | 19 #include "chrome/browser/android/blimp/blimp_client_context_factory.h" |
| 19 #include "chrome/browser/android/compositor/tab_content_manager.h" | 20 #include "chrome/browser/android/compositor/tab_content_manager.h" |
| 20 #include "chrome/browser/android/metrics/uma_utils.h" | 21 #include "chrome/browser/android/metrics/uma_utils.h" |
| 21 #include "chrome/browser/android/offline_pages/offline_page_bridge.h" | 22 #include "chrome/browser/android/offline_pages/offline_page_bridge.h" |
| 22 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 23 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 23 #include "chrome/browser/android/offline_pages/offline_page_utils.h" | 24 #include "chrome/browser/android/offline_pages/offline_page_utils.h" |
| 24 #include "chrome/browser/android/tab_web_contents_delegate_android.h" | 25 #include "chrome/browser/android/tab_web_contents_delegate_android.h" |
| 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 26 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 442 |
| 442 // Let's detach the layer from WebContents first, just to be sure. | 443 // Let's detach the layer from WebContents first, just to be sure. |
| 443 if (web_contents_ && web_contents_->GetNativeView() && | 444 if (web_contents_ && web_contents_->GetNativeView() && |
| 444 web_contents_->GetNativeView()->GetLayer()) { | 445 web_contents_->GetNativeView()->GetLayer()) { |
| 445 cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer(); | 446 cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer(); |
| 446 if (web_contents_layer->parent() == content_layer_.get()) | 447 if (web_contents_layer->parent() == content_layer_.get()) |
| 447 web_contents_layer->RemoveFromParent(); | 448 web_contents_layer->RemoveFromParent(); |
| 448 } | 449 } |
| 449 | 450 |
| 450 // Attach the layer holding the tab contents to the |content_layer_|. | 451 // Attach the layer holding the tab contents to the |content_layer_|. |
| 451 content_layer_->InsertChild(blimp_contents_->GetNativeView()->GetLayer(), 0); | 452 content_layer_->InsertChild( |
| 453 blimp_contents_->GetView()->GetNativeView()->GetLayer(), 0); |
| 452 | 454 |
| 453 return blimp_contents_->GetJavaObject(); | 455 return blimp_contents_->GetJavaObject(); |
| 454 } | 456 } |
| 455 | 457 |
| 456 void TabAndroid::UpdateDelegates( | 458 void TabAndroid::UpdateDelegates( |
| 457 JNIEnv* env, | 459 JNIEnv* env, |
| 458 const JavaParamRef<jobject>& obj, | 460 const JavaParamRef<jobject>& obj, |
| 459 const JavaParamRef<jobject>& jweb_contents_delegate, | 461 const JavaParamRef<jobject>& jweb_contents_delegate, |
| 460 const JavaParamRef<jobject>& jcontext_menu_populator) { | 462 const JavaParamRef<jobject>& jcontext_menu_populator) { |
| 461 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( | 463 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 920 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 919 TRACE_EVENT0("native", "TabAndroid::Init"); | 921 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 920 // This will automatically bind to the Java object and pass ownership there. | 922 // This will automatically bind to the Java object and pass ownership there. |
| 921 new TabAndroid(env, obj); | 923 new TabAndroid(env, obj); |
| 922 } | 924 } |
| 923 | 925 |
| 924 // static | 926 // static |
| 925 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 927 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 926 return RegisterNativesImpl(env); | 928 return RegisterNativesImpl(env); |
| 927 } | 929 } |
| OLD | NEW |