OLD | NEW |
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/net/predictor_api.h" | 5 #include "chrome/browser/net/predictor_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // This object lives on the UI thread. | 301 // This object lives on the UI thread. |
302 | 302 |
303 class OffTheRecordObserver : public NotificationObserver { | 303 class OffTheRecordObserver : public NotificationObserver { |
304 public: | 304 public: |
305 void Register() { | 305 void Register() { |
306 // TODO(pkasting): This test should not be necessary. See crbug.com/12475. | 306 // TODO(pkasting): This test should not be necessary. See crbug.com/12475. |
307 if (registrar_.IsEmpty()) { | 307 if (registrar_.IsEmpty()) { |
308 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, | 308 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, |
309 NotificationService::AllSources()); | 309 NotificationService::AllSources()); |
310 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, | 310 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, |
311 NotificationService::AllSources()); | 311 NotificationService::AllBrowserContextsAndSources()); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 void Observe(int type, const NotificationSource& source, | 315 void Observe(int type, const NotificationSource& source, |
316 const NotificationDetails& details) { | 316 const NotificationDetails& details) { |
317 switch (type) { | 317 switch (type) { |
318 case chrome::NOTIFICATION_BROWSER_OPENED: | 318 case chrome::NOTIFICATION_BROWSER_OPENED: |
319 if (!Source<Browser>(source)->profile()->IsOffTheRecord()) | 319 if (!Source<Browser>(source)->profile()->IsOffTheRecord()) |
320 break; | 320 break; |
321 ++count_off_the_record_windows_; | 321 ++count_off_the_record_windows_; |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 DCHECK(!g_predictor); | 641 DCHECK(!g_predictor); |
642 InitNetworkPredictor(max_queueing_delay, max_parallel_resolves, user_prefs, | 642 InitNetworkPredictor(max_queueing_delay, max_parallel_resolves, user_prefs, |
643 local_state, preconnect_enabled); | 643 local_state, preconnect_enabled); |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 PredictorInit::~PredictorInit() { | 647 PredictorInit::~PredictorInit() { |
648 } | 648 } |
649 | 649 |
650 } // namespace chrome_browser_net | 650 } // namespace chrome_browser_net |
OLD | NEW |