OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <set> | 5 #include <set> |
6 | 6 |
7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 save_active_profiles = true; | 554 save_active_profiles = true; |
555 break; | 555 break; |
556 } | 556 } |
557 case chrome::NOTIFICATION_BROWSER_OPENED: { | 557 case chrome::NOTIFICATION_BROWSER_OPENED: { |
558 Browser* browser = content::Source<Browser>(source).ptr(); | 558 Browser* browser = content::Source<Browser>(source).ptr(); |
559 DCHECK(browser); | 559 DCHECK(browser); |
560 Profile* profile = browser->profile(); | 560 Profile* profile = browser->profile(); |
561 DCHECK(profile); | 561 DCHECK(profile); |
562 if (!profile->IsOffTheRecord() && ++browser_counts_[profile] == 1) { | 562 if (!profile->IsOffTheRecord() && ++browser_counts_[profile] == 1) { |
563 active_profiles_.push_back(profile); | 563 active_profiles_.push_back(profile); |
564 save_active_profiles = true; | 564 save_active_profiles = !closing_all_browsers_; |
565 } | 565 } |
566 // If browsers are opening, we can't be closing all the browsers. This | |
567 // can happen if the application was exited, but background mode or | |
568 // packaged apps prevented the process from shutting down, and then | |
569 // a new browser window was opened. | |
570 closing_all_browsers_ = false; | |
571 break; | 566 break; |
572 } | 567 } |
573 case chrome::NOTIFICATION_BROWSER_CLOSED: { | 568 case chrome::NOTIFICATION_BROWSER_CLOSED: { |
574 Browser* browser = content::Source<Browser>(source).ptr(); | 569 Browser* browser = content::Source<Browser>(source).ptr(); |
575 DCHECK(browser); | 570 DCHECK(browser); |
576 Profile* profile = browser->profile(); | 571 Profile* profile = browser->profile(); |
577 DCHECK(profile); | 572 DCHECK(profile); |
578 if (!profile->IsOffTheRecord() && --browser_counts_[profile] == 0) { | 573 if (!profile->IsOffTheRecord() && --browser_counts_[profile] == 0) { |
579 active_profiles_.erase(std::find(active_profiles_.begin(), | 574 active_profiles_.erase(std::find(active_profiles_.begin(), |
580 active_profiles_.end(), profile)); | 575 active_profiles_.end(), profile)); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 1012 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
1018 Profile* profile, | 1013 Profile* profile, |
1019 Profile::CreateStatus status) { | 1014 Profile::CreateStatus status) { |
1020 for (size_t i = 0; i < callbacks.size(); ++i) | 1015 for (size_t i = 0; i < callbacks.size(); ++i) |
1021 callbacks[i].Run(profile, status); | 1016 callbacks[i].Run(profile, status); |
1022 } | 1017 } |
1023 | 1018 |
1024 ProfileManager::ProfileInfo::~ProfileInfo() { | 1019 ProfileManager::ProfileInfo::~ProfileInfo() { |
1025 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1020 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1026 } | 1021 } |
OLD | NEW |