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 "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 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/protector/protector_service_factory.h" | 27 #include "chrome/browser/protector/protector_service_factory.h" |
28 #include "chrome/browser/protector/protector_utils.h" | 28 #include "chrome/browser/protector/protector_utils.h" |
29 #include "chrome/browser/rlz/rlz.h" | 29 #include "chrome/browser/rlz/rlz.h" |
30 #include "chrome/browser/search_engines/search_host_to_urls_map.h" | 30 #include "chrome/browser/search_engines/search_host_to_urls_map.h" |
31 #include "chrome/browser/search_engines/search_terms_data.h" | 31 #include "chrome/browser/search_engines/search_terms_data.h" |
32 #include "chrome/browser/search_engines/template_url.h" | 32 #include "chrome/browser/search_engines/template_url.h" |
33 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 33 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
34 #include "chrome/browser/search_engines/template_url_service_observer.h" | 34 #include "chrome/browser/search_engines/template_url_service_observer.h" |
35 #include "chrome/browser/search_engines/util.h" | 35 #include "chrome/browser/search_engines/util.h" |
36 #include "chrome/browser/sync/api/sync_change.h" | 36 #include "chrome/browser/sync/api/sync_change.h" |
| 37 #include "chrome/browser/webdata/web_data_service_factory.h" |
37 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/env_vars.h" | 40 #include "chrome/common/env_vars.h" |
40 #include "chrome/common/extensions/extension.h" | 41 #include "chrome/common/extensions/extension.h" |
41 #include "chrome/common/guid.h" | 42 #include "chrome/common/guid.h" |
42 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
43 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
44 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
45 #include "net/base/net_util.h" | 46 #include "net/base/net_util.h" |
46 #include "sync/protocol/search_engine_specifics.pb.h" | 47 #include "sync/protocol/search_engine_specifics.pb.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 479 } |
479 | 480 |
480 void TemplateURLService::RemoveObserver(TemplateURLServiceObserver* observer) { | 481 void TemplateURLService::RemoveObserver(TemplateURLServiceObserver* observer) { |
481 model_observers_.RemoveObserver(observer); | 482 model_observers_.RemoveObserver(observer); |
482 } | 483 } |
483 | 484 |
484 void TemplateURLService::Load() { | 485 void TemplateURLService::Load() { |
485 if (loaded_ || load_handle_) | 486 if (loaded_ || load_handle_) |
486 return; | 487 return; |
487 | 488 |
488 if (!service_.get()) | 489 if (!service_.get()) { |
489 service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); | 490 service_ = WebDataServiceFactory::GetForProfile(profile_, |
| 491 Profile::EXPLICIT_ACCESS); |
| 492 } |
490 | 493 |
491 if (service_.get()) { | 494 if (service_.get()) { |
492 load_handle_ = service_->GetKeywords(this); | 495 load_handle_ = service_->GetKeywords(this); |
493 } else { | 496 } else { |
494 ChangeToLoadedState(); | 497 ChangeToLoadedState(); |
495 NotifyLoaded(); | 498 NotifyLoaded(); |
496 } | 499 } |
497 } | 500 } |
498 | 501 |
499 void TemplateURLService::OnWebDataServiceRequestDone( | 502 void TemplateURLService::OnWebDataServiceRequestDone( |
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 dst->set_input_encodings(input_encodings); | 1899 dst->set_input_encodings(input_encodings); |
1897 dst->set_show_in_default_list(specifics.show_in_default_list()); | 1900 dst->set_show_in_default_list(specifics.show_in_default_list()); |
1898 dst->SetSuggestionsURL(specifics.suggestions_url()); | 1901 dst->SetSuggestionsURL(specifics.suggestions_url()); |
1899 dst->SetPrepopulateId(specifics.prepopulate_id()); | 1902 dst->SetPrepopulateId(specifics.prepopulate_id()); |
1900 dst->set_autogenerate_keyword(specifics.autogenerate_keyword()); | 1903 dst->set_autogenerate_keyword(specifics.autogenerate_keyword()); |
1901 dst->SetInstantURL(specifics.instant_url()); | 1904 dst->SetInstantURL(specifics.instant_url()); |
1902 dst->set_last_modified( | 1905 dst->set_last_modified( |
1903 base::Time::FromInternalValue(specifics.last_modified())); | 1906 base::Time::FromInternalValue(specifics.last_modified())); |
1904 dst->set_sync_guid(specifics.sync_guid()); | 1907 dst->set_sync_guid(specifics.sync_guid()); |
1905 } | 1908 } |
OLD | NEW |