| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/instant_service.h" | 5 #include "chrome/browser/search/instant_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 InstantService::InstantService(Profile* profile) | 67 InstantService::InstantService(Profile* profile) |
| 68 : profile_(profile), | 68 : profile_(profile), |
| 69 ntp_prerenderer_(profile, this, profile->GetPrefs()), | 69 ntp_prerenderer_(profile, this, profile->GetPrefs()), |
| 70 browser_instant_controller_object_count_(0), | 70 browser_instant_controller_object_count_(0), |
| 71 weak_ptr_factory_(this) { | 71 weak_ptr_factory_(this) { |
| 72 // Stub for unit tests. | 72 // Stub for unit tests. |
| 73 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) | 73 if (!BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| 74 base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) |
| 74 return; | 75 return; |
| 75 | 76 |
| 76 registrar_.Add(this, | 77 registrar_.Add(this, |
| 77 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 78 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 78 content::NotificationService::AllSources()); | 79 content::NotificationService::AllSources()); |
| 79 registrar_.Add(this, | 80 registrar_.Add(this, |
| 80 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 81 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 81 content::NotificationService::AllSources()); | 82 content::NotificationService::AllSources()); |
| 82 | 83 |
| 83 history::TopSites* top_sites = profile_->GetTopSites(); | 84 history::TopSites* top_sites = profile_->GetTopSites(); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 // could cause that, neither of which we support. | 465 // could cause that, neither of which we support. |
| 465 return; | 466 return; |
| 466 } | 467 } |
| 467 FOR_EACH_OBSERVER( | 468 FOR_EACH_OBSERVER( |
| 468 InstantServiceObserver, observers_, DefaultSearchProviderChanged()); | 469 InstantServiceObserver, observers_, DefaultSearchProviderChanged()); |
| 469 } | 470 } |
| 470 | 471 |
| 471 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { | 472 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { |
| 472 return &ntp_prerenderer_; | 473 return &ntp_prerenderer_; |
| 473 } | 474 } |
| OLD | NEW |