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()) { |
515 // its cache and cookies once it gets destroyed at the appropriate time. | 517 // ChromeOS handles guest data independently. |
516 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); | 518 #if !defined(OS_CHROMEOS) |
| 519 // Clear all browsing data once a Guest Session completes. The Guest |
| 520 // profile has BrowserContextKeyedServices that the Incognito profile |
| 521 // doesn't, so the ProfileDestroyer can't delete it properly. |
| 522 // TODO(mlerman): Delete the guest using an improved ProfileDestroyer. |
| 523 BrowsingDataRemover* data_remover = |
| 524 BrowsingDataRemover::CreateForUnboundedRange(profile_); |
| 525 data_remover->Remove(BrowsingDataRemover::REMOVE_ALL, |
| 526 BrowsingDataHelper::ALL); |
| 527 // BrowsingDataRemover deletes itself. |
| 528 #endif |
| 529 } else { |
| 530 // An incognito profile is no longer needed, this indirectly frees |
| 531 // its cache and cookies once it gets destroyed at the appropriate time. |
| 532 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); |
| 533 } |
517 } | 534 } |
518 | 535 |
519 // There may be pending file dialogs, we need to tell them that we've gone | 536 // 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. | 537 // away so they don't try and call back to us. |
521 if (select_file_dialog_.get()) | 538 if (select_file_dialog_.get()) |
522 select_file_dialog_->ListenerDestroyed(); | 539 select_file_dialog_->ListenerDestroyed(); |
523 | 540 |
524 int num_downloads; | 541 int num_downloads; |
525 if (OkToCloseWithInProgressDownloads(&num_downloads) == | 542 if (OkToCloseWithInProgressDownloads(&num_downloads) == |
526 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && | 543 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 if (contents && !allow_js_access) { | 2529 if (contents && !allow_js_access) { |
2513 contents->web_contents()->GetController().LoadURL( | 2530 contents->web_contents()->GetController().LoadURL( |
2514 target_url, | 2531 target_url, |
2515 content::Referrer(), | 2532 content::Referrer(), |
2516 ui::PAGE_TRANSITION_LINK, | 2533 ui::PAGE_TRANSITION_LINK, |
2517 std::string()); // No extra headers. | 2534 std::string()); // No extra headers. |
2518 } | 2535 } |
2519 | 2536 |
2520 return contents != NULL; | 2537 return contents != NULL; |
2521 } | 2538 } |
OLD | NEW |