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

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

Issue 9863047: Exclude ProtectorService code from Android build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/protector/protector_utils.cc ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/environment.h" 9 #include "base/environment.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/string_split.h" 13 #include "base/string_split.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/google/google_url_tracker.h" 18 #include "chrome/browser/google/google_url_tracker.h"
19 #include "chrome/browser/history/history.h" 19 #include "chrome/browser/history/history.h"
20 #include "chrome/browser/history/history_notifications.h" 20 #include "chrome/browser/history/history_notifications.h"
21 #include "chrome/browser/net/url_fixer_upper.h" 21 #include "chrome/browser/net/url_fixer_upper.h"
22 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
23 #include "chrome/browser/prefs/pref_set_observer.h" 23 #include "chrome/browser/prefs/pref_set_observer.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/protector/base_setting_change.h" 25 #include "chrome/browser/protector/base_setting_change.h"
26 #include "chrome/browser/protector/protector_service.h" 26 #include "chrome/browser/protector/protector_service.h"
27 #include "chrome/browser/protector/protector_service_factory.h" 27 #include "chrome/browser/protector/protector_service_factory.h"
28 #include "chrome/browser/protector/protector_utils.h"
28 #include "chrome/browser/rlz/rlz.h" 29 #include "chrome/browser/rlz/rlz.h"
29 #include "chrome/browser/search_engines/search_host_to_urls_map.h" 30 #include "chrome/browser/search_engines/search_host_to_urls_map.h"
30 #include "chrome/browser/search_engines/search_terms_data.h" 31 #include "chrome/browser/search_engines/search_terms_data.h"
31 #include "chrome/browser/search_engines/template_url.h" 32 #include "chrome/browser/search_engines/template_url.h"
32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 33 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
33 #include "chrome/browser/search_engines/template_url_service_observer.h" 34 #include "chrome/browser/search_engines/template_url_service_observer.h"
34 #include "chrome/browser/search_engines/util.h" 35 #include "chrome/browser/search_engines/util.h"
35 #include "chrome/browser/sync/api/sync_change.h" 36 #include "chrome/browser/sync/api/sync_change.h"
36 #include "chrome/common/chrome_notification_types.h" 37 #include "chrome/common/chrome_notification_types.h"
37 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ChangeToLoadedState(); 622 ChangeToLoadedState();
622 623
623 // Index any visits that occurred before we finished loading. 624 // Index any visits that occurred before we finished loading.
624 for (size_t i = 0; i < visits_to_add_.size(); ++i) 625 for (size_t i = 0; i < visits_to_add_.size(); ++i)
625 UpdateKeywordSearchTermsForURL(visits_to_add_[i]); 626 UpdateKeywordSearchTermsForURL(visits_to_add_[i]);
626 visits_to_add_.clear(); 627 visits_to_add_.clear();
627 628
628 if (new_resource_keyword_version && service_.get()) 629 if (new_resource_keyword_version && service_.get())
629 service_->SetBuiltinKeywordVersion(new_resource_keyword_version); 630 service_->SetBuiltinKeywordVersion(new_resource_keyword_version);
630 631
632 #if defined(ENABLE_PROTECTOR_SERVICE)
631 // Don't do anything if the default search provider has been changed since the 633 // Don't do anything if the default search provider has been changed since the
632 // check at the beginning (overridden by Sync). 634 // check at the beginning (overridden by Sync).
633 if (is_default_search_hijacked && 635 if (is_default_search_hijacked &&
634 default_search_provider_ == hijacked_default_search_provider) { 636 default_search_provider_ == hijacked_default_search_provider) {
635 // The histograms should be reported even when Protector is disabled. 637 // The histograms should be reported even when Protector is disabled.
636 scoped_ptr<protector::BaseSettingChange> change( 638 scoped_ptr<protector::BaseSettingChange> change(
637 protector::CreateDefaultSearchProviderChange( 639 protector::CreateDefaultSearchProviderChange(
638 hijacked_default_search_provider, 640 hijacked_default_search_provider,
639 backup_default_search_provider.release())); 641 backup_default_search_provider.release()));
640 if (protector::IsEnabled()) { 642 if (protector::IsEnabled()) {
641 protector::ProtectorService* protector_service = 643 protector::ProtectorService* protector_service =
642 protector::ProtectorServiceFactory::GetForProfile(profile()); 644 protector::ProtectorServiceFactory::GetForProfile(profile());
643 DCHECK(protector_service); 645 DCHECK(protector_service);
644 protector_service->ShowChange(change.release()); 646 protector_service->ShowChange(change.release());
645 } else { 647 } else {
646 // Protector is turned off: set the current default search to itself 648 // Protector is turned off: set the current default search to itself
647 // to update the backup and sign it. Otherwise, change will be reported 649 // to update the backup and sign it. Otherwise, change will be reported
648 // every time when keywords are loaded until a search provider is added. 650 // every time when keywords are loaded until a search provider is added.
649 // Note that this saves the default search provider to prefs. 651 // Note that this saves the default search provider to prefs.
650 SetDefaultSearchProviderNoNotify(default_search_provider_); 652 SetDefaultSearchProviderNoNotify(default_search_provider_);
651 } 653 }
652 } 654 }
655 #endif
653 656
654 NotifyObservers(); 657 NotifyObservers();
655 NotifyLoaded(); 658 NotifyLoaded();
656 } 659 }
657 660
658 string16 TemplateURLService::GetKeywordShortName(const string16& keyword, 661 string16 TemplateURLService::GetKeywordShortName(const string16& keyword,
659 bool* is_extension_keyword) { 662 bool* is_extension_keyword) {
660 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword); 663 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword);
661 664
662 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLService 665 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLService
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 dst->set_input_encodings(input_encodings); 1909 dst->set_input_encodings(input_encodings);
1907 dst->set_show_in_default_list(specifics.show_in_default_list()); 1910 dst->set_show_in_default_list(specifics.show_in_default_list());
1908 dst->SetSuggestionsURL(specifics.suggestions_url()); 1911 dst->SetSuggestionsURL(specifics.suggestions_url());
1909 dst->SetPrepopulateId(specifics.prepopulate_id()); 1912 dst->SetPrepopulateId(specifics.prepopulate_id());
1910 dst->set_autogenerate_keyword(specifics.autogenerate_keyword()); 1913 dst->set_autogenerate_keyword(specifics.autogenerate_keyword());
1911 dst->SetInstantURL(specifics.instant_url()); 1914 dst->SetInstantURL(specifics.instant_url());
1912 dst->set_last_modified( 1915 dst->set_last_modified(
1913 base::Time::FromInternalValue(specifics.last_modified())); 1916 base::Time::FromInternalValue(specifics.last_modified()));
1914 dst->set_sync_guid(specifics.sync_guid()); 1917 dst->set_sync_guid(specifics.sync_guid());
1915 } 1918 }
OLDNEW
« no previous file with comments | « chrome/browser/protector/protector_utils.cc ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698