OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_engines/template_url_service.h" | 5 #include "components/search_engines/template_url_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 if (client_) | 799 if (client_) |
800 client_->Shutdown(); | 800 client_->Shutdown(); |
801 // This check has to be done at Shutdown() instead of in the dtor to ensure | 801 // This check has to be done at Shutdown() instead of in the dtor to ensure |
802 // that no clients of KeywordWebDataService are holding ptrs to it after the | 802 // that no clients of KeywordWebDataService are holding ptrs to it after the |
803 // first phase of the KeyedService Shutdown() process. | 803 // first phase of the KeyedService Shutdown() process. |
804 if (load_handle_) { | 804 if (load_handle_) { |
805 DCHECK(web_data_service_.get()); | 805 DCHECK(web_data_service_.get()); |
806 web_data_service_->CancelRequest(load_handle_); | 806 web_data_service_->CancelRequest(load_handle_); |
807 } | 807 } |
808 web_data_service_ = NULL; | 808 web_data_service_ = NULL; |
| 809 |
| 810 // Notify observers so they can unregister themselves. |
| 811 // TODO(bauerb): Observers shouldn't outlive this class; see |
| 812 // https://crbug.com/483528. |
| 813 on_loaded_callbacks_.Notify(); |
809 } | 814 } |
810 | 815 |
811 syncer::SyncDataList TemplateURLService::GetAllSyncData( | 816 syncer::SyncDataList TemplateURLService::GetAllSyncData( |
812 syncer::ModelType type) const { | 817 syncer::ModelType type) const { |
813 DCHECK_EQ(syncer::SEARCH_ENGINES, type); | 818 DCHECK_EQ(syncer::SEARCH_ENGINES, type); |
814 | 819 |
815 syncer::SyncDataList current_data; | 820 syncer::SyncDataList current_data; |
816 for (TemplateURLVector::const_iterator iter = template_urls_.begin(); | 821 for (TemplateURLVector::const_iterator iter = template_urls_.begin(); |
817 iter != template_urls_.end(); ++iter) { | 822 iter != template_urls_.end(); ++iter) { |
818 // We don't sync keywords managed by policy. | 823 // We don't sync keywords managed by policy. |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 | 2288 |
2284 if (most_recently_intalled_default) { | 2289 if (most_recently_intalled_default) { |
2285 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2290 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
2286 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2291 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
2287 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2292 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
2288 most_recently_intalled_default->data()); | 2293 most_recently_intalled_default->data()); |
2289 } else { | 2294 } else { |
2290 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2295 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
2291 } | 2296 } |
2292 } | 2297 } |
OLD | NEW |