| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace | 66 } // namespace |
| 67 | 67 |
| 68 InstantService::InstantService(Profile* profile) | 68 InstantService::InstantService(Profile* profile) |
| 69 : profile_(profile), | 69 : profile_(profile), |
| 70 ntp_prerenderer_(profile, this, profile->GetPrefs()), | 70 ntp_prerenderer_(profile, this, profile->GetPrefs()), |
| 71 browser_instant_controller_object_count_(0), | 71 browser_instant_controller_object_count_(0), |
| 72 weak_ptr_factory_(this) { | 72 weak_ptr_factory_(this) { |
| 73 // Stub for unit tests. | 73 // Stub for unit tests. |
| 74 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) | 74 if (!BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| 75 base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) |
| 75 return; | 76 return; |
| 76 | 77 |
| 77 registrar_.Add(this, | 78 registrar_.Add(this, |
| 78 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 79 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 79 content::NotificationService::AllSources()); | 80 content::NotificationService::AllSources()); |
| 80 registrar_.Add(this, | 81 registrar_.Add(this, |
| 81 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 82 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 82 content::NotificationService::AllSources()); | 83 content::NotificationService::AllSources()); |
| 83 | 84 |
| 84 history::TopSites* top_sites = profile_->GetTopSites(); | 85 history::TopSites* top_sites = profile_->GetTopSites(); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // could cause that, neither of which we support. | 466 // could cause that, neither of which we support. |
| 466 return; | 467 return; |
| 467 } | 468 } |
| 468 FOR_EACH_OBSERVER( | 469 FOR_EACH_OBSERVER( |
| 469 InstantServiceObserver, observers_, DefaultSearchProviderChanged()); | 470 InstantServiceObserver, observers_, DefaultSearchProviderChanged()); |
| 470 } | 471 } |
| 471 | 472 |
| 472 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { | 473 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { |
| 473 return &ntp_prerenderer_; | 474 return &ntp_prerenderer_; |
| 474 } | 475 } |
| OLD | NEW |