| 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 "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" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "chrome/browser/background_contents_service.h" | 14 #include "chrome/browser/background_contents_service.h" |
| 15 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chrome_blob_storage_context.h" |
| 17 #include "chrome/browser/chrome_thread.h" | 18 #include "chrome/browser/chrome_thread.h" |
| 18 #include "chrome/browser/download/download_manager.h" | 19 #include "chrome/browser/download/download_manager.h" |
| 19 #include "chrome/browser/find_bar_state.h" | 20 #include "chrome/browser/find_bar_state.h" |
| 20 #include "chrome/browser/in_process_webkit/webkit_context.h" | 21 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 21 #include "chrome/browser/net/chrome_url_request_context.h" | 22 #include "chrome/browser/net/chrome_url_request_context.h" |
| 22 #include "chrome/browser/notifications/desktop_notification_service.h" | 23 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 23 #include "chrome/browser/ssl/ssl_host_state.h" | 24 #include "chrome/browser/ssl/ssl_host_state.h" |
| 24 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
| 25 #include "chrome/browser/themes/browser_theme_provider.h" | 26 #include "chrome/browser/themes/browser_theme_provider.h" |
| 26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 if (Source<Browser>(source)->profile() != this) | 509 if (Source<Browser>(source)->profile() != this) |
| 509 return; | 510 return; |
| 510 | 511 |
| 511 // Let's check if we still have an Off The Record window opened. | 512 // Let's check if we still have an Off The Record window opened. |
| 512 // Note that we check against 1 as this notification is sent before the | 513 // Note that we check against 1 as this notification is sent before the |
| 513 // browser window is actually removed from the list. | 514 // browser window is actually removed from the list. |
| 514 if (BrowserList::GetBrowserCount(this) <= 1) | 515 if (BrowserList::GetBrowserCount(this) <= 1) |
| 515 ExitedOffTheRecordMode(); | 516 ExitedOffTheRecordMode(); |
| 516 } | 517 } |
| 517 | 518 |
| 519 virtual ChromeBlobStorageContext* GetBlobStorageContext() { |
| 520 if (!blob_storage_context_) { |
| 521 blob_storage_context_ = new ChromeBlobStorageContext(); |
| 522 ChromeThread::PostTask( |
| 523 ChromeThread::IO, FROM_HERE, |
| 524 NewRunnableMethod( |
| 525 blob_storage_context_.get(), |
| 526 &ChromeBlobStorageContext::InitializeOnIOThread)); |
| 527 } |
| 528 return blob_storage_context_; |
| 529 } |
| 530 |
| 518 private: | 531 private: |
| 519 NotificationRegistrar registrar_; | 532 NotificationRegistrar registrar_; |
| 520 | 533 |
| 521 // The real underlying profile. | 534 // The real underlying profile. |
| 522 Profile* profile_; | 535 Profile* profile_; |
| 523 | 536 |
| 524 // The context to use for requests made from this OTR session. | 537 // The context to use for requests made from this OTR session. |
| 525 scoped_refptr<ChromeURLRequestContextGetter> request_context_; | 538 scoped_refptr<ChromeURLRequestContextGetter> request_context_; |
| 526 | 539 |
| 527 // The download manager that only stores downloaded items in memory. | 540 // The download manager that only stores downloaded items in memory. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 572 |
| 560 // The main database tracker for this profile. | 573 // The main database tracker for this profile. |
| 561 // Should be used only on the file thread. | 574 // Should be used only on the file thread. |
| 562 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; | 575 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
| 563 | 576 |
| 564 FilePath last_selected_directory_; | 577 FilePath last_selected_directory_; |
| 565 | 578 |
| 566 // Tracks all BackgroundContents running under this profile. | 579 // Tracks all BackgroundContents running under this profile. |
| 567 scoped_ptr<BackgroundContentsService> background_contents_service_; | 580 scoped_ptr<BackgroundContentsService> background_contents_service_; |
| 568 | 581 |
| 582 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
| 583 |
| 569 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); | 584 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); |
| 570 }; | 585 }; |
| 571 | 586 |
| 572 Profile *Profile::CreateOffTheRecordProfile() { | 587 Profile *Profile::CreateOffTheRecordProfile() { |
| 573 return new OffTheRecordProfileImpl(this); | 588 return new OffTheRecordProfileImpl(this); |
| 574 } | 589 } |
| OLD | NEW |