| 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/protector/protector_service.h" | 26 #include "chrome/browser/protector/protector_service.h" |
| 27 #include "chrome/browser/protector/protector_service_factory.h" | 27 #include "chrome/browser/protector/protector_service_factory.h" |
| 28 #include "chrome/browser/rlz/rlz.h" | 28 #include "chrome/browser/rlz/rlz.h" |
| 29 #include "chrome/browser/search_engines/search_host_to_urls_map.h" | 29 #include "chrome/browser/search_engines/search_host_to_urls_map.h" |
| 30 #include "chrome/browser/search_engines/search_terms_data.h" | 30 #include "chrome/browser/search_engines/search_terms_data.h" |
| 31 #include "chrome/browser/search_engines/template_url.h" | 31 #include "chrome/browser/search_engines/template_url.h" |
| 32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 33 #include "chrome/browser/search_engines/template_url_service_observer.h" | 33 #include "chrome/browser/search_engines/template_url_service_observer.h" |
| 34 #include "chrome/browser/search_engines/util.h" | 34 #include "chrome/browser/search_engines/util.h" |
| 35 #include "chrome/browser/sync/api/sync_change.h" | 35 #include "chrome/browser/sync/api/sync_change.h" |
| 36 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 36 #include "chrome/common/chrome_notification_types.h" | 37 #include "chrome/common/chrome_notification_types.h" |
| 37 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/env_vars.h" | 39 #include "chrome/common/env_vars.h" |
| 39 #include "chrome/common/extensions/extension.h" | 40 #include "chrome/common/extensions/extension.h" |
| 40 #include "chrome/common/guid.h" | 41 #include "chrome/common/guid.h" |
| 41 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 43 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
| 44 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
| 45 #include "sync/protocol/search_engine_specifics.pb.h" | 46 #include "sync/protocol/search_engine_specifics.pb.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 482 } |
| 482 | 483 |
| 483 void TemplateURLService::RemoveObserver(TemplateURLServiceObserver* observer) { | 484 void TemplateURLService::RemoveObserver(TemplateURLServiceObserver* observer) { |
| 484 model_observers_.RemoveObserver(observer); | 485 model_observers_.RemoveObserver(observer); |
| 485 } | 486 } |
| 486 | 487 |
| 487 void TemplateURLService::Load() { | 488 void TemplateURLService::Load() { |
| 488 if (loaded_ || load_handle_) | 489 if (loaded_ || load_handle_) |
| 489 return; | 490 return; |
| 490 | 491 |
| 491 if (!service_.get()) | 492 if (!service_.get()) { |
| 492 service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); | 493 service_ = WebDataServiceFactory::GetForProfile(profile_, |
| 494 Profile::EXPLICIT_ACCESS); |
| 495 } |
| 493 | 496 |
| 494 if (service_.get()) { | 497 if (service_.get()) { |
| 495 load_handle_ = service_->GetKeywords(this); | 498 load_handle_ = service_->GetKeywords(this); |
| 496 } else { | 499 } else { |
| 497 ChangeToLoadedState(); | 500 ChangeToLoadedState(); |
| 498 NotifyLoaded(); | 501 NotifyLoaded(); |
| 499 } | 502 } |
| 500 } | 503 } |
| 501 | 504 |
| 502 void TemplateURLService::OnWebDataServiceRequestDone( | 505 void TemplateURLService::OnWebDataServiceRequestDone( |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 dst->set_input_encodings(input_encodings); | 1911 dst->set_input_encodings(input_encodings); |
| 1909 dst->set_show_in_default_list(specifics.show_in_default_list()); | 1912 dst->set_show_in_default_list(specifics.show_in_default_list()); |
| 1910 dst->SetSuggestionsURL(specifics.suggestions_url()); | 1913 dst->SetSuggestionsURL(specifics.suggestions_url()); |
| 1911 dst->SetPrepopulateId(specifics.prepopulate_id()); | 1914 dst->SetPrepopulateId(specifics.prepopulate_id()); |
| 1912 dst->set_autogenerate_keyword(specifics.autogenerate_keyword()); | 1915 dst->set_autogenerate_keyword(specifics.autogenerate_keyword()); |
| 1913 dst->SetInstantURL(specifics.instant_url()); | 1916 dst->SetInstantURL(specifics.instant_url()); |
| 1914 dst->set_last_modified( | 1917 dst->set_last_modified( |
| 1915 base::Time::FromInternalValue(specifics.last_modified())); | 1918 base::Time::FromInternalValue(specifics.last_modified())); |
| 1916 dst->set_sync_guid(specifics.sync_guid()); | 1919 dst->set_sync_guid(specifics.sync_guid()); |
| 1917 } | 1920 } |
| OLD | NEW |