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 #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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |