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

Side by Side Diff: chrome/browser/intents/cws_intents_registry.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/intents/cws_intents_registry.h" 5 #include "chrome/browser/intents/cws_intents_registry.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_string_value_serializer.h" 8 #include "base/json/json_string_value_serializer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/net/browser_url_util.h" 13 #include "chrome/browser/net/browser_url_util.h"
14 #include "chrome/browser/net/chrome_url_request_context.h" 14 #include "chrome/browser/net/chrome_url_request_context.h"
15 #include "chrome/browser/webdata/web_data_service.h" 15 #include "chrome/browser/webdata/web_data_service.h"
16 #include "content/public/common/content_url_request_user_data.h"
16 #include "content/public/common/url_fetcher.h" 17 #include "content/public/common/url_fetcher.h"
17 #include "net/base/mime_util.h" 18 #include "net/base/mime_util.h"
18 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
19 20
20 namespace { 21 namespace {
21 22
22 // URL for CWS intents API. TODO(groby): points to staging, fix for M18 release. 23 // URL for CWS intents API. TODO(groby): points to staging, fix for M18 release.
23 const char kCWSIntentServiceURL[] = 24 const char kCWSIntentServiceURL[] =
24 "https://www-googleapis-staging.sandbox.google.com" 25 "https://www-googleapis-staging.sandbox.google.com"
25 "/chromewebstore/v1.1b/items/intent"; 26 "/chromewebstore/v1.1b/items/intent";
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const ResultsCallback& cb) { 133 const ResultsCallback& cb) {
133 scoped_ptr<IntentsQuery> query(new IntentsQuery); 134 scoped_ptr<IntentsQuery> query(new IntentsQuery);
134 query->callback_ = cb; 135 query->callback_ = cb;
135 query->url_fetcher_.reset(content::URLFetcher::Create( 136 query->url_fetcher_.reset(content::URLFetcher::Create(
136 0, BuildQueryURL(action,mimetype), content::URLFetcher::GET, this)); 137 0, BuildQueryURL(action,mimetype), content::URLFetcher::GET, this));
137 138
138 if (query->url_fetcher_ == NULL) 139 if (query->url_fetcher_ == NULL)
139 return; 140 return;
140 141
141 query->url_fetcher_->SetRequestContext(request_context_); 142 query->url_fetcher_->SetRequestContext(request_context_);
143 // No user data, as the request will be cookie-less.
144 query->url_fetcher_->SetContentURLRequestUserData(
145 new content::ContentURLRequestUserData());
142 query->url_fetcher_->SetLoadFlags( 146 query->url_fetcher_->SetLoadFlags(
143 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); 147 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
144 148
145 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>( 149 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>(
146 query->url_fetcher_.get()); 150 query->url_fetcher_.get());
147 queries_[handle] = query.release(); 151 queries_[handle] = query.release();
148 queries_[handle]->url_fetcher_->Start(); 152 queries_[handle]->url_fetcher_->Start();
149 } 153 }
150 154
151 // static 155 // static
152 GURL CWSIntentsRegistry::BuildQueryURL(const string16& action, 156 GURL CWSIntentsRegistry::BuildQueryURL(const string16& action,
153 const string16& type) { 157 const string16& type) {
154 GURL request(kCWSIntentServiceURL); 158 GURL request(kCWSIntentServiceURL);
155 request = chrome_browser_net::AppendQueryParameter(request, "intent", 159 request = chrome_browser_net::AppendQueryParameter(request, "intent",
156 UTF16ToUTF8(action)); 160 UTF16ToUTF8(action));
157 return chrome_browser_net::AppendQueryParameter(request, "mime_types", 161 return chrome_browser_net::AppendQueryParameter(request, "mime_types",
158 UTF16ToUTF8(type)); 162 UTF16ToUTF8(type));
159 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698