| 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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 } | 2108 } |
| 2109 data.safe_for_autoreplace = false; | 2109 data.safe_for_autoreplace = false; |
| 2110 data.last_modified = clock_->Now(); | 2110 data.last_modified = clock_->Now(); |
| 2111 return UpdateNoNotify(url, TemplateURL(data)); | 2111 return UpdateNoNotify(url, TemplateURL(data)); |
| 2112 } | 2112 } |
| 2113 | 2113 |
| 2114 void TemplateURLService::NotifyObservers() { | 2114 void TemplateURLService::NotifyObservers() { |
| 2115 if (!loaded_) | 2115 if (!loaded_) |
| 2116 return; | 2116 return; |
| 2117 | 2117 |
| 2118 FOR_EACH_OBSERVER(TemplateURLServiceObserver, model_observers_, | 2118 for (auto& observer : model_observers_) |
| 2119 OnTemplateURLServiceChanged()); | 2119 observer.OnTemplateURLServiceChanged(); |
| 2120 } | 2120 } |
| 2121 | 2121 |
| 2122 // |template_urls| are the TemplateURLs loaded from the database. | 2122 // |template_urls| are the TemplateURLs loaded from the database. |
| 2123 // |default_from_prefs| is the default search provider from the preferences, or | 2123 // |default_from_prefs| is the default search provider from the preferences, or |
| 2124 // NULL if the DSE is not policy-defined. | 2124 // NULL if the DSE is not policy-defined. |
| 2125 // | 2125 // |
| 2126 // This function removes from the vector and the database all the TemplateURLs | 2126 // This function removes from the vector and the database all the TemplateURLs |
| 2127 // that were set by policy, unless it is the current default search provider, in | 2127 // that were set by policy, unless it is the current default search provider, in |
| 2128 // which case it is updated with the data from prefs. | 2128 // which case it is updated with the data from prefs. |
| 2129 void TemplateURLService::UpdateProvidersCreatedByPolicy( | 2129 void TemplateURLService::UpdateProvidersCreatedByPolicy( |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 | 2474 |
| 2475 if (most_recently_intalled_default) { | 2475 if (most_recently_intalled_default) { |
| 2476 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2476 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
| 2477 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2477 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
| 2478 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2478 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
| 2479 most_recently_intalled_default->data()); | 2479 most_recently_intalled_default->data()); |
| 2480 } else { | 2480 } else { |
| 2481 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2481 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
| 2482 } | 2482 } |
| 2483 } | 2483 } |
| OLD | NEW |