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

Side by Side Diff: content/shell/android/shell_manager.cc

Issue 11231017: Remove ::create factory functions from objects created via WebCompositorSupport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android fixes + no .gitmodules Created 8 years, 2 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 | Annotate | Revision Log
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/shell/android/shell_manager.h" 5 #include "content/shell/android/shell_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "content/shell/shell.h" 14 #include "content/shell/shell.h"
15 #include "content/shell/shell_browser_context.h" 15 #include "content/shell/shell_browser_context.h"
16 #include "content/shell/shell_content_browser_client.h" 16 #include "content/shell/shell_content_browser_client.h"
17 #include "content/public/browser/android/compositor.h" 17 #include "content/public/browser/android/compositor.h"
18 #include "content/public/browser/android/draw_delegate.h" 18 #include "content/public/browser/android/draw_delegate.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/shell/shell.h" 20 #include "content/shell/shell.h"
21 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
22 #include "jni/ShellManager_jni.h" 22 #include "jni/ShellManager_jni.h"
23 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
24 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor t.h"
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
24 #include "ui/gfx/size.h" 26 #include "ui/gfx/size.h"
25 27
26 #include <android/native_window_jni.h> 28 #include <android/native_window_jni.h>
27 29
28 using base::android::ScopedJavaLocalRef; 30 using base::android::ScopedJavaLocalRef;
29 using content::Compositor; 31 using content::Compositor;
30 using content::DrawDelegate; 32 using content::DrawDelegate;
31 33
32 namespace { 34 namespace {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 72
71 namespace content { 73 namespace content {
72 74
73 jobject CreateShellView() { 75 jobject CreateShellView() {
74 JNIEnv* env = base::android::AttachCurrentThread(); 76 JNIEnv* env = base::android::AttachCurrentThread();
75 if (!GetCompositor()) { 77 if (!GetCompositor()) {
76 Compositor::Initialize(); 78 Compositor::Initialize();
77 g_global_state.Get().compositor.reset(Compositor::Create( 79 g_global_state.Get().compositor.reset(Compositor::Create(
78 &g_global_state.Get().client)); 80 &g_global_state.Get().client));
79 DCHECK(!g_global_state.Get().root_layer.get()); 81 DCHECK(!g_global_state.Get().root_layer.get());
80 g_global_state.Get().root_layer.reset(WebKit::WebLayer::create()); 82 WebKit::WebCompositorSupport* compositor_support =
83 WebKit::Platform::current()->compositorSupport();
84 g_global_state.Get().root_layer.reset(compositor_support->createLayer());
81 } 85 }
82 return Java_ShellManager_createShell( 86 return Java_ShellManager_createShell(
83 env, g_global_state.Get().j_obj.obj()).Release(); 87 env, g_global_state.Get().j_obj.obj()).Release();
84 } 88 }
85 89
86 // Register native methods 90 // Register native methods
87 bool RegisterShellManager(JNIEnv* env) { 91 bool RegisterShellManager(JNIEnv* env) {
88 return RegisterNativesImpl(env); 92 return RegisterNativesImpl(env);
89 } 93 }
90 94
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void ShellAttachLayer(WebKit::WebLayer* layer) { 133 void ShellAttachLayer(WebKit::WebLayer* layer) {
130 g_global_state.Get().root_layer->addChild(layer); 134 g_global_state.Get().root_layer->addChild(layer);
131 } 135 }
132 136
133 137
134 void ShellRemoveLayer(WebKit::WebLayer* layer) { 138 void ShellRemoveLayer(WebKit::WebLayer* layer) {
135 layer->removeFromParent(); 139 layer->removeFromParent();
136 } 140 }
137 141
138 } // namespace content 142 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698