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

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

Issue 11414083: Remove PrefObserver usage, batch 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to sort-of good revision (r169014). 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
« no previous file with comments | « no previous file | chrome/browser/net/http_server_properties_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 #ifndef CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_H_ 5 #ifndef CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_H_
6 #define CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_H_ 6 #define CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/prefs/public/pref_change_registrar.h" 14 #include "base/prefs/public/pref_change_registrar.h"
15 #include "base/prefs/public/pref_observer.h"
16 #include "base/timer.h" 15 #include "base/timer.h"
17 #include "base/values.h" 16 #include "base/values.h"
18 #include "net/base/host_port_pair.h" 17 #include "net/base/host_port_pair.h"
19 #include "net/http/http_pipelined_host_capability.h" 18 #include "net/http/http_pipelined_host_capability.h"
20 #include "net/http/http_server_properties.h" 19 #include "net/http/http_server_properties.h"
21 #include "net/http/http_server_properties_impl.h" 20 #include "net/http/http_server_properties_impl.h"
22 21
23 class PrefService; 22 class PrefService;
24 23
25 namespace chrome_browser_net { 24 namespace chrome_browser_net {
(...skipping 14 matching lines...) Expand all
40 // 39 //
41 // ShutdownOnUIThread must be called from UI before destruction, to release 40 // ShutdownOnUIThread must be called from UI before destruction, to release
42 // the prefs listeners on the UI thread. This is done from ProfileIOData. 41 // the prefs listeners on the UI thread. This is done from ProfileIOData.
43 // 42 //
44 // Update tasks from the UI thread can post safely to the IO thread, since the 43 // Update tasks from the UI thread can post safely to the IO thread, since the
45 // destruction order of Profile and ProfileIOData guarantees that if this 44 // destruction order of Profile and ProfileIOData guarantees that if this
46 // exists in UI, then a potential destruction on IO will come after any task 45 // exists in UI, then a potential destruction on IO will come after any task
47 // posted to IO from that method on UI. This is used to go through IO before 46 // posted to IO from that method on UI. This is used to go through IO before
48 // the actual update starts, and grab a WeakPtr. 47 // the actual update starts, and grab a WeakPtr.
49 class HttpServerPropertiesManager 48 class HttpServerPropertiesManager
50 : public net::HttpServerProperties, 49 : public net::HttpServerProperties {
51 public PrefObserver {
52 public: 50 public:
53 // Create an instance of the HttpServerPropertiesManager. The lifetime of the 51 // Create an instance of the HttpServerPropertiesManager. The lifetime of the
54 // PrefService objects must be longer than that of the 52 // PrefService objects must be longer than that of the
55 // HttpServerPropertiesManager object. Must be constructed on the UI thread. 53 // HttpServerPropertiesManager object. Must be constructed on the UI thread.
56 explicit HttpServerPropertiesManager(PrefService* pref_service); 54 explicit HttpServerPropertiesManager(PrefService* pref_service);
57 virtual ~HttpServerPropertiesManager(); 55 virtual ~HttpServerPropertiesManager();
58 56
59 // Initialize |http_server_properties_impl_| and |io_method_factory_| on IO 57 // Initialize |http_server_properties_impl_| and |io_method_factory_| on IO
60 // thread. It also posts a task to UI thread to get SPDY Server preferences 58 // thread. It also posts a task to UI thread to get SPDY Server preferences
61 // from |pref_service_|. 59 // from |pref_service_|.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Update prefs::kHttpServerProperties preferences on UI thread. Executes an 185 // Update prefs::kHttpServerProperties preferences on UI thread. Executes an
188 // optional |completion| callback when finished. Protected for testing. 186 // optional |completion| callback when finished. Protected for testing.
189 void UpdatePrefsOnUI( 187 void UpdatePrefsOnUI(
190 base::ListValue* spdy_server_list, 188 base::ListValue* spdy_server_list,
191 net::SpdySettingsMap* spdy_settings_map, 189 net::SpdySettingsMap* spdy_settings_map,
192 net::AlternateProtocolMap* alternate_protocol_map, 190 net::AlternateProtocolMap* alternate_protocol_map,
193 net::PipelineCapabilityMap* pipeline_capability_map, 191 net::PipelineCapabilityMap* pipeline_capability_map,
194 const base::Closure& completion); 192 const base::Closure& completion);
195 193
196 private: 194 private:
197 // Callback for preference changes. 195 void OnHttpServerPropertiesChanged();
198 virtual void OnPreferenceChanged(PrefServiceBase* service,
199 const std::string& pref_name) OVERRIDE;
200 196
201 // --------- 197 // ---------
202 // UI thread 198 // UI thread
203 // --------- 199 // ---------
204 200
205 // Used to get |weak_ptr_| to self on the UI thread. 201 // Used to get |weak_ptr_| to self on the UI thread.
206 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > 202 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> >
207 ui_weak_ptr_factory_; 203 ui_weak_ptr_factory_;
208 204
209 base::WeakPtr<HttpServerPropertiesManager> ui_weak_ptr_; 205 base::WeakPtr<HttpServerPropertiesManager> ui_weak_ptr_;
(...skipping 16 matching lines...) Expand all
226 io_prefs_update_timer_; 222 io_prefs_update_timer_;
227 223
228 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_impl_; 224 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_impl_;
229 225
230 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); 226 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager);
231 }; 227 };
232 228
233 } // namespace chrome_browser_net 229 } // namespace chrome_browser_net
234 230
235 #endif // CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_H_ 231 #endif // CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/http_server_properties_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698