| 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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 bool TemplateURLService::ApplyDefaultSearchChangeNoMetrics( | 1910 bool TemplateURLService::ApplyDefaultSearchChangeNoMetrics( |
| 1911 const TemplateURLData* data, | 1911 const TemplateURLData* data, |
| 1912 DefaultSearchManager::Source source) { | 1912 DefaultSearchManager::Source source) { |
| 1913 if (!loaded_) { | 1913 if (!loaded_) { |
| 1914 // Set |initial_default_search_provider_| from the preferences. This is | 1914 // Set |initial_default_search_provider_| from the preferences. This is |
| 1915 // mainly so we can hold ownership until we get to the point where the list | 1915 // mainly so we can hold ownership until we get to the point where the list |
| 1916 // of keywords from Web Data is the owner of everything including the | 1916 // of keywords from Web Data is the owner of everything including the |
| 1917 // default. | 1917 // default. |
| 1918 bool changed = TemplateURL::MatchesData( | 1918 bool changed = !TemplateURL::MatchesData( |
| 1919 initial_default_search_provider_.get(), data, search_terms_data()); | 1919 initial_default_search_provider_.get(), data, search_terms_data()); |
| 1920 TemplateURL::Type initial_engine_type = | 1920 TemplateURL::Type initial_engine_type = |
| 1921 (source == DefaultSearchManager::FROM_EXTENSION) | 1921 (source == DefaultSearchManager::FROM_EXTENSION) |
| 1922 ? TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION | 1922 ? TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION |
| 1923 : TemplateURL::NORMAL; | 1923 : TemplateURL::NORMAL; |
| 1924 initial_default_search_provider_ = | 1924 initial_default_search_provider_ = |
| 1925 data ? base::MakeUnique<TemplateURL>(*data, initial_engine_type) | 1925 data ? base::MakeUnique<TemplateURL>(*data, initial_engine_type) |
| 1926 : nullptr; | 1926 : nullptr; |
| 1927 default_search_provider_source_ = source; | 1927 default_search_provider_source_ = source; |
| 1928 return changed; | 1928 return changed; |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 if (!IsCreatedByExtension(template_url.get())) { | 2480 if (!IsCreatedByExtension(template_url.get())) { |
| 2481 if (keyword_to_template_url.find(template_url->keyword()) != | 2481 if (keyword_to_template_url.find(template_url->keyword()) != |
| 2482 keyword_to_template_url.end()) { | 2482 keyword_to_template_url.end()) { |
| 2483 return true; | 2483 return true; |
| 2484 } | 2484 } |
| 2485 keyword_to_template_url[template_url->keyword()] = template_url.get(); | 2485 keyword_to_template_url[template_url->keyword()] = template_url.get(); |
| 2486 } | 2486 } |
| 2487 } | 2487 } |
| 2488 return false; | 2488 return false; |
| 2489 } | 2489 } |
| OLD | NEW |