Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 888843005: Closing a guest session clears all browsing history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp variable and a comment Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // Clear all browsing data once a Guest Session completes. The Guest
516 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); 518 // profile has BrowserContextKeyedServices that the Incognito profile
519 // doesn't, so the ProfileDestroyer can't delete it properly.
520 // TODO(mlerman): Delete the guest using an improved ProfileDestroyer.
521 BrowsingDataRemover* data_remover =
522 BrowsingDataRemover::CreateForUnboundedRange(profile_);
523 data_remover->Remove(BrowsingDataRemover::REMOVE_ALL ^
524 BrowsingDataRemover::REMOVE_DOWNLOADS,
battre 2015/02/11 15:19:25 Looking at https://developer.chrome.com/extensions
Bernhard Bauer 2015/02/11 16:04:28 Yup, we never delete downloaded files.
Mike Lerman 2015/02/12 15:36:23 Okay. Done.
525 BrowsingDataHelper::ALL);
526 // BrowsingDataRemover deletes itself.
527 } else {
528 // An incognito profile is no longer needed, this indirectly frees
529 // its cache and cookies once it gets destroyed at the appropriate time.
530 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_);
531 }
517 } 532 }
518 533
519 // There may be pending file dialogs, we need to tell them that we've gone 534 // 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. 535 // away so they don't try and call back to us.
521 if (select_file_dialog_.get()) 536 if (select_file_dialog_.get())
522 select_file_dialog_->ListenerDestroyed(); 537 select_file_dialog_->ListenerDestroyed();
523 538
524 int num_downloads; 539 int num_downloads;
525 if (OkToCloseWithInProgressDownloads(&num_downloads) == 540 if (OkToCloseWithInProgressDownloads(&num_downloads) ==
526 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && 541 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN &&
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 if (contents && !allow_js_access) { 2527 if (contents && !allow_js_access) {
2513 contents->web_contents()->GetController().LoadURL( 2528 contents->web_contents()->GetController().LoadURL(
2514 target_url, 2529 target_url,
2515 content::Referrer(), 2530 content::Referrer(),
2516 ui::PAGE_TRANSITION_LINK, 2531 ui::PAGE_TRANSITION_LINK,
2517 std::string()); // No extra headers. 2532 std::string()); // No extra headers.
2518 } 2533 }
2519 2534
2520 return contents != NULL; 2535 return contents != NULL;
2521 } 2536 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | chrome/browser/ui/browser_command_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698