Chromium Code Reviews| Index: chrome/browser/net/chrome_sdch_policy.cc |
| diff --git a/chrome/browser/net/chrome_sdch_policy.cc b/chrome/browser/net/chrome_sdch_policy.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..16fdb201893b85a3d7f8d6597bfd9c1c893ffdd8 |
| --- /dev/null |
| +++ b/chrome/browser/net/chrome_sdch_policy.cc |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/net/chrome_sdch_policy.h" |
| + |
| +#include "base/bind.h" |
| +#include "net/base/sdch_manager.h" |
| + |
| +ChromeSdchPolicy::ChromeSdchPolicy(net::SdchManager* sdch_manager, |
|
mmenke
2014/11/06 15:30:11
Why isn't this class in net/?
Randy Smith (Not in Mondays)
2014/11/06 16:39:03
This CL is restructuring things so that I have a p
mmenke
2014/11/06 16:44:59
My main concern is just whether we really want to
|
| + net::URLRequestContext* context) |
| + : manager_(sdch_manager), |
| + // Because |fetcher_| is owned by ChromeSdchPolicy, the |
| + // ChromeSdchPolicy object will be available for the lifetime |
| + // of |fetcher_|. |
| + fetcher_(context, |
| + base::Bind(&ChromeSdchPolicy::OnDictionaryFetched, |
| + base::Unretained(this))) { |
| + manager_->AddObserver(this); |
| +} |
| + |
| +ChromeSdchPolicy::~ChromeSdchPolicy() { |
| + manager_->RemoveObserver(this); |
| +} |
| + |
| +void ChromeSdchPolicy::OnDictionaryFetched(const std::string& dictionary_text, |
| + const GURL& dictionary_url) { |
| + manager_->AddSdchDictionary(dictionary_text, dictionary_url); |
| +} |
| + |
| +void ChromeSdchPolicy::OnGetDictionary(net::SdchManager* manager, |
| + const GURL& request_url, |
| + const GURL& dictionary_url) { |
| + fetcher_.Schedule(dictionary_url); |
| +} |
| + |
| +void ChromeSdchPolicy::OnClearDictionaries(net::SdchManager* manager) { |
| + fetcher_.Cancel(); |
| +} |