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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 12207061: Add a utility method to receive an AwContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a DCHECK Created 7 years, 10 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
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <sys/system_properties.h> 7 #include <sys/system_properties.h>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 17 matching lines...) Expand all
28 #include "base/pickle.h" 28 #include "base/pickle.h"
29 #include "base/string16.h" 29 #include "base/string16.h"
30 #include "base/supports_user_data.h" 30 #include "base/supports_user_data.h"
31 #include "cc/layer.h" 31 #include "cc/layer.h"
32 #include "components/navigation_interception/intercept_navigation_delegate.h" 32 #include "components/navigation_interception/intercept_navigation_delegate.h"
33 #include "content/public/browser/android/content_view_core.h" 33 #include "content/public/browser/android/content_view_core.h"
34 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/cert_store.h" 35 #include "content/public/browser/cert_store.h"
36 #include "content/public/browser/navigation_entry.h" 36 #include "content/public/browser/navigation_entry.h"
37 #include "content/public/browser/render_process_host.h" 37 #include "content/public/browser/render_process_host.h"
38 #include "content/public/browser/render_view_host.h"
38 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
39 #include "content/public/common/ssl_status.h" 40 #include "content/public/common/ssl_status.h"
40 #include "jni/AwContents_jni.h" 41 #include "jni/AwContents_jni.h"
41 #include "net/base/x509_certificate.h" 42 #include "net/base/x509_certificate.h"
42 #include "skia/ext/refptr.h" 43 #include "skia/ext/refptr.h"
43 #include "third_party/skia/include/core/SkBitmap.h" 44 #include "third_party/skia/include/core/SkBitmap.h"
44 #include "third_party/skia/include/core/SkCanvas.h" 45 #include "third_party/skia/include/core/SkCanvas.h"
45 #include "third_party/skia/include/core/SkDevice.h" 46 #include "third_party/skia/include/core/SkDevice.h"
46 #include "third_party/skia/include/core/SkPicture.h" 47 #include "third_party/skia/include/core/SkPicture.h"
47 #include "ui/gfx/android/java_bitmap.h" 48 #include "ui/gfx/android/java_bitmap.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 AwContents* contents_; 109 AwContents* contents_;
109 }; 110 };
110 111
111 } // namespace 112 } // namespace
112 113
113 // static 114 // static
114 AwContents* AwContents::FromWebContents(WebContents* web_contents) { 115 AwContents* AwContents::FromWebContents(WebContents* web_contents) {
115 return AwContentsUserData::GetContents(web_contents); 116 return AwContentsUserData::GetContents(web_contents);
116 } 117 }
117 118
119 // static
120 AwContents* AwContents::FromID(int render_process_id, int render_view_id) {
121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
122 const content::RenderViewHost* rvh =
123 content::RenderViewHost::FromID(render_process_id, render_view_id);
124 if (!rvh) return NULL;
125 content::WebContents* web_contents =
126 content::WebContents::FromRenderViewHost(rvh);
127 if (!web_contents) return NULL;
128 return FromWebContents(web_contents);
129 }
130
118 AwContents::AwContents(JNIEnv* env, 131 AwContents::AwContents(JNIEnv* env,
119 jobject obj, 132 jobject obj,
120 jobject web_contents_delegate) 133 jobject web_contents_delegate)
121 : java_ref_(env, obj), 134 : java_ref_(env, obj),
122 web_contents_delegate_( 135 web_contents_delegate_(
123 new AwWebContentsDelegate(env, web_contents_delegate)), 136 new AwWebContentsDelegate(env, web_contents_delegate)),
124 view_visible_(false), 137 view_visible_(false),
125 compositor_visible_(false), 138 compositor_visible_(false),
126 is_composite_pending_(false), 139 is_composite_pending_(false),
127 last_frame_context_(NULL) { 140 last_frame_context_(NULL) {
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); 924 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id);
912 if (render_view_id != web_contents_->GetRoutingID()) 925 if (render_view_id != web_contents_->GetRoutingID())
913 return; 926 return;
914 927
915 // TODO(leandrogracia): delete when sw rendering uses Ubercompositor. 928 // TODO(leandrogracia): delete when sw rendering uses Ubercompositor.
916 // Invalidation should be provided by the compositor only. 929 // Invalidation should be provided by the compositor only.
917 Invalidate(); 930 Invalidate();
918 } 931 }
919 932
920 } // namespace android_webview 933 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698