OLD | NEW |
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 Loading... |
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 |
OLD | NEW |