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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 for (TemplateURLVector::const_iterator i = first_invalid; i != urls->end(); | 1618 for (TemplateURLVector::const_iterator i = first_invalid; i != urls->end(); |
1619 ++i) | 1619 ++i) |
1620 AddNoNotify(*i, true); | 1620 AddNoNotify(*i, true); |
1621 | 1621 |
1622 // Clear the input vector to reduce the chance callers will try to use a | 1622 // Clear the input vector to reduce the chance callers will try to use a |
1623 // (possibly deleted) entry. | 1623 // (possibly deleted) entry. |
1624 urls->clear(); | 1624 urls->clear(); |
1625 } | 1625 } |
1626 | 1626 |
1627 void TemplateURLService::ChangeToLoadedState() { | 1627 void TemplateURLService::ChangeToLoadedState() { |
| 1628 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 1629 tracked_objects::ScopedTracker tracking_profile1( |
| 1630 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1631 "422460 TemplateURLService::ChangeToLoadedState 1")); |
| 1632 |
1628 DCHECK(!loaded_); | 1633 DCHECK(!loaded_); |
1629 | 1634 |
1630 provider_map_->Init(template_urls_, search_terms_data()); | 1635 provider_map_->Init(template_urls_, search_terms_data()); |
1631 loaded_ = true; | 1636 loaded_ = true; |
1632 | 1637 |
| 1638 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 1639 tracked_objects::ScopedTracker tracking_profile2( |
| 1640 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1641 "422460 TemplateURLService::ChangeToLoadedState 2")); |
| 1642 |
1633 // This will cause a call to NotifyObservers(). | 1643 // This will cause a call to NotifyObservers(). |
1634 ApplyDefaultSearchChangeNoMetrics( | 1644 ApplyDefaultSearchChangeNoMetrics( |
1635 initial_default_search_provider_ ? | 1645 initial_default_search_provider_ ? |
1636 &initial_default_search_provider_->data() : NULL, | 1646 &initial_default_search_provider_->data() : NULL, |
1637 default_search_provider_source_); | 1647 default_search_provider_source_); |
1638 initial_default_search_provider_.reset(); | 1648 initial_default_search_provider_.reset(); |
| 1649 |
| 1650 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 1651 tracked_objects::ScopedTracker tracking_profile3( |
| 1652 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1653 "422460 TemplateURLService::ChangeToLoadedState 3")); |
| 1654 |
1639 on_loaded_callbacks_.Notify(); | 1655 on_loaded_callbacks_.Notify(); |
1640 } | 1656 } |
1641 | 1657 |
1642 bool TemplateURLService::CanReplaceKeywordForHost( | 1658 bool TemplateURLService::CanReplaceKeywordForHost( |
1643 const std::string& host, | 1659 const std::string& host, |
1644 TemplateURL** to_replace) { | 1660 TemplateURL** to_replace) { |
1645 DCHECK(!to_replace || !*to_replace); | 1661 DCHECK(!to_replace || !*to_replace); |
1646 const TemplateURLSet* urls = provider_map_->GetURLsForHost(host); | 1662 const TemplateURLSet* urls = provider_map_->GetURLsForHost(host); |
1647 if (!urls) | 1663 if (!urls) |
1648 return true; | 1664 return true; |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2423 | 2439 |
2424 if (most_recently_intalled_default) { | 2440 if (most_recently_intalled_default) { |
2425 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2441 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
2426 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2442 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
2427 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2443 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
2428 most_recently_intalled_default->data()); | 2444 most_recently_intalled_default->data()); |
2429 } else { | 2445 } else { |
2430 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2446 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
2431 } | 2447 } |
2432 } | 2448 } |
OLD | NEW |