| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 url->favicon_url() == other_->favicon_url() && | 61 url->favicon_url() == other_->favicon_url() && |
| 62 url->show_in_default_list() == other_->show_in_default_list() && | 62 url->show_in_default_list() == other_->show_in_default_list() && |
| 63 url->input_encodings() == other_->input_encodings() && | 63 url->input_encodings() == other_->input_encodings() && |
| 64 url->prepopulate_id() == other_->prepopulate_id(); | 64 url->prepopulate_id() == other_->prepopulate_id(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 // Returns true if both |url1| and |url2| have autogenerated keywords | 68 // Returns true if both |url1| and |url2| have autogenerated keywords |
| 69 // or if their keywords are identical. | 69 // or if their keywords are identical. |
| 70 bool AreKeywordsSame(const TemplateURL* url1, const TemplateURL* url2) { | 70 bool AreKeywordsSame(const TemplateURL* url1, const TemplateURL* url2) { |
| 71 return (url1->autogenerate_keyword() && url2->autogenerate_keyword()) || | 71 return (url1->keyword() == url2->keyword()) || |
| 72 url1->keyword() == url2->keyword(); | 72 (url1->IsGoogleSearchURLWithReplaceableKeyword() && |
| 73 url2->IsGoogleSearchURLWithReplaceableKeyword()); |
| 73 } | 74 } |
| 74 | 75 |
| 75 const TemplateURL* other_; | 76 const TemplateURL* other_; |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 } // namespace | 79 } // namespace |
| 79 | 80 |
| 80 // Default search engine change tracked by Protector. | 81 // Default search engine change tracked by Protector. |
| 81 class DefaultSearchProviderChange : public BaseSettingChange, | 82 class DefaultSearchProviderChange : public BaseSettingChange, |
| 82 public TemplateURLServiceObserver, | 83 public TemplateURLServiceObserver, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 DCHECK(url_service); | 432 DCHECK(url_service); |
| 432 return url_service; | 433 return url_service; |
| 433 } | 434 } |
| 434 | 435 |
| 435 BaseSettingChange* CreateDefaultSearchProviderChange(TemplateURL* actual, | 436 BaseSettingChange* CreateDefaultSearchProviderChange(TemplateURL* actual, |
| 436 TemplateURL* backup) { | 437 TemplateURL* backup) { |
| 437 return new DefaultSearchProviderChange(actual, backup); | 438 return new DefaultSearchProviderChange(actual, backup); |
| 438 } | 439 } |
| 439 | 440 |
| 440 } // namespace protector | 441 } // namespace protector |
| OLD | NEW |