OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "app/theme_provider.h" | 8 #include "app/theme_provider.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/browser/renderer_host/render_process_host.h" | 43 #include "chrome/browser/renderer_host/render_process_host.h" |
44 #include "chrome/browser/search_versus_navigate_classifier.h" | 44 #include "chrome/browser/search_versus_navigate_classifier.h" |
45 #include "chrome/browser/search_engines/template_url_fetcher.h" | 45 #include "chrome/browser/search_engines/template_url_fetcher.h" |
46 #include "chrome/browser/search_engines/template_url_model.h" | 46 #include "chrome/browser/search_engines/template_url_model.h" |
47 #include "chrome/browser/sessions/session_service.h" | 47 #include "chrome/browser/sessions/session_service.h" |
48 #include "chrome/browser/sessions/tab_restore_service.h" | 48 #include "chrome/browser/sessions/tab_restore_service.h" |
49 #include "chrome/browser/ssl/ssl_host_state.h" | 49 #include "chrome/browser/ssl/ssl_host_state.h" |
50 #include "chrome/browser/sync/profile_sync_service.h" | 50 #include "chrome/browser/sync/profile_sync_service.h" |
51 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 51 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
52 #include "chrome/browser/thumbnail_store.h" | 52 #include "chrome/browser/thumbnail_store.h" |
| 53 #include "chrome/browser/user_style_sheet_watcher.h" |
53 #include "chrome/browser/visitedlink_master.h" | 54 #include "chrome/browser/visitedlink_master.h" |
54 #include "chrome/browser/visitedlink_event_listener.h" | 55 #include "chrome/browser/visitedlink_event_listener.h" |
55 #include "chrome/browser/webdata/web_data_service.h" | 56 #include "chrome/browser/webdata/web_data_service.h" |
56 #include "chrome/browser/web_resource/web_resource_service.h" | 57 #include "chrome/browser/web_resource/web_resource_service.h" |
57 #include "chrome/common/chrome_constants.h" | 58 #include "chrome/common/chrome_constants.h" |
58 #include "chrome/common/chrome_paths.h" | 59 #include "chrome/common/chrome_paths.h" |
59 #include "chrome/common/chrome_switches.h" | 60 #include "chrome/common/chrome_switches.h" |
60 #include "chrome/common/extensions/extension_error_reporter.h" | 61 #include "chrome/common/extensions/extension_error_reporter.h" |
61 #include "chrome/common/notification_service.h" | 62 #include "chrome/common/notification_service.h" |
62 #include "chrome/common/pref_names.h" | 63 #include "chrome/common/pref_names.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 404 } |
404 | 405 |
405 virtual HostZoomMap* GetHostZoomMap() { | 406 virtual HostZoomMap* GetHostZoomMap() { |
406 return profile_->GetHostZoomMap(); | 407 return profile_->GetHostZoomMap(); |
407 } | 408 } |
408 | 409 |
409 virtual Blacklist* GetPrivacyBlacklist() { | 410 virtual Blacklist* GetPrivacyBlacklist() { |
410 return profile_->GetPrivacyBlacklist(); | 411 return profile_->GetPrivacyBlacklist(); |
411 } | 412 } |
412 | 413 |
| 414 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() { |
| 415 return profile_->GetUserStyleSheetWatcher(); |
| 416 } |
| 417 |
413 virtual SessionService* GetSessionService() { | 418 virtual SessionService* GetSessionService() { |
414 // Don't save any sessions when off the record. | 419 // Don't save any sessions when off the record. |
415 return NULL; | 420 return NULL; |
416 } | 421 } |
417 | 422 |
418 virtual void ShutdownSessionService() { | 423 virtual void ShutdownSessionService() { |
419 // We don't allow a session service, nothing to do. | 424 // We don't allow a session service, nothing to do. |
420 } | 425 } |
421 | 426 |
422 virtual bool HasSessionService() const { | 427 virtual bool HasSessionService() const { |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 986 |
982 Blacklist* ProfileImpl::GetPrivacyBlacklist() { | 987 Blacklist* ProfileImpl::GetPrivacyBlacklist() { |
983 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 988 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
984 switches::kEnablePrivacyBlacklists)) | 989 switches::kEnablePrivacyBlacklists)) |
985 return NULL; | 990 return NULL; |
986 if (!privacy_blacklist_.get()) | 991 if (!privacy_blacklist_.get()) |
987 privacy_blacklist_ = new Blacklist(GetPrefs()); | 992 privacy_blacklist_ = new Blacklist(GetPrefs()); |
988 return privacy_blacklist_.get(); | 993 return privacy_blacklist_.get(); |
989 } | 994 } |
990 | 995 |
| 996 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { |
| 997 if (!user_style_sheet_watcher_.get()) { |
| 998 user_style_sheet_watcher_ = new UserStyleSheetWatcher(GetPath()); |
| 999 user_style_sheet_watcher_->Init(); |
| 1000 } |
| 1001 return user_style_sheet_watcher_.get(); |
| 1002 } |
| 1003 |
991 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { | 1004 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { |
992 if (!history_service_created_) { | 1005 if (!history_service_created_) { |
993 history_service_created_ = true; | 1006 history_service_created_ = true; |
994 scoped_refptr<HistoryService> history(new HistoryService(this)); | 1007 scoped_refptr<HistoryService> history(new HistoryService(this)); |
995 if (!history->Init(GetPath(), GetBookmarkModel())) | 1008 if (!history->Init(GetPath(), GetBookmarkModel())) |
996 return NULL; | 1009 return NULL; |
997 history_service_.swap(history); | 1010 history_service_.swap(history); |
998 | 1011 |
999 // Send out the notification that the history service was created. | 1012 // Send out the notification that the history service was created. |
1000 NotificationService::current()-> | 1013 NotificationService::current()-> |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 } | 1343 } |
1331 | 1344 |
1332 void ProfileImpl::InitSyncService() { | 1345 void ProfileImpl::InitSyncService() { |
1333 profile_sync_factory_.reset( | 1346 profile_sync_factory_.reset( |
1334 new ProfileSyncFactoryImpl(this, | 1347 new ProfileSyncFactoryImpl(this, |
1335 CommandLine::ForCurrentProcess())); | 1348 CommandLine::ForCurrentProcess())); |
1336 sync_service_.reset( | 1349 sync_service_.reset( |
1337 profile_sync_factory_->CreateProfileSyncService()); | 1350 profile_sync_factory_->CreateProfileSyncService()); |
1338 sync_service_->Initialize(); | 1351 sync_service_->Initialize(); |
1339 } | 1352 } |
OLD | NEW |