2020-07-06 14:14:57 -04:00
|
|
|
diff --git chrome/browser/app_controller_mac.mm chrome/browser/app_controller_mac.mm
|
2021-07-23 12:40:13 -04:00
|
|
|
index dd4c916b7581a..c27d72bf53c9b 100644
|
2020-07-06 14:14:57 -04:00
|
|
|
--- chrome/browser/app_controller_mac.mm
|
|
|
|
+++ chrome/browser/app_controller_mac.mm
|
2021-04-20 18:52:34 -04:00
|
|
|
@@ -31,6 +31,7 @@
|
2021-02-23 15:08:33 -05:00
|
|
|
#include "base/threading/scoped_blocking_call.h"
|
2021-03-04 17:36:57 -05:00
|
|
|
#include "base/threading/thread_restrictions.h"
|
2021-02-23 15:08:33 -05:00
|
|
|
#include "build/branding_buildflags.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/app/chrome_command_ids.h"
|
|
|
|
#include "chrome/browser/apps/app_shim/app_shim_manager_mac.h"
|
|
|
|
#include "chrome/browser/apps/app_shim/app_shim_termination_manager.h"
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -1339,6 +1340,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
2020-07-06 14:14:57 -04:00
|
|
|
|
|
|
|
// Run a (background) application in a new tab.
|
|
|
|
- (void)executeApplication:(id)sender {
|
|
|
|
+#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
NSInteger tag = [sender tag];
|
|
|
|
Profile* profile = [self lastProfile];
|
|
|
|
DCHECK(profile);
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -1347,6 +1349,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
2020-07-06 14:14:57 -04:00
|
|
|
tag < static_cast<int>(applications.size()));
|
|
|
|
const extensions::Extension* extension = applications.GetExtension(tag);
|
|
|
|
BackgroundModeManager::LaunchBackgroundApplication(profile, extension);
|
|
|
|
+#endif // BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Same as |-commandDispatch:|, but executes commands using a disposition
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -1702,6 +1705,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
|
|
|
[dockMenu addItem:item];
|
|
|
|
}
|
2020-07-06 14:14:57 -04:00
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
2021-07-23 12:40:13 -04:00
|
|
|
// TODO(rickcam): Mock out BackgroundApplicationListModel, then add unit tests
|
|
|
|
// which use the mock in place of the profile-initialized model.
|
|
|
|
BackgroundApplicationListModel applications(profile);
|
|
|
|
@@ -1726,6 +1730,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
|
|
|
[appMenu addItem:appItem];
|
2020-07-06 14:14:57 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+#endif // BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
|
|
|
|
return dockMenu;
|
|
|
|
}
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -1963,11 +1968,13 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
2021-02-23 15:08:33 -05:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
void UpdateProfileInUse(Profile* profile, Profile::CreateStatus status) {
|
|
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
|
|
if (status == Profile::CREATE_STATUS_INITIALIZED) {
|
|
|
|
AppController* controller =
|
|
|
|
base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
|
|
|
|
[controller windowChangedToProfile:profile];
|
|
|
|
}
|
|
|
|
+#endif // !BUILDFLAG(ENABLE_CEF)
|
|
|
|
}
|
|
|
|
|
2021-07-23 12:40:13 -04:00
|
|
|
void OpenUrlsInBrowserWithProfile(const std::vector<GURL>& urls,
|
2020-06-27 16:43:23 -04:00
|
|
|
diff --git chrome/browser/browser_process.h chrome/browser/browser_process.h
|
2021-07-23 12:40:13 -04:00
|
|
|
index a7657cb6e5d5e..d6c6f3225fcb6 100644
|
2020-06-27 16:43:23 -04:00
|
|
|
--- chrome/browser/browser_process.h
|
|
|
|
+++ chrome/browser/browser_process.h
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -198,9 +198,9 @@ class BrowserProcess {
|
2020-06-27 16:43:23 -04:00
|
|
|
virtual DownloadStatusUpdater* download_status_updater() = 0;
|
|
|
|
virtual DownloadRequestLimiter* download_request_limiter() = 0;
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
// Returns the object that manages background applications.
|
|
|
|
virtual BackgroundModeManager* background_mode_manager() = 0;
|
2021-03-04 17:36:57 -05:00
|
|
|
-#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
2020-06-27 16:43:23 -04:00
|
|
|
virtual void set_background_mode_manager_for_test(
|
|
|
|
std::unique_ptr<BackgroundModeManager> manager) = 0;
|
2021-03-04 17:36:57 -05:00
|
|
|
#endif
|
2020-06-27 16:43:23 -04:00
|
|
|
diff --git chrome/browser/browser_process_impl.cc chrome/browser/browser_process_impl.cc
|
2021-07-23 12:40:13 -04:00
|
|
|
index 1149818336011..0e454299e2622 100644
|
2020-06-27 16:43:23 -04:00
|
|
|
--- chrome/browser/browser_process_impl.cc
|
|
|
|
+++ chrome/browser/browser_process_impl.cc
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -970,18 +970,14 @@ DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
|
2020-06-27 16:43:23 -04:00
|
|
|
return download_request_limiter_.get();
|
|
|
|
}
|
|
|
|
|
2021-03-04 17:36:57 -05:00
|
|
|
-BackgroundModeManager* BrowserProcessImpl::background_mode_manager() {
|
|
|
|
#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
+BackgroundModeManager* BrowserProcessImpl::background_mode_manager() {
|
2020-06-27 16:43:23 -04:00
|
|
|
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
|
if (!background_mode_manager_)
|
|
|
|
CreateBackgroundModeManager();
|
|
|
|
return background_mode_manager_.get();
|
|
|
|
-#else
|
2021-03-04 17:36:57 -05:00
|
|
|
- return nullptr;
|
2020-06-27 16:43:23 -04:00
|
|
|
-#endif
|
|
|
|
}
|
|
|
|
|
2021-03-04 17:36:57 -05:00
|
|
|
-#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
2020-06-27 16:43:23 -04:00
|
|
|
void BrowserProcessImpl::set_background_mode_manager_for_test(
|
|
|
|
std::unique_ptr<BackgroundModeManager> manager) {
|
|
|
|
background_mode_manager_ = std::move(manager);
|
|
|
|
diff --git chrome/browser/browser_process_impl.h chrome/browser/browser_process_impl.h
|
2021-07-23 12:40:13 -04:00
|
|
|
index 2bb0b1ec912b0..2235c7b56a456 100644
|
2020-06-27 16:43:23 -04:00
|
|
|
--- chrome/browser/browser_process_impl.h
|
|
|
|
+++ chrome/browser/browser_process_impl.h
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -174,8 +174,8 @@ class BrowserProcessImpl : public BrowserProcess,
|
2020-06-27 16:43:23 -04:00
|
|
|
void SetApplicationLocale(const std::string& actual_locale) override;
|
|
|
|
DownloadStatusUpdater* download_status_updater() override;
|
|
|
|
DownloadRequestLimiter* download_request_limiter() override;
|
2021-03-04 17:36:57 -05:00
|
|
|
- BackgroundModeManager* background_mode_manager() override;
|
|
|
|
#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
+ BackgroundModeManager* background_mode_manager() override;
|
2020-06-27 16:43:23 -04:00
|
|
|
void set_background_mode_manager_for_test(
|
|
|
|
std::unique_ptr<BackgroundModeManager> manager) override;
|
2021-03-04 17:36:57 -05:00
|
|
|
#endif
|
2020-06-27 16:43:23 -04:00
|
|
|
diff --git chrome/browser/lifetime/browser_close_manager.cc chrome/browser/lifetime/browser_close_manager.cc
|
2021-07-23 12:40:13 -04:00
|
|
|
index fb05f448cb250..e94c28d492e7a 100644
|
2020-06-27 16:43:23 -04:00
|
|
|
--- chrome/browser/lifetime/browser_close_manager.cc
|
|
|
|
+++ chrome/browser/lifetime/browser_close_manager.cc
|
2021-07-23 12:40:13 -04:00
|
|
|
@@ -151,12 +151,14 @@ void BrowserCloseManager::CloseBrowsers() {
|
2020-06-27 16:43:23 -04:00
|
|
|
// exit can restore all browsers open before exiting.
|
|
|
|
ProfileManager::ShutdownSessionServices();
|
|
|
|
#endif
|
|
|
|
+#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
|
|
|
if (!browser_shutdown::IsTryingToQuit()) {
|
|
|
|
BackgroundModeManager* background_mode_manager =
|
|
|
|
g_browser_process->background_mode_manager();
|
|
|
|
if (background_mode_manager)
|
|
|
|
background_mode_manager->SuspendBackgroundMode();
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Make a copy of the BrowserList to simplify the case where we need to
|
|
|
|
// destroy a Browser during the loop.
|