OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/search_engines/template_url_service.h" | 5 #include "chrome/browser/search_engines/template_url_service.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
11 #include "base/guid.h" | 11 #include "base/guid.h" |
12 #include "base/i18n/case_conversion.h" | 12 #include "base/i18n/case_conversion.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/string_split.h" | 16 #include "base/string_split.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/extensions/extension_system.h" |
21 #include "chrome/browser/google/google_url_tracker.h" | 22 #include "chrome/browser/google/google_url_tracker.h" |
22 #include "chrome/browser/history/history.h" | 23 #include "chrome/browser/history/history.h" |
23 #include "chrome/browser/history/history_notifications.h" | 24 #include "chrome/browser/history/history_notifications.h" |
24 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
25 #include "chrome/browser/net/url_fixer_upper.h" | 26 #include "chrome/browser/net/url_fixer_upper.h" |
26 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/protector/base_setting_change.h" | 29 #include "chrome/browser/protector/base_setting_change.h" |
29 #include "chrome/browser/protector/protector_service.h" | 30 #include "chrome/browser/protector/protector_service.h" |
30 #include "chrome/browser/protector/protector_service_factory.h" | 31 #include "chrome/browser/protector/protector_service_factory.h" |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 | 1616 |
1616 void TemplateURLService::NotifyLoaded() { | 1617 void TemplateURLService::NotifyLoaded() { |
1617 content::NotificationService::current()->Notify( | 1618 content::NotificationService::current()->Notify( |
1618 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, | 1619 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
1619 content::Source<TemplateURLService>(this), | 1620 content::Source<TemplateURLService>(this), |
1620 content::NotificationService::NoDetails()); | 1621 content::NotificationService::NoDetails()); |
1621 | 1622 |
1622 for (PendingExtensionIDs::const_iterator i(pending_extension_ids_.begin()); | 1623 for (PendingExtensionIDs::const_iterator i(pending_extension_ids_.begin()); |
1623 i != pending_extension_ids_.end(); ++i) { | 1624 i != pending_extension_ids_.end(); ++i) { |
1624 const extensions::Extension* extension = | 1625 const extensions::Extension* extension = |
1625 profile_->GetExtensionService()->GetExtensionById(*i, true); | 1626 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 1627 GetExtensionById(*i, true); |
1626 if (extension) | 1628 if (extension) |
1627 RegisterExtensionKeyword(extension); | 1629 RegisterExtensionKeyword(extension); |
1628 } | 1630 } |
1629 pending_extension_ids_.clear(); | 1631 pending_extension_ids_.clear(); |
1630 } | 1632 } |
1631 | 1633 |
1632 void TemplateURLService::SaveDefaultSearchProviderToPrefs( | 1634 void TemplateURLService::SaveDefaultSearchProviderToPrefs( |
1633 const TemplateURL* t_url) { | 1635 const TemplateURL* t_url) { |
1634 PrefService* prefs = GetPrefs(); | 1636 PrefService* prefs = GetPrefs(); |
1635 if (!prefs) | 1637 if (!prefs) |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 // TODO(mpcomplete): If we allow editing extension keywords, then those | 2563 // TODO(mpcomplete): If we allow editing extension keywords, then those |
2562 // should be persisted to disk and synced. | 2564 // should be persisted to disk and synced. |
2563 if (template_url->sync_guid().empty() && | 2565 if (template_url->sync_guid().empty() && |
2564 !template_url->IsExtensionKeyword()) { | 2566 !template_url->IsExtensionKeyword()) { |
2565 template_url->data_.sync_guid = base::GenerateGUID(); | 2567 template_url->data_.sync_guid = base::GenerateGUID(); |
2566 if (service_.get()) | 2568 if (service_.get()) |
2567 service_->UpdateKeyword(template_url->data()); | 2569 service_->UpdateKeyword(template_url->data()); |
2568 } | 2570 } |
2569 } | 2571 } |
2570 } | 2572 } |
OLD | NEW |