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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/prefs/pref_registry_syncable.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 | 20 |
20 namespace chrome_browser_net { | 21 namespace chrome_browser_net { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void HttpServerPropertiesManager::ShutdownOnUIThread() { | 84 void HttpServerPropertiesManager::ShutdownOnUIThread() { |
84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
85 // Cancel any pending updates, and stop listening for pref change updates. | 86 // Cancel any pending updates, and stop listening for pref change updates. |
86 ui_cache_update_timer_->Stop(); | 87 ui_cache_update_timer_->Stop(); |
87 ui_weak_ptr_factory_.reset(); | 88 ui_weak_ptr_factory_.reset(); |
88 pref_change_registrar_.RemoveAll(); | 89 pref_change_registrar_.RemoveAll(); |
89 } | 90 } |
90 | 91 |
91 // static | 92 // static |
92 void HttpServerPropertiesManager::RegisterUserPrefs( | 93 void HttpServerPropertiesManager::RegisterUserPrefs( |
93 PrefServiceSyncable* prefs) { | 94 PrefRegistrySyncable* prefs) { |
94 prefs->RegisterDictionaryPref(prefs::kHttpServerProperties, | 95 prefs->RegisterDictionaryPref(prefs::kHttpServerProperties, |
95 PrefServiceSyncable::UNSYNCABLE_PREF); | 96 PrefRegistrySyncable::UNSYNCABLE_PREF); |
96 } | 97 } |
97 | 98 |
98 // This is required for conformance with the HttpServerProperties interface. | 99 // This is required for conformance with the HttpServerProperties interface. |
99 void HttpServerPropertiesManager::Clear() { | 100 void HttpServerPropertiesManager::Clear() { |
100 Clear(base::Closure()); | 101 Clear(base::Closure()); |
101 } | 102 } |
102 | 103 |
103 void HttpServerPropertiesManager::Clear(const base::Closure& completion) { | 104 void HttpServerPropertiesManager::Clear(const base::Closure& completion) { |
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
105 | 106 |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 completion.Run(); | 661 completion.Run(); |
661 } | 662 } |
662 | 663 |
663 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 664 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
664 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 665 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
665 if (!setting_prefs_) | 666 if (!setting_prefs_) |
666 ScheduleUpdateCacheOnUI(); | 667 ScheduleUpdateCacheOnUI(); |
667 } | 668 } |
668 | 669 |
669 } // namespace chrome_browser_net | 670 } // namespace chrome_browser_net |
OLD | NEW |