| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 439 |
| 439 // Let's detach the layer from WebContents first, just to be sure. | 440 // Let's detach the layer from WebContents first, just to be sure. |
| 440 if (web_contents_ && web_contents_->GetNativeView() && | 441 if (web_contents_ && web_contents_->GetNativeView() && |
| 441 web_contents_->GetNativeView()->GetLayer()) { | 442 web_contents_->GetNativeView()->GetLayer()) { |
| 442 cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer(); | 443 cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer(); |
| 443 if (web_contents_layer->parent() == content_layer_.get()) | 444 if (web_contents_layer->parent() == content_layer_.get()) |
| 444 web_contents_layer->RemoveFromParent(); | 445 web_contents_layer->RemoveFromParent(); |
| 445 } | 446 } |
| 446 | 447 |
| 447 // Attach the layer holding the tab contents to the |content_layer_|. | 448 // Attach the layer holding the tab contents to the |content_layer_|. |
| 448 content_layer_->InsertChild(blimp_contents_->GetNativeView()->GetLayer(), 0); | 449 content_layer_->InsertChild( |
| 450 blimp_contents_->GetView()->GetNativeView()->GetLayer(), 0); |
| 449 | 451 |
| 450 return blimp_contents_->GetJavaObject(); | 452 return blimp_contents_->GetJavaObject(); |
| 451 } | 453 } |
| 452 | 454 |
| 453 void TabAndroid::UpdateDelegates( | 455 void TabAndroid::UpdateDelegates( |
| 454 JNIEnv* env, | 456 JNIEnv* env, |
| 455 const JavaParamRef<jobject>& obj, | 457 const JavaParamRef<jobject>& obj, |
| 456 const JavaParamRef<jobject>& jweb_contents_delegate, | 458 const JavaParamRef<jobject>& jweb_contents_delegate, |
| 457 const JavaParamRef<jobject>& jcontext_menu_populator) { | 459 const JavaParamRef<jobject>& jcontext_menu_populator) { |
| 458 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( | 460 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 917 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 916 TRACE_EVENT0("native", "TabAndroid::Init"); | 918 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 917 // This will automatically bind to the Java object and pass ownership there. | 919 // This will automatically bind to the Java object and pass ownership there. |
| 918 new TabAndroid(env, obj); | 920 new TabAndroid(env, obj); |
| 919 } | 921 } |
| 920 | 922 |
| 921 // static | 923 // static |
| 922 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 924 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 923 return RegisterNativesImpl(env); | 925 return RegisterNativesImpl(env); |
| 924 } | 926 } |
| OLD | NEW |