OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #include "base/threading/thread_restrictions.h" | 27 #include "base/threading/thread_restrictions.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "chrome/app/chrome_command_ids.h" | 29 #include "chrome/app/chrome_command_ids.h" |
30 #include "chrome/browser/app_mode/app_mode_utils.h" | 30 #include "chrome/browser/app_mode/app_mode_utils.h" |
31 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 31 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
32 #include "chrome/browser/background/background_contents.h" | 32 #include "chrome/browser/background/background_contents.h" |
33 #include "chrome/browser/background/background_contents_service.h" | 33 #include "chrome/browser/background/background_contents_service.h" |
34 #include "chrome/browser/background/background_contents_service_factory.h" | 34 #include "chrome/browser/background/background_contents_service_factory.h" |
35 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
36 #include "chrome/browser/browser_shutdown.h" | 36 #include "chrome/browser/browser_shutdown.h" |
37 #include "chrome/browser/browsing_data/browsing_data_helper.h" | |
38 #include "chrome/browser/browsing_data/browsing_data_remover.h" | |
37 #include "chrome/browser/character_encoding.h" | 39 #include "chrome/browser/character_encoding.h" |
38 #include "chrome/browser/chrome_notification_types.h" | 40 #include "chrome/browser/chrome_notification_types.h" |
39 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 41 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
40 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 42 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
41 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 43 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
42 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" | 44 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" |
43 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re quest.h" | 45 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re quest.h" |
44 #include "chrome/browser/defaults.h" | 46 #include "chrome/browser/defaults.h" |
45 #include "chrome/browser/devtools/devtools_toggle_action.h" | 47 #include "chrome/browser/devtools/devtools_toggle_action.h" |
46 #include "chrome/browser/devtools/devtools_window.h" | 48 #include "chrome/browser/devtools/devtools_window.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 // Destroy BrowserExtensionWindowController before the incognito profile | 506 // Destroy BrowserExtensionWindowController before the incognito profile |
505 // is destroyed to make sure the chrome.windows.onRemoved event is sent. | 507 // is destroyed to make sure the chrome.windows.onRemoved event is sent. |
506 extension_window_controller_.reset(); | 508 extension_window_controller_.reset(); |
507 | 509 |
508 // Destroy BrowserInstantController before the incongnito profile is destroyed | 510 // Destroy BrowserInstantController before the incongnito profile is destroyed |
509 // because the InstantController destructor depends on this profile. | 511 // because the InstantController destructor depends on this profile. |
510 instant_controller_.reset(); | 512 instant_controller_.reset(); |
511 | 513 |
512 if (profile_->IsOffTheRecord() && | 514 if (profile_->IsOffTheRecord() && |
513 !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { | 515 !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { |
514 // An incognito profile is no longer needed, this indirectly frees | 516 if (profile_->IsGuestSession()) { |
Peter Kasting
2015/02/10 21:43:36
How come the incognito codepath doesn't actually w
Mike Lerman
2015/02/10 21:53:32
I've modified the comment to explain why we're doi
Peter Kasting
2015/02/10 21:58:10
OK, the new comment is better, but I still don't r
Mike Lerman
2015/02/11 15:15:32
You're exactly right. DestroyProfileWhenAppropriat
| |
515 // its cache and cookies once it gets destroyed at the appropriate time. | 517 // Clear all browsing data once a Guest Session completes. |
516 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); | 518 // TODO(mlerman): Delete the guest |profile_| completely instead. |
519 BrowsingDataRemover* data_remover = | |
520 BrowsingDataRemover::CreateForUnboundedRange(profile_); | |
521 data_remover->Remove(BrowsingDataRemover::REMOVE_ALL ^ | |
522 BrowsingDataRemover::REMOVE_DOWNLOADS, | |
523 BrowsingDataHelper::ALL); | |
524 // BrowsingDataRemover deletes itself. | |
525 } else { | |
526 // An incognito profile is no longer needed, this indirectly frees | |
527 // its cache and cookies once it gets destroyed at the appropriate time. | |
528 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); | |
529 } | |
517 } | 530 } |
518 | 531 |
519 // There may be pending file dialogs, we need to tell them that we've gone | 532 // There may be pending file dialogs, we need to tell them that we've gone |
520 // away so they don't try and call back to us. | 533 // away so they don't try and call back to us. |
521 if (select_file_dialog_.get()) | 534 if (select_file_dialog_.get()) |
522 select_file_dialog_->ListenerDestroyed(); | 535 select_file_dialog_->ListenerDestroyed(); |
523 | 536 |
524 int num_downloads; | 537 int num_downloads; |
525 if (OkToCloseWithInProgressDownloads(&num_downloads) == | 538 if (OkToCloseWithInProgressDownloads(&num_downloads) == |
526 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && | 539 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2512 if (contents && !allow_js_access) { | 2525 if (contents && !allow_js_access) { |
2513 contents->web_contents()->GetController().LoadURL( | 2526 contents->web_contents()->GetController().LoadURL( |
2514 target_url, | 2527 target_url, |
2515 content::Referrer(), | 2528 content::Referrer(), |
2516 ui::PAGE_TRANSITION_LINK, | 2529 ui::PAGE_TRANSITION_LINK, |
2517 std::string()); // No extra headers. | 2530 std::string()); // No extra headers. |
2518 } | 2531 } |
2519 | 2532 |
2520 return contents != NULL; | 2533 return contents != NULL; |
2521 } | 2534 } |
OLD | NEW |