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

Side by Side Diff: chrome/browser/chromeos/proxy_config_service.cc

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/proxy_config_service.h" 5 #include "chrome/browser/chromeos/proxy_config_service.h"
6 6
7 #include "chrome/browser/net/pref_proxy_config_service.h"
8
7 namespace chromeos { 9 namespace chromeos {
8 10
9 ProxyConfigService::ProxyConfigService( 11 ProxyConfigService::ProxyConfigService(
10 const scoped_refptr<ProxyConfigServiceImpl>& impl) 12 const scoped_refptr<ProxyConfigServiceImpl>& impl,
11 : impl_(impl) { 13 PrefProxyConfigTracker* pref_config_tracker)
14 : impl_(impl),
15 pref_config_tracker_(pref_config_tracker) {
12 } 16 }
13 17
14 ProxyConfigService::~ProxyConfigService() {} 18 ProxyConfigService::~ProxyConfigService() {
15 19 if (registered_tracker_)
16 void ProxyConfigService::AddObserver(Observer* observer) { 20 pref_config_tracker_->RemoveObserver(this);
17 impl_->AddObserver(observer);
18 } 21 }
19 22
20 void ProxyConfigService::RemoveObserver(Observer* observer) { 23 void ProxyConfigService::AddObserver(
24 net::ProxyConfigService::Observer* observer) {
25 impl_->AddObserver(observer);
26 RegisterTracker();
27 }
28
29 void ProxyConfigService::RemoveObserver(
30 net::ProxyConfigService::Observer* observer) {
21 impl_->RemoveObserver(observer); 31 impl_->RemoveObserver(observer);
22 } 32 }
23 33
24 ProxyConfigService::ConfigAvailability ProxyConfigService::GetLatestProxyConfig( 34 ProxyConfigService::ConfigAvailability ProxyConfigService::GetLatestProxyConfig(
25 net::ProxyConfig* config) { 35 net::ProxyConfig* config) {
36 RegisterTracker();
26 return impl_->IOGetProxyConfig(config); 37 return impl_->IOGetProxyConfig(config);
27 } 38 }
28 39
40 void ProxyConfigService::OnPrefProxyConfigChanged() {
41 impl_->OnPrefProxyConfigChanged(pref_config_tracker_);
42 }
43
44 void ProxyConfigService::RegisterTracker() {
45 if (!registered_tracker_) {
46 pref_config_tracker_->AddObserver(this);
47 registered_tracker_ = true;
48 }
49 }
50
29 } // namespace chromeos 51 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698