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

Side by Side Diff: chrome/browser/spellchecker/spelling_service_client.cc

Issue 9545005: Disable storing cookies from URLFetchers that run with a profile's cookie jar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/spellchecker/spelling_service_client.h" 5 #include "chrome/browser/spellchecker/spelling_service_client.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/string_escape.h" 8 #include "base/json/string_escape.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "chrome/common/spellcheck_result.h" 16 #include "chrome/common/spellcheck_result.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/common/url_fetcher.h" 18 #include "content/public/common/url_fetcher.h"
19 #include "net/base/load_flags.h"
19 #include "unicode/uloc.h" 20 #include "unicode/uloc.h"
20 21
21 #if defined(GOOGLE_CHROME_BUILD) 22 #if defined(GOOGLE_CHROME_BUILD)
22 #include "chrome/browser/spellchecker/internal/spellcheck_internal.h" 23 #include "chrome/browser/spellchecker/internal/spellcheck_internal.h"
23 #endif 24 #endif
24 25
25 // Use the public URL to the Spelling service on Chromium. Unfortunately, this 26 // Use the public URL to the Spelling service on Chromium. Unfortunately, this
26 // service is an experimental service and returns an error without a key. 27 // service is an experimental service and returns an error without a key.
27 #ifndef SPELLING_SERVICE_KEY 28 #ifndef SPELLING_SERVICE_KEY
28 #define SPELLING_SERVICE_KEY 29 #define SPELLING_SERVICE_KEY
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 std::string request = base::StringPrintf(kSpellingRequest, 87 std::string request = base::StringPrintf(kSpellingRequest,
87 encoded_text.c_str(), 88 encoded_text.c_str(),
88 language, country); 89 language, country);
89 90
90 static const char kSpellingServiceURL[] = SPELLING_SERVICE_URL; 91 static const char kSpellingServiceURL[] = SPELLING_SERVICE_URL;
91 GURL url = GURL(kSpellingServiceURL); 92 GURL url = GURL(kSpellingServiceURL);
92 fetcher_.reset(content::URLFetcher::Create( 93 fetcher_.reset(content::URLFetcher::Create(
93 url, content::URLFetcher::POST, this)); 94 url, content::URLFetcher::POST, this));
94 fetcher_->SetRequestContext(context); 95 fetcher_->SetRequestContext(context);
95 fetcher_->SetUploadData("application/json", request); 96 fetcher_->SetUploadData("application/json", request);
97 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
96 fetcher_->Start(); 98 fetcher_->Start();
97 tag_ = tag; 99 tag_ = tag;
98 callback_ = callback; 100 callback_ = callback;
99 return true; 101 return true;
100 } 102 }
101 103
102 void SpellingServiceClient::OnURLFetchComplete( 104 void SpellingServiceClient::OnURLFetchComplete(
103 const content::URLFetcher* source) { 105 const content::URLFetcher* source) {
104 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 106 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
105 scoped_ptr<content::URLFetcher> clean_up_fetcher(fetcher_.release()); 107 scoped_ptr<content::URLFetcher> clean_up_fetcher(fetcher_.release());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!suggestions->GetDictionary(0, &suggestion) || 183 if (!suggestions->GetDictionary(0, &suggestion) ||
182 !suggestion->GetString("suggestion", &replacement)) { 184 !suggestion->GetString("suggestion", &replacement)) {
183 return false; 185 return false;
184 } 186 }
185 SpellCheckResult result( 187 SpellCheckResult result(
186 SpellCheckResult::SPELLING, start, length, replacement); 188 SpellCheckResult::SPELLING, start, length, replacement);
187 results->push_back(result); 189 results->push_back(result);
188 } 190 }
189 return true; 191 return true;
190 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698