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

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

Issue 1102833002: Reland: 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 lastProfile_ = g_browser_process->profile_manager()->GetLastUsedProfile(); 897 // Force windowChangedToProfile: to set the lastProfile_ and also update the
898 // relevant menuBridge objects.
899 lastProfile_ = nullptr;
900 [self windowChangedToProfile:g_browser_process->profile_manager()->
901 GetLastUsedProfile()];
902 }
898 903
899 auto it = profileBookmarkMenuBridgeMap_.find(profilePath); 904 auto it = profileBookmarkMenuBridgeMap_.find(profilePath);
900 if (it != profileBookmarkMenuBridgeMap_.end()) { 905 if (it != profileBookmarkMenuBridgeMap_.end()) {
901 delete it->second; 906 delete it->second;
902 profileBookmarkMenuBridgeMap_.erase(it); 907 profileBookmarkMenuBridgeMap_.erase(it);
903 } 908 }
904 } 909 }
905 910
906 // Returns true if there is a modal window (either window- or application- 911 // Returns true if there is a modal window (either window- or application-
907 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth 912 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 } 1547 }
1543 1548
1544 - (const std::vector<GURL>&)startupUrls { 1549 - (const std::vector<GURL>&)startupUrls {
1545 return startupUrls_; 1550 return startupUrls_;
1546 } 1551 }
1547 1552
1548 - (BookmarkMenuBridge*)bookmarkMenuBridge { 1553 - (BookmarkMenuBridge*)bookmarkMenuBridge {
1549 return bookmarkMenuBridge_; 1554 return bookmarkMenuBridge_;
1550 } 1555 }
1551 1556
1557 - (HistoryMenuBridge*)historyMenuBridge {
1558 return historyMenuBridge_.get();
1559 }
1560
1552 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer { 1561 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer {
1553 workAreaChangeObservers_.AddObserver(observer); 1562 workAreaChangeObservers_.AddObserver(observer);
1554 } 1563 }
1555 1564
1556 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer { 1565 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer {
1557 workAreaChangeObservers_.RemoveObserver(observer); 1566 workAreaChangeObservers_.RemoveObserver(observer);
1558 } 1567 }
1559 1568
1560 - (void)initAppShimMenuController { 1569 - (void)initAppShimMenuController {
1561 if (!appShimMenuController_) 1570 if (!appShimMenuController_)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 1712
1704 //--------------------------------------------------------------------------- 1713 //---------------------------------------------------------------------------
1705 1714
1706 namespace app_controller_mac { 1715 namespace app_controller_mac {
1707 1716
1708 bool IsOpeningNewWindow() { 1717 bool IsOpeningNewWindow() {
1709 return g_is_opening_new_window; 1718 return g_is_opening_new_window;
1710 } 1719 }
1711 1720
1712 } // namespace app_controller_mac 1721 } // 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