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

Side by Side Diff: chromecast/browser/android/cast_web_contents_activity.cc

Issue 2844413004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 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 | « chromecast/browser/android/cast_web_contents_activity.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chromecast/browser/android/cast_web_contents_activity.h" 5 #include "chromecast/browser/android/cast_web_contents_activity.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
8 #include "jni/CastWebContentsActivity_jni.h" 9 #include "jni/CastWebContentsActivity_jni.h"
9 10
10 using base::android::JavaParamRef; 11 using base::android::JavaParamRef;
11 using base::android::ScopedJavaGlobalRef; 12 using base::android::ScopedJavaGlobalRef;
12 using base::android::ScopedJavaLocalRef; 13 using base::android::ScopedJavaLocalRef;
13 14
14 namespace chromecast { 15 namespace chromecast {
15 namespace shell { 16 namespace shell {
16 17
(...skipping 22 matching lines...) Expand all
39 } 40 }
40 41
41 // static 42 // static
42 CastWebContentsActivity* CastWebContentsActivity::Get( 43 CastWebContentsActivity* CastWebContentsActivity::Get(
43 content::WebContents* web_contents) { 44 content::WebContents* web_contents) {
44 DCHECK(web_contents); 45 DCHECK(web_contents);
45 CastWebContentsActivity* instance = static_cast<CastWebContentsActivity*>( 46 CastWebContentsActivity* instance = static_cast<CastWebContentsActivity*>(
46 web_contents->GetUserData(kCastWebContentsActivityKey)); 47 web_contents->GetUserData(kCastWebContentsActivityKey));
47 if (!instance) { 48 if (!instance) {
48 instance = new CastWebContentsActivity(web_contents); 49 instance = new CastWebContentsActivity(web_contents);
49 web_contents->SetUserData(kCastWebContentsActivityKey, instance); 50 web_contents->SetUserData(kCastWebContentsActivityKey,
51 base::WrapUnique(instance));
50 } 52 }
51 return instance; 53 return instance;
52 } 54 }
53 55
54 CastWebContentsActivity::CastWebContentsActivity( 56 CastWebContentsActivity::CastWebContentsActivity(
55 content::WebContents* web_contents) 57 content::WebContents* web_contents)
56 : content_video_view_embedder_(ScopedJavaLocalRef<jobject>()) {} 58 : content_video_view_embedder_(ScopedJavaLocalRef<jobject>()) {}
57 59
58 CastWebContentsActivity::~CastWebContentsActivity() {} 60 CastWebContentsActivity::~CastWebContentsActivity() {}
59 61
60 ScopedJavaLocalRef<jobject> 62 ScopedJavaLocalRef<jobject>
61 CastWebContentsActivity::GetContentVideoViewEmbedder() { 63 CastWebContentsActivity::GetContentVideoViewEmbedder() {
62 return ScopedJavaLocalRef<jobject>(content_video_view_embedder_); 64 return ScopedJavaLocalRef<jobject>(content_video_view_embedder_);
63 } 65 }
64 66
65 void CastWebContentsActivity::SetContentVideoViewEmbedder( 67 void CastWebContentsActivity::SetContentVideoViewEmbedder(
66 const JavaParamRef<jobject>& content_video_view_embedder) { 68 const JavaParamRef<jobject>& content_video_view_embedder) {
67 content_video_view_embedder_ = 69 content_video_view_embedder_ =
68 ScopedJavaGlobalRef<jobject>(content_video_view_embedder); 70 ScopedJavaGlobalRef<jobject>(content_video_view_embedder);
69 } 71 }
70 72
71 } // namespace shell 73 } // namespace shell
72 } // namespace chromecast 74 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/android/cast_web_contents_activity.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698