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 "base/memory/ptr_util.h" |
7 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
8 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
10 | 11 |
11 using content::BrowserThread; | 12 using content::BrowserThread; |
12 using content::WebContents; | 13 using content::WebContents; |
13 | 14 |
14 namespace android_webview { | 15 namespace android_webview { |
15 | 16 |
16 namespace { | 17 namespace { |
(...skipping 20 matching lines...) Expand all Loading... |
37 DISALLOW_COPY_AND_ASSIGN(UserData); | 38 DISALLOW_COPY_AND_ASSIGN(UserData); |
38 }; | 39 }; |
39 | 40 |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 // static | 43 // static |
43 void AwContentsClientBridgeBase::Associate( | 44 void AwContentsClientBridgeBase::Associate( |
44 WebContents* web_contents, | 45 WebContents* web_contents, |
45 AwContentsClientBridgeBase* handler) { | 46 AwContentsClientBridgeBase* handler) { |
46 web_contents->SetUserData(kAwContentsClientBridgeBase, | 47 web_contents->SetUserData(kAwContentsClientBridgeBase, |
47 new UserData(handler)); | 48 base::MakeUnique<UserData>(handler)); |
48 } | 49 } |
49 | 50 |
50 // static | 51 // static |
51 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromWebContents( | 52 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromWebContents( |
52 WebContents* web_contents) { | 53 WebContents* web_contents) { |
53 return UserData::GetContents(web_contents); | 54 return UserData::GetContents(web_contents); |
54 } | 55 } |
55 | 56 |
56 // static | 57 // static |
57 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromWebContentsGetter( | 58 AwContentsClientBridgeBase* AwContentsClientBridgeBase::FromWebContentsGetter( |
(...skipping 13 matching lines...) Expand all Loading... |
71 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | 72 content::RenderFrameHost::FromID(render_process_id, render_frame_id); |
72 content::WebContents* web_contents = | 73 content::WebContents* web_contents = |
73 content::WebContents::FromRenderFrameHost(rfh); | 74 content::WebContents::FromRenderFrameHost(rfh); |
74 return UserData::GetContents(web_contents); | 75 return UserData::GetContents(web_contents); |
75 } | 76 } |
76 | 77 |
77 AwContentsClientBridgeBase::~AwContentsClientBridgeBase() { | 78 AwContentsClientBridgeBase::~AwContentsClientBridgeBase() { |
78 } | 79 } |
79 | 80 |
80 } // namespace android_webview | 81 } // namespace android_webview |
OLD | NEW |