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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 1072193012: Revert of [Mac] AppControllerMac updates the window when a Profile is deleted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « chrome/browser/app_controller_mac.h ('k') | chrome/browser/app_controller_mac_browsertest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "chrome/browser/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 } 886 }
887 887
888 // Called from the AppControllerProfileObserver every time a profile is deleted. 888 // Called from the AppControllerProfileObserver every time a profile is deleted.
889 - (void)profileWasRemoved:(const base::FilePath&)profilePath { 889 - (void)profileWasRemoved:(const base::FilePath&)profilePath {
890 // If the lastProfile has been deleted, the profile manager has 890 // If the lastProfile has been deleted, the profile manager has
891 // already loaded a new one, so the pointer needs to be updated; 891 // already loaded a new one, so the pointer needs to be updated;
892 // otherwise we will try to start up a browser window with a pointer 892 // otherwise we will try to start up a browser window with a pointer
893 // to the old profile. 893 // to the old profile.
894 // In a browser test, the application is not brought to the front, so 894 // In a browser test, the application is not brought to the front, so
895 // |lastProfile_| might be null. 895 // |lastProfile_| might be null.
896 if (!lastProfile_ || profilePath == lastProfile_->GetPath()) { 896 if (!lastProfile_ || profilePath == lastProfile_->GetPath())
897 // Force windowChangedToProfile: to set the lastProfile_ and also update the 897 lastProfile_ = g_browser_process->profile_manager()->GetLastUsedProfile();
898 // relevant menuBridge objects.
899 lastProfile_ = nullptr;
900 [self windowChangedToProfile:g_browser_process->profile_manager()->
901 GetLastUsedProfile()];
902 }
903 898
904 auto it = profileBookmarkMenuBridgeMap_.find(profilePath); 899 auto it = profileBookmarkMenuBridgeMap_.find(profilePath);
905 if (it != profileBookmarkMenuBridgeMap_.end()) { 900 if (it != profileBookmarkMenuBridgeMap_.end()) {
906 delete it->second; 901 delete it->second;
907 profileBookmarkMenuBridgeMap_.erase(it); 902 profileBookmarkMenuBridgeMap_.erase(it);
908 } 903 }
909 } 904 }
910 905
911 // Returns true if there is a modal window (either window- or application- 906 // Returns true if there is a modal window (either window- or application-
912 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth 907 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 } 1542 }
1548 1543
1549 - (const std::vector<GURL>&)startupUrls { 1544 - (const std::vector<GURL>&)startupUrls {
1550 return startupUrls_; 1545 return startupUrls_;
1551 } 1546 }
1552 1547
1553 - (BookmarkMenuBridge*)bookmarkMenuBridge { 1548 - (BookmarkMenuBridge*)bookmarkMenuBridge {
1554 return bookmarkMenuBridge_; 1549 return bookmarkMenuBridge_;
1555 } 1550 }
1556 1551
1557 - (HistoryMenuBridge*)historyMenuBridge {
1558 return historyMenuBridge_.get();
1559 }
1560
1561 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer { 1552 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer {
1562 workAreaChangeObservers_.AddObserver(observer); 1553 workAreaChangeObservers_.AddObserver(observer);
1563 } 1554 }
1564 1555
1565 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer { 1556 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer {
1566 workAreaChangeObservers_.RemoveObserver(observer); 1557 workAreaChangeObservers_.RemoveObserver(observer);
1567 } 1558 }
1568 1559
1569 - (void)initAppShimMenuController { 1560 - (void)initAppShimMenuController {
1570 if (!appShimMenuController_) 1561 if (!appShimMenuController_)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 1703
1713 //--------------------------------------------------------------------------- 1704 //---------------------------------------------------------------------------
1714 1705
1715 namespace app_controller_mac { 1706 namespace app_controller_mac {
1716 1707
1717 bool IsOpeningNewWindow() { 1708 bool IsOpeningNewWindow() {
1718 return g_is_opening_new_window; 1709 return g_is_opening_new_window;
1719 } 1710 }
1720 1711
1721 } // namespace app_controller_mac 1712 } // namespace app_controller_mac
OLDNEW
« no previous file with comments | « chrome/browser/app_controller_mac.h ('k') | chrome/browser/app_controller_mac_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698