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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 if (!urls) | 1635 if (!urls) |
1636 return true; | 1636 return true; |
1637 for (TemplateURLSet::const_iterator i(urls->begin()); i != urls->end(); ++i) { | 1637 for (TemplateURLSet::const_iterator i(urls->begin()); i != urls->end(); ++i) { |
1638 if (!(*i)->safe_for_autoreplace()) | 1638 if (!(*i)->safe_for_autoreplace()) |
1639 return false; | 1639 return false; |
1640 } | 1640 } |
1641 return true; | 1641 return true; |
1642 } | 1642 } |
1643 | 1643 |
1644 bool TemplateURLService::CanReplace(const TemplateURL* t_url) { | 1644 bool TemplateURLService::CanReplace(const TemplateURL* t_url) { |
1645 return (t_url != default_search_provider_ && !t_url->show_in_default_list() && | 1645 return (t_url != default_search_provider_ && t_url->prepopulate_id() <= 0 && |
1646 t_url->safe_for_autoreplace()); | 1646 !t_url->created_by_policy() && t_url->safe_for_autoreplace()); |
1647 } | 1647 } |
1648 | 1648 |
1649 TemplateURL* TemplateURLService::FindNonExtensionTemplateURLForKeyword( | 1649 TemplateURL* TemplateURLService::FindNonExtensionTemplateURLForKeyword( |
1650 const base::string16& keyword) { | 1650 const base::string16& keyword) { |
1651 TemplateURL* keyword_turl = GetTemplateURLForKeyword(keyword); | 1651 TemplateURL* keyword_turl = GetTemplateURLForKeyword(keyword); |
1652 if (!keyword_turl || (keyword_turl->type() == TemplateURL::NORMAL)) | 1652 if (!keyword_turl || (keyword_turl->type() == TemplateURL::NORMAL)) |
1653 return keyword_turl; | 1653 return keyword_turl; |
1654 // The extension keyword in the model may be hiding a replaceable | 1654 // The extension keyword in the model may be hiding a replaceable |
1655 // non-extension keyword. Look for it. | 1655 // non-extension keyword. Look for it. |
1656 for (const auto& turl : template_urls_) { | 1656 for (const auto& turl : template_urls_) { |
(...skipping 817 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 |