Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: response to sky Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 1610
1610 void TemplateURLService::NotifyLoaded() { 1611 void TemplateURLService::NotifyLoaded() {
1611 content::NotificationService::current()->Notify( 1612 content::NotificationService::current()->Notify(
1612 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, 1613 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED,
1613 content::Source<TemplateURLService>(this), 1614 content::Source<TemplateURLService>(this),
1614 content::NotificationService::NoDetails()); 1615 content::NotificationService::NoDetails());
1615 1616
1616 for (PendingExtensionIDs::const_iterator i(pending_extension_ids_.begin()); 1617 for (PendingExtensionIDs::const_iterator i(pending_extension_ids_.begin());
1617 i != pending_extension_ids_.end(); ++i) { 1618 i != pending_extension_ids_.end(); ++i) {
1618 const extensions::Extension* extension = 1619 const extensions::Extension* extension =
1619 profile_->GetExtensionService()->GetExtensionById(*i, true); 1620 extensions::ExtensionSystem::Get(profile_)->extension_service()->
1621 GetExtensionById(*i, true);
1620 if (extension) 1622 if (extension)
1621 RegisterExtensionKeyword(extension); 1623 RegisterExtensionKeyword(extension);
1622 } 1624 }
1623 pending_extension_ids_.clear(); 1625 pending_extension_ids_.clear();
1624 } 1626 }
1625 1627
1626 void TemplateURLService::SaveDefaultSearchProviderToPrefs( 1628 void TemplateURLService::SaveDefaultSearchProviderToPrefs(
1627 const TemplateURL* t_url) { 1629 const TemplateURL* t_url) {
1628 PrefService* prefs = GetPrefs(); 1630 PrefService* prefs = GetPrefs();
1629 if (!prefs) 1631 if (!prefs)
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 // TODO(mpcomplete): If we allow editing extension keywords, then those 2548 // TODO(mpcomplete): If we allow editing extension keywords, then those
2547 // should be persisted to disk and synced. 2549 // should be persisted to disk and synced.
2548 if (template_url->sync_guid().empty() && 2550 if (template_url->sync_guid().empty() &&
2549 !template_url->IsExtensionKeyword()) { 2551 !template_url->IsExtensionKeyword()) {
2550 template_url->data_.sync_guid = base::GenerateGUID(); 2552 template_url->data_.sync_guid = base::GenerateGUID();
2551 if (service_.get()) 2553 if (service_.get())
2552 service_->UpdateKeyword(template_url->data()); 2554 service_->UpdateKeyword(template_url->data());
2553 } 2555 }
2554 } 2556 }
2555 } 2557 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698