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 url->url() == other_->url() && | 57 TemplateURLRef::SameUrlRefs(url->url(), other_->url()) && |
58 url->suggestions_url() == other_->suggestions_url() && | 58 TemplateURLRef::SameUrlRefs(url->suggestions_url(), |
59 url->instant_url() == other_->instant_url() && | 59 other_->suggestions_url()) && |
| 60 TemplateURLRef::SameUrlRefs(url->instant_url(), |
| 61 other_->instant_url()) && |
| 62 url->favicon_url() == other_->favicon_url() && |
60 url->safe_for_autoreplace() == other_->safe_for_autoreplace() && | 63 url->safe_for_autoreplace() == other_->safe_for_autoreplace() && |
61 url->favicon_url() == other_->favicon_url() && | |
62 url->show_in_default_list() == other_->show_in_default_list() && | 64 url->show_in_default_list() == other_->show_in_default_list() && |
63 url->input_encodings() == other_->input_encodings() && | 65 url->input_encodings() == other_->input_encodings() && |
64 url->prepopulate_id() == other_->prepopulate_id(); | 66 url->prepopulate_id() == other_->prepopulate_id(); |
65 } | 67 } |
66 | 68 |
67 private: | 69 private: |
68 // Returns true if both |url1| and |url2| have autogenerated keywords | 70 // Returns true if both |url1| and |url2| have autogenerated keywords |
69 // or if their keywords are identical. | 71 // or if their keywords are identical. |
70 bool AreKeywordsSame(const TemplateURL* url1, const TemplateURL* url2) { | 72 bool AreKeywordsSame(const TemplateURL* url1, const TemplateURL* url2) { |
71 return (url1->autogenerate_keyword() && url2->autogenerate_keyword()) || | 73 return (url1->autogenerate_keyword() && url2->autogenerate_keyword()) || |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 DCHECK(url_service); | 393 DCHECK(url_service); |
392 return url_service; | 394 return url_service; |
393 } | 395 } |
394 | 396 |
395 BaseSettingChange* CreateDefaultSearchProviderChange(const TemplateURL* actual, | 397 BaseSettingChange* CreateDefaultSearchProviderChange(const TemplateURL* actual, |
396 TemplateURL* backup) { | 398 TemplateURL* backup) { |
397 return new DefaultSearchProviderChange(actual, backup); | 399 return new DefaultSearchProviderChange(actual, backup); |
398 } | 400 } |
399 | 401 |
400 } // namespace protector | 402 } // namespace protector |
OLD | NEW |