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

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: 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
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"
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 ChangeToLoadedState(); 622 ChangeToLoadedState();
623 623
624 // Index any visits that occurred before we finished loading. 624 // Index any visits that occurred before we finished loading.
625 for (size_t i = 0; i < visits_to_add_.size(); ++i) 625 for (size_t i = 0; i < visits_to_add_.size(); ++i)
626 UpdateKeywordSearchTermsForURL(visits_to_add_[i]); 626 UpdateKeywordSearchTermsForURL(visits_to_add_[i]);
627 visits_to_add_.clear(); 627 visits_to_add_.clear();
628 628
629 if (new_resource_keyword_version && service_.get()) 629 if (new_resource_keyword_version && service_.get())
630 service_->SetBuiltinKeywordVersion(new_resource_keyword_version); 630 service_->SetBuiltinKeywordVersion(new_resource_keyword_version);
631 631
632 #if defined(ENALBE_PROTECTOR_SERVICE)
Yaron 2012/03/28 21:23:22 Typo in if-def. Should be ENABLE_PROTECTOR_SERVICE
nilesh 2012/03/28 23:35:11 Thanks for catching this.
632 // 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
633 // check at the beginning (overridden by Sync). 634 // check at the beginning (overridden by Sync).
634 if (is_default_search_hijacked && 635 if (is_default_search_hijacked &&
635 default_search_provider_ == hijacked_default_search_provider) { 636 default_search_provider_ == hijacked_default_search_provider) {
636 // The histograms should be reported even when Protector is disabled. 637 // The histograms should be reported even when Protector is disabled.
637 scoped_ptr<protector::BaseSettingChange> change( 638 scoped_ptr<protector::BaseSettingChange> change(
638 protector::CreateDefaultSearchProviderChange( 639 protector::CreateDefaultSearchProviderChange(
639 hijacked_default_search_provider, 640 hijacked_default_search_provider,
640 backup_default_search_provider.release())); 641 backup_default_search_provider.release()));
641 if (protector::IsEnabled()) { 642 if (protector::IsEnabled()) {
642 protector::ProtectorService* protector_service = 643 protector::ProtectorService* protector_service =
643 protector::ProtectorServiceFactory::GetForProfile(profile()); 644 protector::ProtectorServiceFactory::GetForProfile(profile());
644 DCHECK(protector_service); 645 DCHECK(protector_service);
645 protector_service->ShowChange(change.release()); 646 protector_service->ShowChange(change.release());
646 } else { 647 } else {
647 // Protector is turned off: set the current default search to itself 648 // Protector is turned off: set the current default search to itself
648 // 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
649 // 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.
650 // Note that this saves the default search provider to prefs. 651 // Note that this saves the default search provider to prefs.
651 SetDefaultSearchProviderNoNotify(default_search_provider_); 652 SetDefaultSearchProviderNoNotify(default_search_provider_);
652 } 653 }
653 } 654 }
655 #endif
654 656
655 NotifyObservers(); 657 NotifyObservers();
656 NotifyLoaded(); 658 NotifyLoaded();
657 } 659 }
658 660
659 string16 TemplateURLService::GetKeywordShortName(const string16& keyword, 661 string16 TemplateURLService::GetKeywordShortName(const string16& keyword,
660 bool* is_extension_keyword) { 662 bool* is_extension_keyword) {
661 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword); 663 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword);
662 664
663 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLService 665 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLService
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 dst->set_input_encodings(input_encodings); 1910 dst->set_input_encodings(input_encodings);
1909 dst->set_show_in_default_list(specifics.show_in_default_list()); 1911 dst->set_show_in_default_list(specifics.show_in_default_list());
1910 dst->SetSuggestionsURL(specifics.suggestions_url(), 0, 0); 1912 dst->SetSuggestionsURL(specifics.suggestions_url(), 0, 0);
1911 dst->SetPrepopulateId(specifics.prepopulate_id()); 1913 dst->SetPrepopulateId(specifics.prepopulate_id());
1912 dst->set_autogenerate_keyword(specifics.autogenerate_keyword()); 1914 dst->set_autogenerate_keyword(specifics.autogenerate_keyword());
1913 dst->SetInstantURL(specifics.instant_url(), 0, 0); 1915 dst->SetInstantURL(specifics.instant_url(), 0, 0);
1914 dst->set_last_modified( 1916 dst->set_last_modified(
1915 base::Time::FromInternalValue(specifics.last_modified())); 1917 base::Time::FromInternalValue(specifics.last_modified()));
1916 dst->set_sync_guid(specifics.sync_guid()); 1918 dst->set_sync_guid(specifics.sync_guid());
1917 } 1919 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698