OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/theme_provider.h" | 7 #include "app/theme_provider.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
(...skipping 10 matching lines...) Expand all Loading... |
22 #include "chrome/browser/download/download_manager.h" | 22 #include "chrome/browser/download/download_manager.h" |
23 #include "chrome/browser/extensions/extension_devtools_manager.h" | 23 #include "chrome/browser/extensions/extension_devtools_manager.h" |
24 #include "chrome/browser/extensions/extension_message_service.h" | 24 #include "chrome/browser/extensions/extension_message_service.h" |
25 #include "chrome/browser/extensions/extension_process_manager.h" | 25 #include "chrome/browser/extensions/extension_process_manager.h" |
26 #include "chrome/browser/extensions/extensions_service.h" | 26 #include "chrome/browser/extensions/extensions_service.h" |
27 #include "chrome/browser/extensions/user_script_master.h" | 27 #include "chrome/browser/extensions/user_script_master.h" |
28 #include "chrome/browser/favicon_service.h" | 28 #include "chrome/browser/favicon_service.h" |
29 #include "chrome/browser/spellcheck_host.h" | 29 #include "chrome/browser/spellcheck_host.h" |
30 #include "chrome/browser/strict_transport_security_persister.h" | 30 #include "chrome/browser/strict_transport_security_persister.h" |
31 #include "chrome/browser/history/history.h" | 31 #include "chrome/browser/history/history.h" |
| 32 #include "chrome/browser/host_zoom_map.h" |
32 #include "chrome/browser/in_process_webkit/webkit_context.h" | 33 #include "chrome/browser/in_process_webkit/webkit_context.h" |
33 #include "chrome/browser/net/chrome_url_request_context.h" | 34 #include "chrome/browser/net/chrome_url_request_context.h" |
34 #include "chrome/browser/net/ssl_config_service_manager.h" | 35 #include "chrome/browser/net/ssl_config_service_manager.h" |
35 #include "chrome/browser/notifications/desktop_notification_service.h" | 36 #include "chrome/browser/notifications/desktop_notification_service.h" |
36 #include "chrome/browser/password_manager/password_store_default.h" | 37 #include "chrome/browser/password_manager/password_store_default.h" |
37 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" | 38 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" |
38 #include "chrome/browser/profile_manager.h" | 39 #include "chrome/browser/profile_manager.h" |
39 #include "chrome/browser/renderer_host/render_process_host.h" | 40 #include "chrome/browser/renderer_host/render_process_host.h" |
40 #include "chrome/browser/search_versus_navigate_classifier.h" | 41 #include "chrome/browser/search_versus_navigate_classifier.h" |
41 #include "chrome/browser/search_engines/template_url_fetcher.h" | 42 #include "chrome/browser/search_engines/template_url_fetcher.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions(this); | 397 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions(this); |
397 } | 398 } |
398 | 399 |
399 return extensions_request_context_; | 400 return extensions_request_context_; |
400 } | 401 } |
401 | 402 |
402 virtual net::SSLConfigService* GetSSLConfigService() { | 403 virtual net::SSLConfigService* GetSSLConfigService() { |
403 return GetOriginalProfile()->GetSSLConfigService(); | 404 return GetOriginalProfile()->GetSSLConfigService(); |
404 } | 405 } |
405 | 406 |
| 407 virtual HostZoomMap* GetHostZoomMap() { |
| 408 // Need to use a separate map from the normal one to avoid persisting zoom |
| 409 // changes in OTR mode. |
| 410 if (!host_zoom_map_) |
| 411 host_zoom_map_ = new HostZoomMap(this); |
| 412 return host_zoom_map_.get(); |
| 413 } |
| 414 |
406 virtual BlacklistManager* GetBlacklistManager() { | 415 virtual BlacklistManager* GetBlacklistManager() { |
407 return GetOriginalProfile()->GetBlacklistManager(); | 416 return GetOriginalProfile()->GetBlacklistManager(); |
408 } | 417 } |
409 | 418 |
410 virtual SessionService* GetSessionService() { | 419 virtual SessionService* GetSessionService() { |
411 // Don't save any sessions when off the record. | 420 // Don't save any sessions when off the record. |
412 return NULL; | 421 return NULL; |
413 } | 422 } |
414 | 423 |
415 virtual void ShutdownSessionService() { | 424 virtual void ShutdownSessionService() { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 NotificationRegistrar registrar_; | 527 NotificationRegistrar registrar_; |
519 | 528 |
520 // The real underlying profile. | 529 // The real underlying profile. |
521 Profile* profile_; | 530 Profile* profile_; |
522 | 531 |
523 // The context to use for requests made from this OTR session. | 532 // The context to use for requests made from this OTR session. |
524 scoped_refptr<ChromeURLRequestContextGetter> request_context_; | 533 scoped_refptr<ChromeURLRequestContextGetter> request_context_; |
525 | 534 |
526 scoped_refptr<ChromeURLRequestContextGetter> extensions_request_context_; | 535 scoped_refptr<ChromeURLRequestContextGetter> extensions_request_context_; |
527 | 536 |
| 537 scoped_refptr<HostZoomMap> host_zoom_map_; |
| 538 |
528 // The download manager that only stores downloaded items in memory. | 539 // The download manager that only stores downloaded items in memory. |
529 scoped_refptr<DownloadManager> download_manager_; | 540 scoped_refptr<DownloadManager> download_manager_; |
530 | 541 |
531 // Use a separate desktop notification service for OTR. | 542 // Use a separate desktop notification service for OTR. |
532 scoped_ptr<DesktopNotificationService> desktop_notification_service_; | 543 scoped_ptr<DesktopNotificationService> desktop_notification_service_; |
533 | 544 |
534 // Use a special WebKit context for OTR browsing. | 545 // Use a special WebKit context for OTR browsing. |
535 scoped_refptr<WebKitContext> webkit_context_; | 546 scoped_refptr<WebKitContext> webkit_context_; |
536 | 547 |
537 // We don't want SSLHostState from the OTR profile to leak back to the main | 548 // We don't want SSLHostState from the OTR profile to leak back to the main |
(...skipping 15 matching lines...) Expand all Loading... |
553 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); | 564 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); |
554 }; | 565 }; |
555 | 566 |
556 ProfileImpl::ProfileImpl(const FilePath& path) | 567 ProfileImpl::ProfileImpl(const FilePath& path) |
557 : path_(path), | 568 : path_(path), |
558 visited_link_event_listener_(new VisitedLinkEventListener()), | 569 visited_link_event_listener_(new VisitedLinkEventListener()), |
559 extension_devtools_manager_(NULL), | 570 extension_devtools_manager_(NULL), |
560 request_context_(NULL), | 571 request_context_(NULL), |
561 media_request_context_(NULL), | 572 media_request_context_(NULL), |
562 extensions_request_context_(NULL), | 573 extensions_request_context_(NULL), |
| 574 host_zoom_map_(NULL), |
563 blacklist_manager_(NULL), | 575 blacklist_manager_(NULL), |
564 blacklist_manager_created_(false), | 576 blacklist_manager_created_(false), |
565 history_service_created_(false), | 577 history_service_created_(false), |
566 favicon_service_created_(false), | 578 favicon_service_created_(false), |
567 created_web_data_service_(false), | 579 created_web_data_service_(false), |
568 created_password_store_(false), | 580 created_password_store_(false), |
569 created_download_manager_(false), | 581 created_download_manager_(false), |
570 created_theme_provider_(false), | 582 created_theme_provider_(false), |
571 start_time_(Time::Now()), | 583 start_time_(Time::Now()), |
572 spellcheck_host_(NULL), | 584 spellcheck_host_(NULL), |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 this, cookie_path); | 957 this, cookie_path); |
946 } | 958 } |
947 | 959 |
948 return extensions_request_context_; | 960 return extensions_request_context_; |
949 } | 961 } |
950 | 962 |
951 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 963 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
952 return ssl_config_service_manager_->Get(); | 964 return ssl_config_service_manager_->Get(); |
953 } | 965 } |
954 | 966 |
| 967 HostZoomMap* ProfileImpl::GetHostZoomMap() { |
| 968 if (!host_zoom_map_) |
| 969 host_zoom_map_ = new HostZoomMap(this); |
| 970 return host_zoom_map_.get(); |
| 971 } |
| 972 |
955 BlacklistManager* ProfileImpl::GetBlacklistManager() { | 973 BlacklistManager* ProfileImpl::GetBlacklistManager() { |
956 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 974 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
957 switches::kEnablePrivacyBlacklists)) { | 975 switches::kEnablePrivacyBlacklists)) { |
958 return NULL; | 976 return NULL; |
959 } | 977 } |
960 if (!blacklist_manager_created_) { | 978 if (!blacklist_manager_created_) { |
961 blacklist_manager_created_ = true; | 979 blacklist_manager_created_ = true; |
962 blacklist_manager_ = new BlacklistManager(this, GetExtensionsService()); | 980 blacklist_manager_ = new BlacklistManager(this, GetExtensionsService()); |
963 blacklist_manager_->Initialize(); | 981 blacklist_manager_->Initialize(); |
964 } | 982 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 } | 1321 } |
1304 if (!sync_service_.get()) | 1322 if (!sync_service_.get()) |
1305 InitSyncService(); | 1323 InitSyncService(); |
1306 return sync_service_.get(); | 1324 return sync_service_.get(); |
1307 } | 1325 } |
1308 | 1326 |
1309 void ProfileImpl::InitSyncService() { | 1327 void ProfileImpl::InitSyncService() { |
1310 sync_service_.reset(new ProfileSyncService(this)); | 1328 sync_service_.reset(new ProfileSyncService(this)); |
1311 sync_service_->Initialize(); | 1329 sync_service_->Initialize(); |
1312 } | 1330 } |
OLD | NEW |