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

Side by Side Diff: content/browser/android/download_controller_android_impl.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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/browser/android/download_controller_android_impl.h" 5 #include "content/browser/android/download_controller_android_impl.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/android/context_utils.h" 10 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
11 #include "base/android/jni_string.h" 12 #include "base/android/jni_string.h"
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "content/browser/android/content_view_core_impl.h" 18 #include "content/browser/android/content_view_core_impl.h"
19 #include "content/browser/android/deferred_download_observer.h" 19 #include "content/browser/android/deferred_download_observer.h"
20 #include "content/browser/download/download_item_impl.h" 20 #include "content/browser/download/download_item_impl.h"
21 #include "content/browser/download/download_manager_impl.h" 21 #include "content/browser/download/download_manager_impl.h"
22 #include "content/browser/loader/resource_dispatcher_host_impl.h" 22 #include "content/browser/loader/resource_dispatcher_host_impl.h"
23 #include "content/browser/renderer_host/render_process_host_impl.h" 23 #include "content/browser/renderer_host/render_process_host_impl.h"
24 #include "content/browser/renderer_host/render_view_host_delegate.h" 24 #include "content/browser/renderer_host/render_view_host_delegate.h"
25 #include "content/browser/renderer_host/render_view_host_impl.h" 25 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (!web_contents) 73 if (!web_contents)
74 return; 74 return;
75 75
76 const GURL& url = is_link ? params.link_url : params.src_url; 76 const GURL& url = is_link ? params.link_url : params.src_url;
77 const GURL& referring_url = 77 const GURL& referring_url =
78 params.frame_url.is_empty() ? params.page_url : params.frame_url; 78 params.frame_url.is_empty() ? params.page_url : params.frame_url;
79 content::DownloadManagerImpl* dlm = 79 content::DownloadManagerImpl* dlm =
80 static_cast<content::DownloadManagerImpl*>( 80 static_cast<content::DownloadManagerImpl*>(
81 content::BrowserContext::GetDownloadManager( 81 content::BrowserContext::GetDownloadManager(
82 web_contents->GetBrowserContext())); 82 web_contents->GetBrowserContext()));
83 scoped_ptr<content::DownloadUrlParameters> dl_params( 83 std::unique_ptr<content::DownloadUrlParameters> dl_params(
84 content::DownloadUrlParameters::FromWebContents(web_contents, url)); 84 content::DownloadUrlParameters::FromWebContents(web_contents, url));
85 content::Referrer referrer = content::Referrer::SanitizeForRequest( 85 content::Referrer referrer = content::Referrer::SanitizeForRequest(
86 url, 86 url,
87 content::Referrer(referring_url.GetAsReferrer(), params.referrer_policy)); 87 content::Referrer(referring_url.GetAsReferrer(), params.referrer_policy));
88 dl_params->set_referrer(referrer); 88 dl_params->set_referrer(referrer);
89 if (is_link) 89 if (is_link)
90 dl_params->set_referrer_encoding(params.frame_charset); 90 dl_params->set_referrer_encoding(params.frame_charset);
91 net::HttpRequestHeaders headers; 91 net::HttpRequestHeaders headers;
92 headers.AddHeadersFromString(extra_headers); 92 headers.AddHeadersFromString(extra_headers);
93 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();) 93 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();)
(...skipping 25 matching lines...) Expand all
119 } 119 }
120 120
121 static void OnRequestFileAccessResult(JNIEnv* env, 121 static void OnRequestFileAccessResult(JNIEnv* env,
122 const JavaParamRef<jobject>& obj, 122 const JavaParamRef<jobject>& obj,
123 jlong callback_id, 123 jlong callback_id,
124 jboolean granted) { 124 jboolean granted) {
125 DCHECK_CURRENTLY_ON(BrowserThread::UI); 125 DCHECK_CURRENTLY_ON(BrowserThread::UI);
126 DCHECK(callback_id); 126 DCHECK(callback_id);
127 127
128 // Convert java long long int to c++ pointer, take ownership. 128 // Convert java long long int to c++ pointer, take ownership.
129 scoped_ptr<DownloadControllerAndroid::AcquireFileAccessPermissionCallback> cb( 129 std::unique_ptr<
130 reinterpret_cast< 130 DownloadControllerAndroid::AcquireFileAccessPermissionCallback>
131 DownloadControllerAndroid::AcquireFileAccessPermissionCallback*>( 131 cb(reinterpret_cast<
132 callback_id)); 132 DownloadControllerAndroid::AcquireFileAccessPermissionCallback*>(
133 callback_id));
133 cb->Run(granted); 134 cb->Run(granted);
134 } 135 }
135 136
136 struct DownloadControllerAndroidImpl::JavaObject { 137 struct DownloadControllerAndroidImpl::JavaObject {
137 ScopedJavaLocalRef<jobject> Controller(JNIEnv* env) { 138 ScopedJavaLocalRef<jobject> Controller(JNIEnv* env) {
138 return GetRealObject(env, obj); 139 return GetRealObject(env, obj);
139 } 140 }
140 jweak obj; 141 jweak obj;
141 }; 142 };
142 143
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 605 }
605 606
606 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 607 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
607 if (info) 608 if (info)
608 has_user_gesture = info->HasUserGesture(); 609 has_user_gesture = info->HasUserGesture();
609 } 610 }
610 611
611 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} 612 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {}
612 613
613 } // namespace content 614 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698