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

Side by Side Diff: chrome/browser/net/chrome_sdch_policy.cc

Issue 664263002: Restructure SDCH layering to allow more separation (observer/1->[0,n] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync'd to 303035. Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/net/chrome_sdch_policy.h ('k') | chrome/browser/net/sdch_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_|.
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 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_sdch_policy.h ('k') | chrome/browser/net/sdch_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698