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

Add Brave geolocations and system network redirect #19

Merged
merged 1 commit into from
Jan 14, 2018

Conversation

bbondy
Copy link
Member

@bbondy bbondy commented Jan 12, 2018

@bbondy bbondy self-assigned this Jan 12, 2018
@bbondy bbondy requested a review from bridiver January 12, 2018 04:41
common/BUILD.gn Outdated
@@ -1,4 +1,7 @@
source_set("common") {
#public_configs = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


component("geolocation") {
defines = [ "DEVICE_GEOLOCATION_IMPLEMENTATION" ]
+ configs += [ "//brave/build/geolocation" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file already in the repo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I just forgot to add it to git, will push it out in a sec.

* 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_COMMON_GOOGLE_API_KEY_H_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually need this file? We could just do a define in the gn config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gn only sounds good, this is the way it was in muon so just used that.


-const char kNetworkLocationBaseUrl[] =
- "https://www.googleapis.com/geolocation/v1/geolocate";
+const char kNetworkLocationBaseUrl[] = GOOGLEAPIS_ENDPOINT;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the define must already be in the config? I think the google_api_key header was just leftover from electron and never got removed from muon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's in the build config which I'll push up.

@bbondy bbondy force-pushed the geolocations-master branch 4 times, most recently from f2f2349 to a2ee013 Compare January 12, 2018 18:59
@bbondy
Copy link
Member Author

bbondy commented Jan 12, 2018

@bridiver ready for re-review, the only patch now is to use the brave network delegate for system requests.

@bbondy bbondy changed the title Add Brave geolocations support for our build config Jan 13, 2018
@bbondy bbondy changed the title Add Brave geolocations support and system network redirect support Jan 13, 2018
@bbondy
Copy link
Member Author

bbondy commented Jan 13, 2018

Ready for review again, this creates a different network delegate for system and profile and uses a common base class so we can chain different work items in each.

std::shared_ptr<OnBeforeURLRequestContext> ctx) {

base::StringPiece value(request->url().spec());
if (value.starts_with("https://www.googleapis.com/geolocation/v1/geolocate?key=")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ok, but I think you might want to use URLPattern here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do


base::StringPiece value(request->url().spec());
if (value.starts_with("https://www.googleapis.com/geolocation/v1/geolocate?key=")) {
*new_url = GURL(GOOGLEAPIS_ENDPOINT GOOGLEAPIS_API_KEY);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our key should be correct because that's set in one of the delegates

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer set the key because it's not needed, so no harm to do it here.

"brave_httpse_network_delegate_work.h",
"brave_profile_network_delegate.cc",
"brave_profile_network_delegate.h",
"brave_static_redirect_network_delegate_work.cc",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change to _helper mainly it is not a delegate itself but just a function that's stored as a callback in a vector to execute.

bridiver
bridiver previously approved these changes Jan 13, 2018
Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

GURL* new_url,
const ResponseCallback& next_callback,
std::shared_ptr<OnBeforeURLRequestContext> ctx);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we must be missing lint checking?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still don't have lint checking

@bsclifton bsclifton deleted the geolocations-master branch June 18, 2018 06:25
NejcZdovc pushed a commit that referenced this pull request Dec 10, 2018
Fix for no unsignedTx object on reconcile
bbondy added a commit that referenced this pull request Feb 18, 2019
Add settings for cookies and referrer blocking
fmarier pushed a commit that referenced this pull request Oct 29, 2019
* Add dockerfile for building

* Update Dockerfile and README
@stephendonner stephendonner mentioned this pull request Feb 21, 2023
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants