Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable help webui for checking update status and upgrade detector #271

Merged
merged 4 commits into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ source_set("browser_process") {
sources = [
"autocomplete/brave_autocomplete_scheme_classifier.cc",
"autocomplete/brave_autocomplete_scheme_classifier.h",
"brave_app_controller_mac.mm",
"brave_app_controller_mac.h",
"brave_browser_main_extra_parts.cc",
"brave_browser_main_extra_parts.h",
"brave_browser_main_parts_mac.mm",
"brave_browser_main_parts_mac.h",
"brave_browser_process_impl.cc",
"brave_browser_process_impl.h",
"brave_local_state_prefs.cc",
Expand Down Expand Up @@ -40,8 +40,9 @@ source_set("browser_process") {
"importer/browser_profile_lock.h",
"importer/chrome_profile_lock.cc",
"importer/chrome_profile_lock.h",
"sparkle_glue_mac.mm",
"sparkle_glue_mac.h",
"mac/sparkle_glue.mm",
"mac/sparkle_glue.h",
"mac/su_updater.h",
"update_util.cc",
"update_util.h",
"version_info_values.cc",
Expand Down
18 changes: 0 additions & 18 deletions browser/brave_app_controller_mac.h

This file was deleted.

129 changes: 0 additions & 129 deletions browser/brave_app_controller_mac.mm

This file was deleted.

20 changes: 20 additions & 0 deletions browser/brave_browser_main_parts_mac.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* 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_BRAVE_BROWSER_MAIN_PARTS_MAC_H_
#define BRAVE_BROWSER_BRAVE_BROWSER_MAIN_PARTS_MAC_H_

#include "chrome/browser/chrome_browser_main_mac.h"

class BraveBrowserMainPartsMac : public ChromeBrowserMainPartsMac {
public:
using ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac;
~BraveBrowserMainPartsMac() override = default;

private:
// ChromeBrowserMainPartsMac overrides:
void PreMainMessageLoopStart() override;
};

#endif // BRAVE_BROWSER_BRAVE_BROWSER_MAIN_PARTS_MAC_H_
14 changes: 14 additions & 0 deletions browser/brave_browser_main_parts_mac.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* 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/brave_browser_main_parts_mac.h"

#import "brave/browser/mac/sparkle_glue.h"

void BraveBrowserMainPartsMac::PreMainMessageLoopStart() {
ChromeBrowserMainPartsMac::PreMainMessageLoopStart();

// It would be no-op if udpate is disabled.
[[SparkleGlue sharedSparkleGlue] registerWithSparkle];
}
79 changes: 79 additions & 0 deletions browser/mac/sparkle_glue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* 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_MAC_SPARKLE_GLUE_H_
#define BRAVE_BROWSER_MAC_SPARKLE_GLUE_H_

#include "base/strings/string16.h"

#if defined(__OBJC__)

#import <Foundation/Foundation.h>

// Possible outcomes of various operations. A version may accompany some of
// these, but beware: a version is never required. For statuses that can be
// accompanied by a version, the comment indicates what version is referenced.
// A notification posted containing an asynchronous status will always be
// followed by a notification with a terminal status.
enum AutoupdateStatus {
kAutoupdateNone = 0, // no version (initial state only)
kAutoupdateRegistering, // no version (asynchronous operation in progress)
kAutoupdateRegistered, // no version
kAutoupdateChecking, // no version (asynchronous operation in progress)
kAutoupdateCurrent, // version of the running application
kAutoupdateAvailable, // version of the update that is available
kAutoupdateInstalling, // no version (asynchronous operation in progress)
kAutoupdateInstalled, // version of the update that was installed
kAutoupdateRegisterFailed, // no version
kAutoupdateCheckFailed, // no version
kAutoupdateInstallFailed, // no version
};

// kBraveAutoupdateStatusNotification is the name of the notification posted
// when -checkForUpdate and -installUpdate complete. This notification will be
// sent with with its sender object set to the SparkleGlue instance sending
// the notification. Its userInfo dictionary will contain an AutoupdateStatus
// value as an intValue at key kBraveAutoupdateStatusStatus. If a version is
// available (see AutoupdateStatus), it will be present at key
// kBraveAutoupdateStatusVersion. If any error messages were supplied by
// Sparkle, they will be present at key kBraveAutoupdateStatusErrorMessages.
extern NSString* const kBraveAutoupdateStatusNotification;
extern NSString* const kBraveAutoupdateStatusStatus;
extern NSString* const kBraveAutoupdateStatusVersion;
extern NSString* const kBraveAutoupdateStatusErrorMessages;

@interface SparkleGlue : NSObject

+ (instancetype)sharedSparkleGlue;

- (instancetype)init;

- (void)registerWithSparkle;

- (void)checkForUpdates;

- (AutoupdateStatus)recentStatus;
- (NSNotification*)recentNotification;

// Returns YES if an asynchronous operation is pending: if an update check or
// installation attempt is currently in progress.
- (BOOL)asyncOperationPending;

// Returns YES if the application is running from a read-only filesystem,
// such as a disk image.
- (BOOL)isOnReadOnlyFilesystem;

@end // @interface SparkleGlue

#endif // __OBJC__

namespace sparkle_glue {

bool SparkleEnabled();

base::string16 CurrentlyInstalledVersion();

} // namespace sparkle_glue

#endif // BRAVE_BROWSER_MAC_SPARKLE_GLUE_H_
Loading