-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1041 from brave/fix_relaunch_fail_after_update_on…
…_mac Fix relaunch fail after update on mac
- Loading branch information
Showing
9 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_H_ | ||
#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_H_ | ||
|
||
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | ||
|
||
class Profile; | ||
|
||
class BraveRelaunchHandler : public settings::SettingsPageUIHandler { | ||
public: | ||
BraveRelaunchHandler() = default; | ||
~BraveRelaunchHandler() override = default; | ||
|
||
private: | ||
// SettingsPageUIHandler overrides: | ||
void RegisterMessages() override; | ||
void OnJavascriptAllowed() override {} | ||
void OnJavascriptDisallowed() override {} | ||
|
||
void Relaunch(const base::ListValue* args); | ||
|
||
DISALLOW_COPY_AND_ASSIGN(BraveRelaunchHandler); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/ui/webui/settings/brave_relaunch_handler_mac.h" | ||
|
||
#include "base/bind.h" | ||
#import "brave/browser/mac/sparkle_glue.h" | ||
|
||
void BraveRelaunchHandler::RegisterMessages() { | ||
web_ui()->RegisterMessageCallback( | ||
"relaunchOnMac", | ||
base::BindRepeating(&BraveRelaunchHandler::Relaunch, | ||
base::Unretained(this))); | ||
} | ||
|
||
void BraveRelaunchHandler::Relaunch(const base::ListValue* args) { | ||
[[SparkleGlue sharedSparkleGlue] relaunch]; | ||
} |
19 changes: 19 additions & 0 deletions
19
patches/chrome-browser-resources-settings-about_page-about_page.js.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
diff --git a/chrome/browser/resources/settings/about_page/about_page.js b/chrome/browser/resources/settings/about_page/about_page.js | ||
index 70e53fcf3166560520b31ecaa906120f44e3315a..6f31f72f1d0ffe8e8add29ebe1f0027bfc7be2dc 100644 | ||
--- a/chrome/browser/resources/settings/about_page/about_page.js | ||
+++ b/chrome/browser/resources/settings/about_page/about_page.js | ||
@@ -271,7 +271,14 @@ Polymer({ | ||
|
||
/** @private */ | ||
onRelaunchTap_: function() { | ||
+ // <if expr="is_macosx"> | ||
+ // Sparkle framework's relaunch api is used. | ||
+ this.lifetimeBrowserProxy_.relaunchOnMac(); | ||
+ // </if> | ||
+ | ||
+ // <if expr="not is_macosx"> | ||
this.lifetimeBrowserProxy_.relaunch(); | ||
+ // </if> | ||
}, | ||
|
||
/** @private */ |
32 changes: 32 additions & 0 deletions
32
patches/chrome-browser-resources-settings-lifetime_browser_proxy.js.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/chrome/browser/resources/settings/lifetime_browser_proxy.js b/chrome/browser/resources/settings/lifetime_browser_proxy.js | ||
index 396539708ffed08cc0fc084fde54bba2496598fe..afa73c21c35d4ab6d54797b63a96eec993d93f73 100644 | ||
--- a/chrome/browser/resources/settings/lifetime_browser_proxy.js | ||
+++ b/chrome/browser/resources/settings/lifetime_browser_proxy.js | ||
@@ -11,6 +11,13 @@ cr.define('settings', function() { | ||
// Triggers a browser relaunch. | ||
relaunch() {} | ||
|
||
+ // <if expr="is_macosx"> | ||
+ // Use separate api for relaunch after update on Mac. | ||
+ // Chromium's relaunch api isn't compatible with sparkle framework. | ||
+ // So, sparkle framework's relaunch api is used on Mac. | ||
+ relaunchOnMac() {} | ||
+ // </if> | ||
+ | ||
// <if expr="chromeos"> | ||
// First signs out current user and then performs a restart. | ||
signOutAndRestart() {} | ||
@@ -39,6 +46,13 @@ cr.define('settings', function() { | ||
chrome.send('relaunch'); | ||
} | ||
|
||
+ // <if expr="is_macosx"> | ||
+ /** @override */ | ||
+ relaunchOnMac() { | ||
+ chrome.send('relaunchOnMac'); | ||
+ } | ||
+ // </if> | ||
+ | ||
// <if expr="chromeos"> | ||
/** @override */ | ||
signOutAndRestart() { |