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

Side by Side Diff: android_webview/browser/aw_login_delegate.cc

Issue 2851673002: 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
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/browser/aw_login_delegate.h" 5 #include "android_webview/browser/aw_login_delegate.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/supports_user_data.h" 11 #include "base/supports_user_data.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/resource_dispatcher_host.h" 14 #include "content/public/browser/resource_dispatcher_host.h"
14 #include "content/public/browser/resource_request_info.h" 15 #include "content/public/browser/resource_request_info.h"
15 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
16 #include "net/base/auth.h" 17 #include "net/base/auth.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
18 19
19 using namespace base::android; 20 using namespace base::android;
(...skipping 25 matching lines...) Expand all
45 render_frame_id_(0) { 46 render_frame_id_(0) {
46 ResourceRequestInfo::GetRenderFrameForRequest( 47 ResourceRequestInfo::GetRenderFrameForRequest(
47 request, &render_process_id_, &render_frame_id_); 48 request, &render_process_id_, &render_frame_id_);
48 49
49 UrlRequestAuthAttemptsData* count = 50 UrlRequestAuthAttemptsData* count =
50 static_cast<UrlRequestAuthAttemptsData*>( 51 static_cast<UrlRequestAuthAttemptsData*>(
51 request->GetUserData(kAuthAttemptsKey)); 52 request->GetUserData(kAuthAttemptsKey));
52 53
53 if (count == NULL) { 54 if (count == NULL) {
54 count = new UrlRequestAuthAttemptsData(); 55 count = new UrlRequestAuthAttemptsData();
55 request->SetUserData(kAuthAttemptsKey, count); 56 request->SetUserData(kAuthAttemptsKey, base::WrapUnique(count));
56 } 57 }
57 58
58 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 59 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
59 base::Bind(&AwLoginDelegate::HandleHttpAuthRequestOnUIThread, 60 base::Bind(&AwLoginDelegate::HandleHttpAuthRequestOnUIThread,
60 this, (count->auth_attempts_ == 0))); 61 this, (count->auth_attempts_ == 0)));
61 count->auth_attempts_++; 62 count->auth_attempts_++;
62 } 63 }
63 64
64 AwLoginDelegate::~AwLoginDelegate() { 65 AwLoginDelegate::~AwLoginDelegate() {
65 // The Auth handler holds a ref count back on |this| object, so it should be 66 // The Auth handler holds a ref count back on |this| object, so it should be
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void AwLoginDelegate::DeleteAuthHandlerSoon() { 129 void AwLoginDelegate::DeleteAuthHandlerSoon() {
129 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 130 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 131 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
131 base::Bind(&AwLoginDelegate::DeleteAuthHandlerSoon, this)); 132 base::Bind(&AwLoginDelegate::DeleteAuthHandlerSoon, this));
132 return; 133 return;
133 } 134 }
134 aw_http_auth_handler_.reset(); 135 aw_http_auth_handler_.reset();
135 } 136 }
136 137
137 } // namespace android_webview 138 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_contents_client_bridge_base.cc ('k') | android_webview/browser/aw_print_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698