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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 #include "chrome/browser/history/top_sites_factory.h" | 61 #include "chrome/browser/history/top_sites_factory.h" |
62 #include "chrome/browser/infobars/infobar_service.h" | 62 #include "chrome/browser/infobars/infobar_service.h" |
63 #include "chrome/browser/lifetime/application_lifetime.h" | 63 #include "chrome/browser/lifetime/application_lifetime.h" |
64 #include "chrome/browser/memory/tab_manager_web_contents_data.h" | 64 #include "chrome/browser/memory/tab_manager_web_contents_data.h" |
65 #include "chrome/browser/notifications/notification_ui_manager.h" | 65 #include "chrome/browser/notifications/notification_ui_manager.h" |
66 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 66 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
67 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 67 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
68 #include "chrome/browser/profiles/profile.h" | 68 #include "chrome/browser/profiles/profile.h" |
69 #include "chrome/browser/profiles/profile_destroyer.h" | 69 #include "chrome/browser/profiles/profile_destroyer.h" |
70 #include "chrome/browser/profiles/profile_metrics.h" | 70 #include "chrome/browser/profiles/profile_metrics.h" |
71 #include "chrome/browser/profiles/profile_statistics.h" | |
71 #include "chrome/browser/profiles/profiles_state.h" | 72 #include "chrome/browser/profiles/profiles_state.h" |
72 #include "chrome/browser/repost_form_warning_controller.h" | 73 #include "chrome/browser/repost_form_warning_controller.h" |
73 #include "chrome/browser/search/search.h" | 74 #include "chrome/browser/search/search.h" |
74 #include "chrome/browser/sessions/session_restore.h" | 75 #include "chrome/browser/sessions/session_restore.h" |
75 #include "chrome/browser/sessions/session_service.h" | 76 #include "chrome/browser/sessions/session_service.h" |
76 #include "chrome/browser/sessions/session_service_factory.h" | 77 #include "chrome/browser/sessions/session_service_factory.h" |
77 #include "chrome/browser/sessions/session_tab_helper.h" | 78 #include "chrome/browser/sessions/session_tab_helper.h" |
78 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 79 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
79 #include "chrome/browser/ssl/security_state_model.h" | 80 #include "chrome/browser/ssl/security_state_model.h" |
80 #include "chrome/browser/sync/profile_sync_service.h" | 81 #include "chrome/browser/sync/profile_sync_service.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 SessionService* session_service = | 508 SessionService* session_service = |
508 SessionServiceFactory::GetForProfile(profile_); | 509 SessionServiceFactory::GetForProfile(profile_); |
509 if (session_service) | 510 if (session_service) |
510 session_service->WindowClosed(session_id_); | 511 session_service->WindowClosed(session_id_); |
511 | 512 |
512 sessions::TabRestoreService* tab_restore_service = | 513 sessions::TabRestoreService* tab_restore_service = |
513 TabRestoreServiceFactory::GetForProfile(profile()); | 514 TabRestoreServiceFactory::GetForProfile(profile()); |
514 if (tab_restore_service) | 515 if (tab_restore_service) |
515 tab_restore_service->BrowserClosed(live_tab_context()); | 516 tab_restore_service->BrowserClosed(live_tab_context()); |
516 | 517 |
518 if (!chrome::GetTotalBrowserCountForProfile(profile_)) { | |
517 #if !defined(OS_MACOSX) | 519 #if !defined(OS_MACOSX) |
518 if (!chrome::GetTotalBrowserCountForProfile(profile_)) { | |
519 // We're the last browser window with this profile. We need to nuke the | 520 // We're the last browser window with this profile. We need to nuke the |
520 // TabRestoreService, which will start the shutdown of the | 521 // TabRestoreService, which will start the shutdown of the |
521 // NavigationControllers and allow for proper shutdown. If we don't do this | 522 // NavigationControllers and allow for proper shutdown. If we don't do this |
522 // chrome won't shutdown cleanly, and may end up crashing when some | 523 // chrome won't shutdown cleanly, and may end up crashing when some |
523 // thread tries to use the IO thread (or another thread) that is no longer | 524 // thread tries to use the IO thread (or another thread) that is no longer |
524 // valid. | 525 // valid. |
525 // This isn't a valid assumption for Mac OS, as it stays running after | 526 // This isn't a valid assumption for Mac OS, as it stays running after |
526 // the last browser has closed. The Mac equivalent is in its app | 527 // the last browser has closed. The Mac equivalent is in its app |
527 // controller. | 528 // controller. |
528 TabRestoreServiceFactory::ResetForProfile(profile_); | 529 TabRestoreServiceFactory::ResetForProfile(profile_); |
530 #endif | |
531 | |
532 // Store statistics into ProfileInfoCache | |
Mike Lerman
2015/11/03 20:50:42
nit: amend a period. Although this comment isn't n
lwchkg
2015/11/04 00:11:07
Acknowledged.
| |
533 profiles::StoreProfileStatisticsToCache(profile_); | |
Mike Lerman
2015/11/03 20:50:42
There's a better place for this hook. Put this in
lwchkg
2015/11/04 00:11:07
Sounds good! Will check tonight.
| |
529 } | 534 } |
530 #endif | |
531 | 535 |
532 profile_pref_registrar_.RemoveAll(); | 536 profile_pref_registrar_.RemoveAll(); |
533 | 537 |
534 encoding_auto_detect_.Destroy(); | 538 encoding_auto_detect_.Destroy(); |
535 | 539 |
536 // Destroy BrowserExtensionWindowController before the incognito profile | 540 // Destroy BrowserExtensionWindowController before the incognito profile |
537 // is destroyed to make sure the chrome.windows.onRemoved event is sent. | 541 // is destroyed to make sure the chrome.windows.onRemoved event is sent. |
538 extension_window_controller_.reset(); | 542 extension_window_controller_.reset(); |
539 | 543 |
540 // Destroy BrowserInstantController before the incongnito profile is destroyed | 544 // Destroy BrowserInstantController before the incongnito profile is destroyed |
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2695 if (contents && !allow_js_access) { | 2699 if (contents && !allow_js_access) { |
2696 contents->web_contents()->GetController().LoadURL( | 2700 contents->web_contents()->GetController().LoadURL( |
2697 target_url, | 2701 target_url, |
2698 content::Referrer(), | 2702 content::Referrer(), |
2699 ui::PAGE_TRANSITION_LINK, | 2703 ui::PAGE_TRANSITION_LINK, |
2700 std::string()); // No extra headers. | 2704 std::string()); // No extra headers. |
2701 } | 2705 } |
2702 | 2706 |
2703 return contents != NULL; | 2707 return contents != NULL; |
2704 } | 2708 } |
OLD | NEW |