OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/aw_contents_client_bridge_base.h" | 5 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
6 | 6 |
7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 #include "content/public/browser/render_frame_host.h" | 8 #include "content/public/browser/render_frame_host.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 // static | 42 // static |
43 void AwContentsClientBridgeBase::Associate( | 43 void AwContentsClientBridgeBase::Associate( |
44 WebContents* web_contents, | 44 WebContents* web_contents, |
45 AwContentsClientBridgeBase* handler) { | 45 AwContentsClientBridgeBase* handler) { |
46 web_contents->SetUserData(kAwContentsClientBridgeBase, | 46 web_contents->SetUserData(kAwContentsClientBridgeBase, |
47 new UserData(handler)); | 47 new UserData(handler)); |
48 } | 48 } |
49 | 49 |
50 void AwContentsClientBridgeBase::Disassociate( | |
51 WebContents* web_contents) { | |
52 web_contents->RemoveUserData(kAwContentsClientBridgeBase); | |
53 } | |
54 | |
55 // static | 50 // static |
56 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromWebContents( | 51 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromWebContents( |
57 WebContents* web_contents) { | 52 WebContents* web_contents) { |
58 return UserData::GetContents(web_contents); | 53 return UserData::GetContents(web_contents); |
59 } | 54 } |
60 | 55 |
61 // static | 56 // static |
62 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromID( | 57 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromID( |
63 int render_process_id, | 58 int render_process_id, |
64 int render_frame_id) { | 59 int render_frame_id) { |
65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
66 content::RenderFrameHost* rfh = | 61 content::RenderFrameHost* rfh = |
67 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | 62 content::RenderFrameHost::FromID(render_process_id, render_frame_id); |
68 content::WebContents* web_contents = | 63 content::WebContents* web_contents = |
69 content::WebContents::FromRenderFrameHost(rfh); | 64 content::WebContents::FromRenderFrameHost(rfh); |
70 return UserData::GetContents(web_contents); | 65 return UserData::GetContents(web_contents); |
71 } | 66 } |
72 | 67 |
73 AwContentsClientBridgeBase::~AwContentsClientBridgeBase() { | 68 AwContentsClientBridgeBase::~AwContentsClientBridgeBase() { |
74 } | 69 } |
75 | 70 |
76 } // namespace android_webview | 71 } // namespace android_webview |
OLD | NEW |