diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-24 18:18:34 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-24 18:18:34 +0000 |
commit | c530c85aa67a10aac9a77d10970951633ff686d9 (patch) | |
tree | 5b0943bd7369f48053075a75db9cf6e5a0d1514d /chrome/browser/spellchecker | |
parent | b4c95f61571c24ea1fc15fed0eda1269fe75d94b (diff) | |
download | chromium_src-c530c85aa67a10aac9a77d10970951633ff686d9.zip chromium_src-c530c85aa67a10aac9a77d10970951633ff686d9.tar.gz chromium_src-c530c85aa67a10aac9a77d10970951633ff686d9.tar.bz2 |
Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old URLFetcher delegate callback while I'm touching all of them.BUG=98716,83592
Review URL: http://codereview.chromium.org/8373021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker')
-rw-r--r-- | chrome/browser/spellchecker/spellcheck_host_impl.cc | 14 | ||||
-rw-r--r-- | chrome/browser/spellchecker/spellcheck_host_impl.h | 15 |
2 files changed, 11 insertions, 18 deletions
diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.cc b/chrome/browser/spellchecker/spellcheck_host_impl.cc index 946e5ab..c8446c8 100644 --- a/chrome/browser/spellchecker/spellcheck_host_impl.cc +++ b/chrome/browser/spellchecker/spellcheck_host_impl.cc @@ -23,6 +23,7 @@ #include "chrome/common/spellcheck_common.h" #include "chrome/common/spellcheck_messages.h" #include "content/browser/renderer_host/render_process_host.h" +#include "content/common/net/url_fetcher.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "googleurl/src/gurl.h" @@ -320,17 +321,12 @@ void SpellCheckHostImpl::WriteWordToCustomDictionary(const std::string& word) { file_util::CloseFile(f); } -void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source, - const GURL& url, - const net::URLRequestStatus& status, - int response_code, - const net::ResponseCookies& cookies, - const std::string& data) { +void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source) { DCHECK(source); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - fetcher_.reset(); + scoped_ptr<URLFetcher> fetcher_destructor(fetcher_.release()); - if ((response_code / 100) != 2) { + if ((source->response_code() / 100) != 2) { // Initialize will not try to download the file a second time. LOG(ERROR) << "Failure to download dictionary."; InitializeOnFileThread(); @@ -340,6 +336,8 @@ void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source, // Basic sanity check on the dictionary. // There's the small chance that we might see a 200 status code for a body // that represents some form of failure. + std::string data; + source->GetResponseAsString(&data); if (data.size() < 4 || data[0] != 'B' || data[1] != 'D' || data[2] != 'i' || data[3] != 'c') { LOG(ERROR) << "Failure to download dictionary."; diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.h b/chrome/browser/spellchecker/spellcheck_host_impl.h index 30c217c..e0b5243 100644 --- a/chrome/browser/spellchecker/spellcheck_host_impl.h +++ b/chrome/browser/spellchecker/spellcheck_host_impl.h @@ -13,7 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/spellchecker/spellcheck_host.h" #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher_delegate.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -38,7 +38,7 @@ // Available languages for the checker, which we need to specify via Create(), // can be listed using SpellCheckHost::GetAvailableLanguages() static method. class SpellCheckHostImpl : public SpellCheckHost, - public URLFetcher::Delegate, + public content::URLFetcherDelegate, public content::NotificationObserver { public: SpellCheckHostImpl(SpellCheckProfileProvider* profile, @@ -102,14 +102,9 @@ class SpellCheckHostImpl : public SpellCheckHost, // Returns true if the dictionary is ready to use. virtual bool IsReady() const; - // URLFetcher::Delegate implementation. Called when we finish downloading the - // spellcheck dictionary; saves the dictionary to |data_|. - virtual void OnURLFetchComplete(const URLFetcher* source, - const GURL& url, - const net::URLRequestStatus& status, - int response_code, - const net::ResponseCookies& cookies, - const std::string& data); + // content::URLFetcherDelegate implementation. Called when we finish + // downloading the spellcheck dictionary; saves the dictionary to |data_|. + virtual void OnURLFetchComplete(const URLFetcher* source); // NotificationProfile implementation. virtual void Observe(int type, |