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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 2270323004: Add BlimpView to a Chrome tab when Blimp is enabled. (Closed)
Patch Set: addressed nit, renamed CreateForTesting and piped through touch handling Created 4 years, 3 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 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"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "content/public/browser/render_view_host.h" 80 #include "content/public/browser/render_view_host.h"
81 #include "content/public/browser/user_metrics.h" 81 #include "content/public/browser/user_metrics.h"
82 #include "content/public/browser/web_contents.h" 82 #include "content/public/browser/web_contents.h"
83 #include "content/public/common/resource_request_body.h" 83 #include "content/public/common/resource_request_body.h"
84 #include "content/public/common/top_controls_state.h" 84 #include "content/public/common/top_controls_state.h"
85 #include "jni/Tab_jni.h" 85 #include "jni/Tab_jni.h"
86 #include "net/base/escape.h" 86 #include "net/base/escape.h"
87 #include "skia/ext/image_operations.h" 87 #include "skia/ext/image_operations.h"
88 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 88 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
89 #include "ui/android/view_android.h" 89 #include "ui/android/view_android.h"
90 #include "ui/android/window_android.h"
90 #include "ui/base/resource/resource_bundle.h" 91 #include "ui/base/resource/resource_bundle.h"
91 #include "ui/base/window_open_disposition.h" 92 #include "ui/base/window_open_disposition.h"
92 #include "ui/display/display.h" 93 #include "ui/display/display.h"
93 #include "ui/display/screen.h" 94 #include "ui/display/screen.h"
94 #include "ui/gfx/android/java_bitmap.h" 95 #include "ui/gfx/android/java_bitmap.h"
95 #include "ui/gfx/favicon_size.h" 96 #include "ui/gfx/favicon_size.h"
96 #include "ui/gfx/image/image_skia.h" 97 #include "ui/gfx/image/image_skia.h"
97 98
98 using base::android::AttachCurrentThread; 99 using base::android::AttachCurrentThread;
99 using base::android::ConvertUTF8ToJavaString; 100 using base::android::ConvertUTF8ToJavaString;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (instant_service) 417 if (instant_service)
417 instant_service->AddObserver(this); 418 instant_service->AddObserver(this);
418 419
419 if (!blimp_contents_) 420 if (!blimp_contents_)
420 content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0); 421 content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0);
421 } 422 }
422 423
423 base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents( 424 base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents(
424 JNIEnv* env, 425 JNIEnv* env,
425 const JavaParamRef<jobject>& obj, 426 const JavaParamRef<jobject>& obj,
426 const JavaParamRef<jobject>& j_profile) { 427 const JavaParamRef<jobject>& j_profile,
428 jlong window_android_ptr) {
427 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile.obj()); 429 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile.obj());
428 DCHECK(!profile->IsOffTheRecord()); 430 DCHECK(!profile->IsOffTheRecord());
429 blimp::client::BlimpClientContext* context = 431 blimp::client::BlimpClientContext* context =
430 BlimpClientContextFactory::GetForBrowserContext(profile); 432 BlimpClientContextFactory::GetForBrowserContext(profile);
431 DCHECK(context); 433 DCHECK(context);
432 blimp_contents_ = context->CreateBlimpContents(); 434 ui::WindowAndroid* window =
435 reinterpret_cast<ui::WindowAndroid*>(window_android_ptr);
436 blimp_contents_ = context->CreateBlimpContents(window);
433 DCHECK(blimp_contents_); 437 DCHECK(blimp_contents_);
434 438
435 // Let's detach the layer from WebContents first, just to be sure. 439 // Let's detach the layer from WebContents first, just to be sure.
436 if (web_contents_ && web_contents_->GetNativeView() && 440 if (web_contents_ && web_contents_->GetNativeView() &&
437 web_contents_->GetNativeView()->GetLayer()) { 441 web_contents_->GetNativeView()->GetLayer()) {
438 cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer(); 442 cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer();
439 if (web_contents_layer->parent() == content_layer_.get()) 443 if (web_contents_layer->parent() == content_layer_.get())
440 web_contents_layer->RemoveFromParent(); 444 web_contents_layer->RemoveFromParent();
441 } 445 }
442 446
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 915 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
912 TRACE_EVENT0("native", "TabAndroid::Init"); 916 TRACE_EVENT0("native", "TabAndroid::Init");
913 // This will automatically bind to the Java object and pass ownership there. 917 // This will automatically bind to the Java object and pass ownership there.
914 new TabAndroid(env, obj); 918 new TabAndroid(env, obj);
915 } 919 }
916 920
917 // static 921 // static
918 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 922 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
919 return RegisterNativesImpl(env); 923 return RegisterNativesImpl(env);
920 } 924 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | ui/android/java/src/org/chromium/ui/base/WindowAndroid.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698