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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/net/http_server_properties_manager.h" 4 #include "chrome/browser/net/http_server_properties_manager.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 629 }
630 630
631 http_server_properties_dict.SetWithoutPathExpansion("servers", servers_dict); 631 http_server_properties_dict.SetWithoutPathExpansion("servers", servers_dict);
632 http_server_properties_dict.SetInteger("version", kVersionNumber); 632 http_server_properties_dict.SetInteger("version", kVersionNumber);
633 setting_prefs_ = true; 633 setting_prefs_ = true;
634 pref_service_->Set(prefs::kHttpServerProperties, 634 pref_service_->Set(prefs::kHttpServerProperties,
635 http_server_properties_dict); 635 http_server_properties_dict);
636 setting_prefs_ = false; 636 setting_prefs_ = false;
637 } 637 }
638 638
639 void HttpServerPropertiesManager::Observe( 639 void HttpServerPropertiesManager::OnPreferenceChanged(
640 int type, 640 PrefServiceBase* prefs,
641 const content::NotificationSource& source, 641 const std::string& pref_name) {
642 const content::NotificationDetails& details) {
643 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 642 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
644 DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED);
645 PrefService* prefs = content::Source<PrefService>(source).ptr();
646 DCHECK(prefs == pref_service_); 643 DCHECK(prefs == pref_service_);
647 std::string* pref_name = content::Details<std::string>(details).ptr(); 644 if (pref_name == prefs::kHttpServerProperties) {
648 if (*pref_name == prefs::kHttpServerProperties) {
649 if (!setting_prefs_) 645 if (!setting_prefs_)
650 ScheduleUpdateCacheOnUI(); 646 ScheduleUpdateCacheOnUI();
651 } else { 647 } else {
652 NOTREACHED(); 648 NOTREACHED();
653 } 649 }
654 } 650 }
655 651
656 } // namespace chrome_browser_net 652 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/http_server_properties_manager.h ('k') | chrome/browser/net/net_pref_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698