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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_cookie_helper.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 5 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
6 6
7 #include "utility" 7 #include "utility"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 BrowserThread::IO, FROM_HERE, 56 BrowserThread::IO, FROM_HERE,
57 base::Bind(&BrowsingDataCookieHelper::DeleteCookieOnIOThread, 57 base::Bind(&BrowsingDataCookieHelper::DeleteCookieOnIOThread,
58 this, cookie)); 58 this, cookie));
59 } 59 }
60 60
61 void BrowsingDataCookieHelper::FetchCookiesOnIOThread() { 61 void BrowsingDataCookieHelper::FetchCookiesOnIOThread() {
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
63 scoped_refptr<net::CookieMonster> cookie_monster = 63 scoped_refptr<net::CookieMonster> cookie_monster =
64 request_context_getter_->GetURLRequestContext()-> 64 request_context_getter_->GetURLRequestContext()->
65 cookie_store()->GetCookieMonster(); 65 cookie_store()->GetCookieMonster();
66 if (cookie_monster) { 66 if (cookie_monster.get()) {
67 cookie_monster->GetAllCookiesAsync( 67 cookie_monster->GetAllCookiesAsync(
68 base::Bind(&BrowsingDataCookieHelper::OnFetchComplete, this)); 68 base::Bind(&BrowsingDataCookieHelper::OnFetchComplete, this));
69 } else { 69 } else {
70 OnFetchComplete(net::CookieList()); 70 OnFetchComplete(net::CookieList());
71 } 71 }
72 } 72 }
73 73
74 void BrowsingDataCookieHelper::OnFetchComplete(const net::CookieList& cookies) { 74 void BrowsingDataCookieHelper::OnFetchComplete(const net::CookieList& cookies) {
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
76 BrowserThread::PostTask( 76 BrowserThread::PostTask(
77 BrowserThread::UI, FROM_HERE, 77 BrowserThread::UI, FROM_HERE,
78 base::Bind(&BrowsingDataCookieHelper::NotifyInUIThread, this, cookies)); 78 base::Bind(&BrowsingDataCookieHelper::NotifyInUIThread, this, cookies));
79 } 79 }
80 80
81 void BrowsingDataCookieHelper::NotifyInUIThread( 81 void BrowsingDataCookieHelper::NotifyInUIThread(
82 const net::CookieList& cookies) { 82 const net::CookieList& cookies) {
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
84 DCHECK(is_fetching_); 84 DCHECK(is_fetching_);
85 is_fetching_ = false; 85 is_fetching_ = false;
86 completion_callback_.Run(cookies); 86 completion_callback_.Run(cookies);
87 completion_callback_.Reset(); 87 completion_callback_.Reset();
88 } 88 }
89 89
90 void BrowsingDataCookieHelper::DeleteCookieOnIOThread( 90 void BrowsingDataCookieHelper::DeleteCookieOnIOThread(
91 const net::CanonicalCookie& cookie) { 91 const net::CanonicalCookie& cookie) {
92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
93 scoped_refptr<net::CookieMonster> cookie_monster = 93 scoped_refptr<net::CookieMonster> cookie_monster =
94 request_context_getter_->GetURLRequestContext()-> 94 request_context_getter_->GetURLRequestContext()->
95 cookie_store()->GetCookieMonster(); 95 cookie_store()->GetCookieMonster();
96 if (cookie_monster) { 96 if (cookie_monster.get()) {
97 cookie_monster->DeleteCanonicalCookieAsync( 97 cookie_monster->DeleteCanonicalCookieAsync(
98 cookie, net::CookieMonster::DeleteCookieCallback()); 98 cookie, net::CookieMonster::DeleteCookieCallback());
99 } 99 }
100 } 100 }
101 101
102 CannedBrowsingDataCookieHelper::CannedBrowsingDataCookieHelper( 102 CannedBrowsingDataCookieHelper::CannedBrowsingDataCookieHelper(
103 net::URLRequestContextGetter* request_context_getter) 103 net::URLRequestContextGetter* request_context_getter)
104 : BrowsingDataCookieHelper(request_context_getter) { 104 : BrowsingDataCookieHelper(request_context_getter) {
105 } 105 }
106 106
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // collecting cookies per origin in redirect chains. 232 // collecting cookies per origin in redirect chains.
233 // TODO(markusheintz): A) Change the GetCookiesCount method to prevent 233 // TODO(markusheintz): A) Change the GetCookiesCount method to prevent
234 // counting cookies multiple times if they are stored in multiple cookie 234 // counting cookies multiple times if they are stored in multiple cookie
235 // lists. B) Replace the GetCookieFor method call below with: 235 // lists. B) Replace the GetCookieFor method call below with:
236 // "GetCookiesFor(frame_url.GetOrigin());" 236 // "GetCookiesFor(frame_url.GetOrigin());"
237 net::CookieList* cookie_list = 237 net::CookieList* cookie_list =
238 GetCookiesFor(GURL(kGlobalCookieListURL)); 238 GetCookiesFor(GURL(kGlobalCookieListURL));
239 DeleteMatchingCookie(cookie, cookie_list); 239 DeleteMatchingCookie(cookie, cookie_list);
240 cookie_list->push_back(cookie); 240 cookie_list->push_back(cookie);
241 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698