chore: remove ancient Browser::Focus implementation on Windows (#27279)
This commit is contained in:
parent
0599487e65
commit
cd42933f41
3 changed files with 12 additions and 29 deletions
|
@ -64,6 +64,18 @@ Browser* Browser::Get() {
|
||||||
return ElectronBrowserMainParts::Get()->browser();
|
return ElectronBrowserMainParts::Get()->browser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(OS_WIN) || defined(OS_LINUX)
|
||||||
|
void Browser::Focus(gin::Arguments* args) {
|
||||||
|
// Focus on the first visible window.
|
||||||
|
for (auto* const window : WindowList::GetWindows()) {
|
||||||
|
if (window->IsVisible()) {
|
||||||
|
window->Focus(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Browser::Quit() {
|
void Browser::Quit() {
|
||||||
if (is_quiting_)
|
if (is_quiting_)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -84,16 +84,6 @@ bool SetDefaultWebClient(const std::string& protocol) {
|
||||||
return ran_ok && exit_code == EXIT_SUCCESS;
|
return ran_ok && exit_code == EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::Focus(gin::Arguments* args) {
|
|
||||||
// Focus on the first visible window.
|
|
||||||
for (auto* const window : WindowList::GetWindows()) {
|
|
||||||
if (window->IsVisible()) {
|
|
||||||
window->Focus(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Browser::AddRecentDocument(const base::FilePath& path) {}
|
void Browser::AddRecentDocument(const base::FilePath& path) {}
|
||||||
|
|
||||||
void Browser::ClearRecentDocuments() {}
|
void Browser::ClearRecentDocuments() {}
|
||||||
|
|
|
@ -43,19 +43,6 @@ namespace electron {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
|
|
||||||
DWORD target_process_id = *reinterpret_cast<DWORD*>(param);
|
|
||||||
DWORD process_id = 0;
|
|
||||||
|
|
||||||
GetWindowThreadProcessId(hwnd, &process_id);
|
|
||||||
if (process_id == target_process_id) {
|
|
||||||
SetFocus(hwnd);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetProcessExecPath(base::string16* exe) {
|
bool GetProcessExecPath(base::string16* exe) {
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
if (!base::PathService::Get(base::FILE_EXE, &path)) {
|
if (!base::PathService::Get(base::FILE_EXE, &path)) {
|
||||||
|
@ -292,12 +279,6 @@ Browser::UserTask::UserTask() = default;
|
||||||
Browser::UserTask::UserTask(const UserTask&) = default;
|
Browser::UserTask::UserTask(const UserTask&) = default;
|
||||||
Browser::UserTask::~UserTask() = default;
|
Browser::UserTask::~UserTask() = default;
|
||||||
|
|
||||||
void Browser::Focus(gin::Arguments* args) {
|
|
||||||
// On Windows we just focus on the first window found for this process.
|
|
||||||
DWORD pid = GetCurrentProcessId();
|
|
||||||
EnumWindows(&WindowsEnumerationHandler, reinterpret_cast<LPARAM>(&pid));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetFileIcon(const base::FilePath& path,
|
void GetFileIcon(const base::FilePath& path,
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
base::CancelableTaskTracker* cancelable_task_tracker_,
|
base::CancelableTaskTracker* cancelable_task_tracker_,
|
||||||
|
|
Loading…
Reference in a new issue