-
Notifications
You must be signed in to change notification settings - Fork 893
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
Integrate Brave omaha #109
Conversation
0e71e58
to
12564dd
Compare
4e7777a
to
3aa703a
Compare
6587bdc
to
0c13a11
Compare
+#if defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD) | ||
+// Reflect brave branded-omaha variable name. | ||
+// Company name(BraveSoftware) + Product name(Update). | ||
+const char kGoogleUpdateIsMachineEnvVar[] = "BraveSoftwareUpdateIsMachine"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessary? I think it would be better to have consistent behavior for this env var with Chrome
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This var name comes from omaha.
To customize omaha for brave, company name should be changed to BraveSoftware
because it is related with install directory. Then omaha makes env var by using it.
So, I think we should follow omaha var name in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be done with the later string substitution method.
+const wchar_t kGoogleUpdatePoliciesKey[] = | ||
+ L"SOFTWARE\\Policies\\BraveSoftware\\Update"; | ||
+const wchar_t kCheckPeriodOverrideMinutes[] = L"AutoUpdateCheckPeriodMinutes"; | ||
+const wchar_t kUpdatePolicyValue[] = L"UpdateDefault"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of these values look identical to the google versions. Seems like it would be better to use the undefine/redefine override. @bbondy can help with that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it good way to use def/undef override for variable change?
I think the result would be same with the copying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const overriding should work just like method overriding. same def/undef applies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would the result be the same as copying if we're only changing some of the values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I referred browser_about_handler.cc
in chromium_src
.
In that file, upstream method name was changed and reused with additional implementation(FixupBrowserAboutURLBraveImpl
).
I don't know how to adopt this technique to this file w/o changing functions implementation in this file.
Do you mean variable like re-define kGoogleUpdatePoliciesKey
to kGoogleUpdatePoliciesKey_ChromiumImpl
?
I think I don't know how to adopt undefine/redefine technique here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but whether we patch or do something else, we only need the values we are overriding. We should not include things like kCheckPeriodOverrideMinutes or kCheckPeriodOverrideMinutesMax that we are not changing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does that work correctly? It doesn't seem like it would
It doesn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to apply override technique like this (b23256e) to other files in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, it won't work if they're in an anonymous namespace like that. There's not way to reference/override them afaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll revert b23256e to patch, and will try override to non-anonymous symbols.
using installer::InstallationState; | ||
|
||
const wchar_t GoogleUpdateSettings::kPoliciesKey[] = | ||
+#if defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as below undefine/redefine override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you advice how to override variable? I still don't have any idea how to do it with separate file in chormium_src
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's difficult to use override technique to member var/method.
I tried to override ClassA::MethodA
, in new class_a.cc
in chromium_src
like below.
#define MethodA MethodA_ChromiumImpl
#include ".../class_a.cc"
#undef MethodA
void ClassA::MethodA() {
...
}
Compiler will complain like this error: no member named MethodA in ClassA
.
I think the reason is header file(class_a.h) included in this file was also affected by macro.
So, there is no MethodA
in this file.
Overriding member variable will have same error.
@bbondy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replied below.
diff --git a/chrome/installer/mini_installer/appid.h b/chrome/installer/mini_installer/appid.h | ||
index c408242814504aae086fc332f0d8bbd7872821a2..deadf14c9c8a17d7d83fcf3428cd3734a92d70b1 100644 | ||
--- a/chrome/installer/mini_installer/appid.h | ||
+++ b/chrome/installer/mini_installer/appid.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we modifying this when we already have brave_appid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
appid.h is copied into chromium_src.
"mini_installer.h", | ||
"mini_installer.rc", | ||
- "mini_installer_constants.cc", | ||
+ "//brave/installer/mini_installer/mini_installer_constants.cc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are replacing the entire file it's better to use chromium_src
which will work automatically without any patching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
mini_installer_constants.cc
is moved into chromium_src
.
|
||
const GoogleUpdateSettings::UpdatePolicy | ||
GoogleUpdateSettings::kDefaultUpdatePolicy = | ||
-#if defined(GOOGLE_CHROME_BUILD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we doing this for all GOOGLE_CHROME_BUILD
guards in this file? If so it would be easier to just define GOOGLE_CHROME_BUILD if BRAVE_CHROMIUM_BUILD && OFFICIAL_BUILD and then undef at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worrying about that situation when upstream add more GOOGLE_CHROME_BUILD
guard in this file and it isn't related with brave. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't the reverse just as likely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with #define GOOGLE_CHROME_BUILD
} | ||
|
||
std::string GoogleChromeDistribution::GetSafeBrowsingName() { | ||
+#if defined(BRAVE_CHROMIUM_BUILD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted.
return base::ReplaceStringPlaceholders(url, language, NULL); | ||
} | ||
|
||
+// TODO(simonhong): Use brave's url. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't patch for comments. Open a ticket instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted.
|
||
-#if defined(GOOGLE_CHROME_BUILD) | ||
+#if defined(GOOGLE_CHROME_BUILD) || (defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD)) | ||
dist = GetOrCreateBrowserDistribution<GoogleChromeDistribution>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we just patch here to create a BraveDistribution and get rid of most of the patches below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After addressing your review, all modification of GoogleChromeDistribution
is gone.
So, just enabling this seems fine instead of creating BraveDistribution
because we are using GoogleChromeDistribution
w/o any change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
return std::wstring(L"Software\\").append(product); | ||
} | ||
|
||
+#if defined(BRAVE_CHROMIUM_BUILD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
override with undefine/redefine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't do for functions that are used by other functions in the same file.
Also, this is in anonymous namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do it for functions that are used by other functions in the same file, but you would also have to do the functions that use that function. You can just only do the functions that use that function I think in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comment for the record.
This is the reason why patching technique is used instead of overriding in this case.
In case of install_modes.cc
, override technique causes modifying all functions in that file and can't reuse upstream functions. It is similar to copying technique.
IMO, patching technique is more better to copying for future rebase.
I thought def/undef technique is only useful when we can re-use upstream implementation
"webui/settings/incompatible_applications_handler_win.h", | ||
] | ||
deps += [ "//google_update" ] | ||
+ } else if (brave_chromium_build && is_official_build) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we just add these in our own gn file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,5747 @@ | |||
|
|||
|
|||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this file generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the build, midl.py
generates these file in temp directory and compares it with pre-installed version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then why are we copying the output? Shouldn't we be modifying the inputs so we get the correct output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifying input files in src/third_party/win_bulid_output
causes creating a lot of patch files.
So, I decided to use copying from our directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brave/brave-browser#303 handles this.
Enable Omaha connection with UpgradeDetector and VersionUpdater. Also, guids and registry pathes are changed to use brave branding.
TODO: uninstall survey url should be changed.
Our pre-generated midl files are copied to overwrite upstream pre-installed midl files.
Moves the IDL file into chromium_src, patches BUILD.gn to use chromium_src override. IDL output rebuilt at `./src` directory using `python3 ./tools/win/update_idl.py` I used #109 as a guide
Moves the IDL file into chromium_src, patches BUILD.gn to use chromium_src override. IDL output rebuilt at `./src` directory using `python3 ./tools/win/update_idl.py` Using #109 as a guide Also includes `.gitattributes` fix which prevents differences found w/ filecmp.cmpfiles in MIDL compilation.
Moves the IDL file into chromium_src, patches BUILD.gn to use chromium_src override. IDL output rebuilt at `./src` directory using `python3 ./tools/win/update_idl.py` Using #109 as a guide Also includes `.gitattributes` fix which prevents differences found w/ filecmp.cmpfiles in MIDL compilation.
Moves the IDL file into chromium_src, patches BUILD.gn to use chromium_src override. IDL output rebuilt at `./src` directory using `python3 ./tools/win/update_idl.py` Using #109 as a guide Also includes `.gitattributes` fix which prevents differences found w/ filecmp.cmpfiles in MIDL compilation.
Moves the IDL file into chromium_src, patches BUILD.gn to use chromium_src override. IDL output rebuilt at `./src` directory using `python3 ./tools/win/update_idl.py` Using #109 as a guide Also includes `.gitattributes` fix which prevents differences found w/ filecmp.cmpfiles in MIDL compilation.
Moves the IDL file into chromium_src, patches BUILD.gn to use chromium_src override. IDL output rebuilt at `./src` directory using `python3 ./tools/win/update_idl.py` Using #109 as a guide Also includes `.gitattributes` fix which prevents differences found w/ filecmp.cmpfiles in MIDL compilation.
Testing with https://github.com/brave/omaha
When refresh
settings/help
, BraveUpdate.exe process runs and terminated.Work together with brave/brave-browser#303.
Closes: brave/brave-browser#179
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist: