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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "chrome/browser/file_select_helper.h" | 58 #include "chrome/browser/file_select_helper.h" |
59 #include "chrome/browser/first_run/first_run.h" | 59 #include "chrome/browser/first_run/first_run.h" |
60 #include "chrome/browser/history/top_sites_factory.h" | 60 #include "chrome/browser/history/top_sites_factory.h" |
61 #include "chrome/browser/infobars/infobar_service.h" | 61 #include "chrome/browser/infobars/infobar_service.h" |
62 #include "chrome/browser/lifetime/application_lifetime.h" | 62 #include "chrome/browser/lifetime/application_lifetime.h" |
63 #include "chrome/browser/notifications/notification_ui_manager.h" | 63 #include "chrome/browser/notifications/notification_ui_manager.h" |
64 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 64 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
65 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 65 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
66 #include "chrome/browser/profiles/profile.h" | 66 #include "chrome/browser/profiles/profile.h" |
67 #include "chrome/browser/profiles/profile_destroyer.h" | 67 #include "chrome/browser/profiles/profile_destroyer.h" |
| 68 #include "chrome/browser/profiles/profile_manager.h" |
68 #include "chrome/browser/profiles/profile_metrics.h" | 69 #include "chrome/browser/profiles/profile_metrics.h" |
69 #include "chrome/browser/repost_form_warning_controller.h" | 70 #include "chrome/browser/repost_form_warning_controller.h" |
70 #include "chrome/browser/search/search.h" | 71 #include "chrome/browser/search/search.h" |
71 #include "chrome/browser/sessions/session_service.h" | 72 #include "chrome/browser/sessions/session_service.h" |
72 #include "chrome/browser/sessions/session_service_factory.h" | 73 #include "chrome/browser/sessions/session_service_factory.h" |
73 #include "chrome/browser/sessions/session_tab_helper.h" | 74 #include "chrome/browser/sessions/session_tab_helper.h" |
74 #include "chrome/browser/sessions/tab_restore_service.h" | 75 #include "chrome/browser/sessions/tab_restore_service.h" |
75 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 76 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
76 #include "chrome/browser/sync/profile_sync_service.h" | 77 #include "chrome/browser/sync/profile_sync_service.h" |
77 #include "chrome/browser/sync/profile_sync_service_factory.h" | 78 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // Destroy BrowserExtensionWindowController before the incognito profile | 505 // Destroy BrowserExtensionWindowController before the incognito profile |
505 // is destroyed to make sure the chrome.windows.onRemoved event is sent. | 506 // is destroyed to make sure the chrome.windows.onRemoved event is sent. |
506 extension_window_controller_.reset(); | 507 extension_window_controller_.reset(); |
507 | 508 |
508 // Destroy BrowserInstantController before the incongnito profile is destroyed | 509 // Destroy BrowserInstantController before the incongnito profile is destroyed |
509 // because the InstantController destructor depends on this profile. | 510 // because the InstantController destructor depends on this profile. |
510 instant_controller_.reset(); | 511 instant_controller_.reset(); |
511 | 512 |
512 if (profile_->IsOffTheRecord() && | 513 if (profile_->IsOffTheRecord() && |
513 !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { | 514 !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { |
514 // An incognito profile is no longer needed, this indirectly frees | 515 if (profile_->IsGuestSession()) { |
515 // its cache and cookies once it gets destroyed at the appropriate time. | 516 // The profile's BCKS's need to shutdown after Views shuts down. |
516 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); | 517 base::MessageLoop::current()->PostTask( |
| 518 FROM_HERE, base::Bind(&ProfileManager::DeleteProfile, |
| 519 base::Unretained(g_browser_process->profile_mana
ger()), |
| 520 profile_)); |
| 521 } else { |
| 522 // An incognito profile is no longer needed, this indirectly frees |
| 523 // its cache and cookies once it gets destroyed at the appropriate time. |
| 524 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); |
| 525 } |
517 } | 526 } |
518 | 527 |
519 // There may be pending file dialogs, we need to tell them that we've gone | 528 // 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. | 529 // away so they don't try and call back to us. |
521 if (select_file_dialog_.get()) | 530 if (select_file_dialog_.get()) |
522 select_file_dialog_->ListenerDestroyed(); | 531 select_file_dialog_->ListenerDestroyed(); |
523 | 532 |
524 int num_downloads; | 533 int num_downloads; |
525 if (OkToCloseWithInProgressDownloads(&num_downloads) == | 534 if (OkToCloseWithInProgressDownloads(&num_downloads) == |
526 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && | 535 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 if (contents && !allow_js_access) { | 2521 if (contents && !allow_js_access) { |
2513 contents->web_contents()->GetController().LoadURL( | 2522 contents->web_contents()->GetController().LoadURL( |
2514 target_url, | 2523 target_url, |
2515 content::Referrer(), | 2524 content::Referrer(), |
2516 ui::PAGE_TRANSITION_LINK, | 2525 ui::PAGE_TRANSITION_LINK, |
2517 std::string()); // No extra headers. | 2526 std::string()); // No extra headers. |
2518 } | 2527 } |
2519 | 2528 |
2520 return contents != NULL; | 2529 return contents != NULL; |
2521 } | 2530 } |
OLD | NEW |