OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/net/chrome_sdch_policy.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "net/base/sdch_manager.h" | |
9 | |
10 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
| |
11 net::URLRequestContext* context) | |
12 : manager_(sdch_manager), | |
13 // Because |fetcher_| is owned by ChromeSdchPolicy, the | |
14 // ChromeSdchPolicy object will be available for the lifetime | |
15 // of |fetcher_|. | |
16 fetcher_(context, | |
17 base::Bind(&ChromeSdchPolicy::OnDictionaryFetched, | |
18 base::Unretained(this))) { | |
19 manager_->AddObserver(this); | |
20 } | |
21 | |
22 ChromeSdchPolicy::~ChromeSdchPolicy() { | |
23 manager_->RemoveObserver(this); | |
24 } | |
25 | |
26 void ChromeSdchPolicy::OnDictionaryFetched(const std::string& dictionary_text, | |
27 const GURL& dictionary_url) { | |
28 manager_->AddSdchDictionary(dictionary_text, dictionary_url); | |
29 } | |
30 | |
31 void ChromeSdchPolicy::OnGetDictionary(net::SdchManager* manager, | |
32 const GURL& request_url, | |
33 const GURL& dictionary_url) { | |
34 fetcher_.Schedule(dictionary_url); | |
35 } | |
36 | |
37 void ChromeSdchPolicy::OnClearDictionaries(net::SdchManager* manager) { | |
38 fetcher_.Cancel(); | |
39 } | |
OLD | NEW |