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_array.h" | 10 #include "base/android/jni_array.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
15 #include "cc/layers/layer_settings.h" | |
16 #include "chrome/browser/android/compositor/tab_content_manager.h" | 15 #include "chrome/browser/android/compositor/tab_content_manager.h" |
17 #include "chrome/browser/android/metrics/uma_utils.h" | 16 #include "chrome/browser/android/metrics/uma_utils.h" |
18 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 17 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
19 #include "chrome/browser/android/offline_pages/offline_page_utils.h" | 18 #include "chrome/browser/android/offline_pages/offline_page_utils.h" |
20 #include "chrome/browser/android/tab_web_contents_delegate_android.h" | 19 #include "chrome/browser/android/tab_web_contents_delegate_android.h" |
21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 20 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
22 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 21 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
23 #include "chrome/browser/browser_about_handler.h" | 22 #include "chrome/browser/browser_about_handler.h" |
24 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 24 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 114 } |
116 | 115 |
117 void TabAndroid::AttachTabHelpers(content::WebContents* web_contents) { | 116 void TabAndroid::AttachTabHelpers(content::WebContents* web_contents) { |
118 DCHECK(web_contents); | 117 DCHECK(web_contents); |
119 | 118 |
120 TabHelpers::AttachTabHelpers(web_contents); | 119 TabHelpers::AttachTabHelpers(web_contents); |
121 } | 120 } |
122 | 121 |
123 TabAndroid::TabAndroid(JNIEnv* env, jobject obj) | 122 TabAndroid::TabAndroid(JNIEnv* env, jobject obj) |
124 : weak_java_tab_(env, obj), | 123 : weak_java_tab_(env, obj), |
125 content_layer_(cc::Layer::Create(cc::LayerSettings())), | 124 content_layer_(cc::Layer::Create()), |
126 tab_content_manager_(NULL), | 125 tab_content_manager_(NULL), |
127 synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) { | 126 synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) { |
128 Java_Tab_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this)); | 127 Java_Tab_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this)); |
129 } | 128 } |
130 | 129 |
131 TabAndroid::~TabAndroid() { | 130 TabAndroid::~TabAndroid() { |
132 GetContentLayer()->RemoveAllChildren(); | 131 GetContentLayer()->RemoveAllChildren(); |
133 JNIEnv* env = base::android::AttachCurrentThread(); | 132 JNIEnv* env = base::android::AttachCurrentThread(); |
134 Java_Tab_clearNativePtr(env, weak_java_tab_.get(env).obj()); | 133 Java_Tab_clearNativePtr(env, weak_java_tab_.get(env).obj()); |
135 } | 134 } |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 916 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
918 TRACE_EVENT0("native", "TabAndroid::Init"); | 917 TRACE_EVENT0("native", "TabAndroid::Init"); |
919 // This will automatically bind to the Java object and pass ownership there. | 918 // This will automatically bind to the Java object and pass ownership there. |
920 new TabAndroid(env, obj); | 919 new TabAndroid(env, obj); |
921 } | 920 } |
922 | 921 |
923 // static | 922 // static |
924 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 923 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
925 return RegisterNativesImpl(env); | 924 return RegisterNativesImpl(env); |
926 } | 925 } |
OLD | NEW |