| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Returns true if both |other| and |url| are NULL or have same field values. | 49 // Returns true if both |other| and |url| are NULL or have same field values. |
| 50 bool operator()(const TemplateURL* url) { | 50 bool operator()(const TemplateURL* url) { |
| 51 if (url == other_ ) | 51 if (url == other_ ) |
| 52 return true; | 52 return true; |
| 53 if (!url || !other_) | 53 if (!url || !other_) |
| 54 return false; | 54 return false; |
| 55 return url->short_name() == other_->short_name() && | 55 return url->short_name() == other_->short_name() && |
| 56 AreKeywordsSame(url, other_) && | 56 AreKeywordsSame(url, other_) && |
| 57 TemplateURLRef::SameUrlRefs(url->url(), other_->url()) && | 57 url->url() == other_->url() && |
| 58 TemplateURLRef::SameUrlRefs(url->suggestions_url(), | 58 url->suggestions_url() == other_->suggestions_url() && |
| 59 other_->suggestions_url()) && | 59 url->instant_url() == other_->instant_url() && |
| 60 TemplateURLRef::SameUrlRefs(url->instant_url(), | 60 url->safe_for_autoreplace() == other_->safe_for_autoreplace() && |
| 61 other_->instant_url()) && | |
| 62 url->favicon_url() == other_->favicon_url() && | 61 url->favicon_url() == other_->favicon_url() && |
| 63 url->safe_for_autoreplace() == other_->safe_for_autoreplace() && | |
| 64 url->show_in_default_list() == other_->show_in_default_list() && | 62 url->show_in_default_list() == other_->show_in_default_list() && |
| 65 url->input_encodings() == other_->input_encodings() && | 63 url->input_encodings() == other_->input_encodings() && |
| 66 url->prepopulate_id() == other_->prepopulate_id(); | 64 url->prepopulate_id() == other_->prepopulate_id(); |
| 67 } | 65 } |
| 68 | 66 |
| 69 private: | 67 private: |
| 70 // Returns true if both |url1| and |url2| have autogenerated keywords | 68 // Returns true if both |url1| and |url2| have autogenerated keywords |
| 71 // or if their keywords are identical. | 69 // or if their keywords are identical. |
| 72 bool AreKeywordsSame(const TemplateURL* url1, const TemplateURL* url2) { | 70 bool AreKeywordsSame(const TemplateURL* url1, const TemplateURL* url2) { |
| 73 return (url1->autogenerate_keyword() && url2->autogenerate_keyword()) || | 71 return (url1->autogenerate_keyword() && url2->autogenerate_keyword()) || |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 DCHECK(url_service); | 391 DCHECK(url_service); |
| 394 return url_service; | 392 return url_service; |
| 395 } | 393 } |
| 396 | 394 |
| 397 BaseSettingChange* CreateDefaultSearchProviderChange(const TemplateURL* actual, | 395 BaseSettingChange* CreateDefaultSearchProviderChange(const TemplateURL* actual, |
| 398 TemplateURL* backup) { | 396 TemplateURL* backup) { |
| 399 return new DefaultSearchProviderChange(actual, backup); | 397 return new DefaultSearchProviderChange(actual, backup); |
| 400 } | 398 } |
| 401 | 399 |
| 402 } // namespace protector | 400 } // namespace protector |
| OLD | NEW |