Chromium Code Reviews| 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, | |
| 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_|. | |
|
Ryan Sleevi
2014/11/04 21:40:44
1) I'm not sure what this comment is communicating
Randy Smith (Not in Mondays)
2014/11/05 20:35:01
Ok, just being over-paranoid about documenting own
| |
| 16 fetcher_(context, base::Bind(&ChromeSdchPolicy::OnDictionaryFetched, | |
| 17 base::Unretained(this))) { | |
| 18 manager_->AddObserver(this); | |
| 19 } | |
| 20 | |
| 21 ChromeSdchPolicy::~ChromeSdchPolicy() { | |
| 22 manager_->RemoveObserver(this); | |
| 23 } | |
| 24 | |
| 25 void ChromeSdchPolicy::OnDictionaryFetched(const std::string& dictionary_text, | |
| 26 const GURL& dictionary_url) { | |
| 27 manager_->AddSdchDictionary(dictionary_text, dictionary_url); | |
| 28 } | |
| 29 | |
| 30 void ChromeSdchPolicy::OnGetDictionary(net::SdchManager* manager, | |
| 31 const GURL& request_url, | |
| 32 const GURL& dictionary_url) { | |
| 33 fetcher_.Schedule(dictionary_url); | |
| 34 } | |
| 35 | |
| 36 void ChromeSdchPolicy::OnClearDictionaries(net::SdchManager* manager) { | |
| 37 fetcher_.Cancel(); | |
| 38 } | |
| OLD | NEW |