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

Side by Side Diff: chrome/browser/net/sdch_dictionary_fetcher.cc

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 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/net/sdch_dictionary_fetcher.h" 5 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/common/content_url_request_user_data.h"
11 #include "content/public/common/url_fetcher.h" 12 #include "content/public/common/url_fetcher.h"
12 #include "net/url_request/url_request_context_getter.h" 13 #include "net/url_request/url_request_context_getter.h"
13 #include "net/url_request/url_request_status.h" 14 #include "net/url_request/url_request_status.h"
14 15
15 SdchDictionaryFetcher::SdchDictionaryFetcher( 16 SdchDictionaryFetcher::SdchDictionaryFetcher(
16 net::URLRequestContextGetter* context) 17 net::URLRequestContextGetter* context)
17 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 18 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
18 task_is_pending_(false), 19 task_is_pending_(false),
19 context_(context) { 20 context_(context) {
20 DCHECK(CalledOnValidThread()); 21 DCHECK(CalledOnValidThread());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 void SdchDictionaryFetcher::StartFetching() { 64 void SdchDictionaryFetcher::StartFetching() {
64 DCHECK(task_is_pending_); 65 DCHECK(task_is_pending_);
65 task_is_pending_ = false; 66 task_is_pending_ = false;
66 67
67 DCHECK(context_.get()); 68 DCHECK(context_.get());
68 current_fetch_.reset(content::URLFetcher::Create( 69 current_fetch_.reset(content::URLFetcher::Create(
69 fetch_queue_.front(), content::URLFetcher::GET, this)); 70 fetch_queue_.front(), content::URLFetcher::GET, this));
70 fetch_queue_.pop(); 71 fetch_queue_.pop();
71 current_fetch_->SetRequestContext(context_.get()); 72 current_fetch_->SetRequestContext(context_.get());
73 // TODO(jochen): Do cookie audit.
74 current_fetch_->SetContentURLRequestUserData(
75 new content::ContentURLRequestUserData());
72 current_fetch_->Start(); 76 current_fetch_->Start();
73 } 77 }
74 78
75 void SdchDictionaryFetcher::OnURLFetchComplete( 79 void SdchDictionaryFetcher::OnURLFetchComplete(
76 const content::URLFetcher* source) { 80 const content::URLFetcher* source) {
77 if ((200 == source->GetResponseCode()) && 81 if ((200 == source->GetResponseCode()) &&
78 (source->GetStatus().status() == net::URLRequestStatus::SUCCESS)) { 82 (source->GetStatus().status() == net::URLRequestStatus::SUCCESS)) {
79 std::string data; 83 std::string data;
80 source->GetResponseAsString(&data); 84 source->GetResponseAsString(&data);
81 net::SdchManager::Global()->AddSdchDictionary(data, source->GetURL()); 85 net::SdchManager::Global()->AddSdchDictionary(data, source->GetURL());
82 } 86 }
83 current_fetch_.reset(NULL); 87 current_fetch_.reset(NULL);
84 ScheduleDelayedRun(); 88 ScheduleDelayedRun();
85 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698