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

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

Issue 10821061: The changes for compiling with Android NDK r8b (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/compiler_specific.h"
9 #include "base/environment.h" 10 #include "base/environment.h"
10 #include "base/guid.h" 11 #include "base/guid.h"
11 #include "base/i18n/case_conversion.h" 12 #include "base/i18n/case_conversion.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/stl_util.h" 14 #include "base/stl_util.h"
14 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 16 #include "base/string_split.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
18 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 bool database_specified_a_default = (default_search_provider != NULL); 692 bool database_specified_a_default = (default_search_provider != NULL);
692 693
693 // Check if default search provider is now managed. 694 // Check if default search provider is now managed.
694 scoped_ptr<TemplateURL> default_from_prefs; 695 scoped_ptr<TemplateURL> default_from_prefs;
695 LoadDefaultSearchProviderFromPrefs(&default_from_prefs, 696 LoadDefaultSearchProviderFromPrefs(&default_from_prefs,
696 &is_default_search_managed_); 697 &is_default_search_managed_);
697 698
698 // Check if the default search provider has been changed in Web Data by 699 // Check if the default search provider has been changed in Web Data by
699 // another program. No immediate action is performed because the default 700 // another program. No immediate action is performed because the default
700 // search may be changed below by Sync which effectively undoes the hijacking. 701 // search may be changed below by Sync which effectively undoes the hijacking.
701 bool is_default_search_hijacked = false; 702 bool ALLOW_UNUSED is_default_search_hijacked = false;
James Hawkins 2012/07/30 03:09:09 Why are you using ALLOW_UNUSED here?
michaelbai 2012/07/30 16:59:21 I compiled this file by the gcc 4.6, there was a
702 TemplateURL* hijacked_default_search_provider = NULL; 703 TemplateURL* ALLOW_UNUSED hijacked_default_search_provider = NULL;
703 scoped_ptr<TemplateURL> backup_default_search_provider; 704 scoped_ptr<TemplateURL> backup_default_search_provider;
704 // No check is required if the default search is managed. 705 // No check is required if the default search is managed.
705 // |DidDefaultSearchProviderChange| must always be called because it will 706 // |DidDefaultSearchProviderChange| must always be called because it will
706 // take care of the unowned backup default search provider instance. 707 // take care of the unowned backup default search provider instance.
707 if (DidDefaultSearchProviderChange(*result, profile_, 708 if (DidDefaultSearchProviderChange(*result, profile_,
708 &backup_default_search_provider) && 709 &backup_default_search_provider) &&
709 !is_default_search_managed_) { 710 !is_default_search_managed_) {
710 hijacked_default_search_provider = default_search_provider; 711 hijacked_default_search_provider = default_search_provider;
711 is_default_search_hijacked = true; 712 is_default_search_hijacked = true;
712 } 713 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // Index any visits that occurred before we finished loading. 788 // Index any visits that occurred before we finished loading.
788 for (size_t i = 0; i < visits_to_add_.size(); ++i) 789 for (size_t i = 0; i < visits_to_add_.size(); ++i)
789 UpdateKeywordSearchTermsForURL(visits_to_add_[i]); 790 UpdateKeywordSearchTermsForURL(visits_to_add_[i]);
790 visits_to_add_.clear(); 791 visits_to_add_.clear();
791 792
792 if (new_resource_keyword_version) 793 if (new_resource_keyword_version)
793 service_->SetBuiltinKeywordVersion(new_resource_keyword_version); 794 service_->SetBuiltinKeywordVersion(new_resource_keyword_version);
794 795
795 bool check_if_default_search_valid = !is_default_search_managed_; 796 bool check_if_default_search_valid = !is_default_search_managed_;
796 797
797 #if defined(ENABLE_PROTECTOR_SERVICE) 798 #if defined(ENABLE_PROTECTOR_SERVICE)
Yaron 2012/07/27 17:34:31 Alternatively, you could push this #if define deep
michaelbai 2012/07/27 20:38:36 That will disable a lot of code, I don't know ther
Yaron 2012/07/27 20:40:43 No. I'm saying to move it to L804 or so and if-def
sky 2012/08/01 00:22:45 Agree with Yaron. Move code into ifdef as necessar
michaelbai 2012/08/01 01:49:22 Done.
798 // Don't do anything if the default search provider has been changed since the 799 // Don't do anything if the default search provider has been changed since the
799 // check at the beginning (overridden by Sync). 800 // check at the beginning (overridden by Sync).
800 if (is_default_search_hijacked && 801 if (is_default_search_hijacked &&
801 default_search_provider_ == hijacked_default_search_provider) { 802 default_search_provider_ == hijacked_default_search_provider) {
802 // The histograms should be reported even when Protector is disabled. 803 // The histograms should be reported even when Protector is disabled.
803 scoped_ptr<protector::BaseSettingChange> change( 804 scoped_ptr<protector::BaseSettingChange> change(
804 protector::CreateDefaultSearchProviderChange( 805 protector::CreateDefaultSearchProviderChange(
805 hijacked_default_search_provider, 806 hijacked_default_search_provider,
806 backup_default_search_provider.release())); 807 backup_default_search_provider.release()));
807 if (protector::IsEnabled()) { 808 if (protector::IsEnabled()) {
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 // TODO(mpcomplete): If we allow editing extension keywords, then those 2486 // TODO(mpcomplete): If we allow editing extension keywords, then those
2486 // should be persisted to disk and synced. 2487 // should be persisted to disk and synced.
2487 if (template_url->sync_guid().empty() && 2488 if (template_url->sync_guid().empty() &&
2488 !template_url->IsExtensionKeyword()) { 2489 !template_url->IsExtensionKeyword()) {
2489 template_url->data_.sync_guid = base::GenerateGUID(); 2490 template_url->data_.sync_guid = base::GenerateGUID();
2490 if (service_.get()) 2491 if (service_.get())
2491 service_->UpdateKeyword(template_url->data()); 2492 service_->UpdateKeyword(template_url->data());
2492 } 2493 }
2493 } 2494 }
2494 } 2495 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698