-
Notifications
You must be signed in to change notification settings - Fork 109
Add cryptotokenPrivate and device support (hid and usb) for U2F #268
Conversation
@@ -17,7 +17,21 @@ binding.registerCustomHook(function (bindingsAPI, extensionId) { | |||
}) | |||
|
|||
apiFunctions.setHandleRequest('get', function (windowId, getInfo, cb) { | |||
console.warn('chrome.windows.get is not supported yet') | |||
if (arguments.length === 1) { |
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 actually don't need all of these checks becausesetHandleRequest
normalizes the arguments
getInfo = arguments[1] | ||
cb = arguments[2] | ||
} | ||
var responseId = ++id |
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.
we've moved away from using ++id
because it can produce duplicate requests across multiple windows. See tabs_bindings.js
for usage of ipc.guid()
3046d71
to
3a372c8
Compare
BUILD.gn
Outdated
@@ -121,6 +122,7 @@ repack("packed_extra_resources") { | |||
":atom_resources", | |||
":brave_resources", | |||
"app:brave_strings", | |||
"//chrome/browser/resources:component_extension_resources_grit", |
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.
shouldn't think be //chrome/browser/resources:component_extension_resources
? I don't see a target for component_extension_resources_grit
AtomComponentExtensionResourceManager:: | ||
~AtomComponentExtensionResourceManager() {} | ||
|
||
bool AtomComponentExtensionResourceManager::IsComponentExtensionResource( |
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 this code looks identical to ChromeComponentExtensionResourceManager
. We want to avoid copying chrome code so can you subclass 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.
I don't think I can subclass since AddComponentResourceEntries
and path_to_resource_id_
are private
chromium_src/BUILD.gn
Outdated
"//chrome/browser/extensions/event_router_forwarder.cc", | ||
"//chrome/browser/extensions/event_router_forwarder.h", | ||
"//chrome/browser/extensions/window_controller.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.
this looks like a potential problem to me because along with windows_util above. None of these methods will work correctly with our code so anything that uses them will get the wrong result. I think we need to look at the usage and possibly override with our own implementation
lib/browser/api/extensions.js
Outdated
@@ -603,6 +603,28 @@ var windowInfo = function (win, populateTabs) { | |||
} | |||
} | |||
|
|||
ipcMain.on('chrome-windows-get', function (evt, responseId, windowId, getInfo) { |
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 a rebase issue? Doesn't seem related
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.
chrome.windows.get
is needed by the cryptotoken
extension, thus I implemented it
What are the next steps @evq ? |
@alexwykoff |
@bridiver apologies for the long hiatus on this one... finally got some time to rebase, finish addressing your comments and test! the primary change avoids copying a bunch of code from |
@@ -310,6 +310,8 @@ source_set("browser") { | |||
"extensions/api/atom_extensions_api_client.h", | |||
"extensions/atom_browser_client_extensions_part.cc", | |||
"extensions/atom_browser_client_extensions_part.h", | |||
"extensions/atom_component_extensions.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.
since this uses brave_resources.h we need to add a dep for brave_resources
here too
atom/browser/BUILD.gn
Outdated
@@ -306,6 +308,8 @@ source_set("browser") { | |||
} | |||
|
|||
if (enable_extensions) { | |||
data_deps += [ "//electron:brave_resources" ] |
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.
@bridiver is this the right way to address your previous comment re: the missing brave_resources.h
dependency? wasn't sure since it is generated and I'm not particularly familiar with GN
return NULL; | ||
|
||
int resource_id; | ||
if (!IsComponentExtension(path, &resource_id)) { |
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 we use IsComponentExtensionResource here instead? IsComponentExtension
is a bit misleading because we have component extensions that are not loaded from resource paks
@@ -19,6 +20,8 @@ MuonBrowserProcessImpl::MuonBrowserProcessImpl( | |||
const base::CommandLine& command_line) : | |||
BrowserProcessImpl(local_state_task_runner, command_line) { | |||
g_browser_process = this; | |||
|
|||
device_client_.reset(new ChromeDeviceClient); |
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 should actually go in chromium_src browser_process_impl.cc
the muon subclass is for muon-specific stuff
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 do a follow-up with the minor remaining changes
Add cryptotokenPrivate and device support (hid and usb) for U2F
This PR contains the following changes required to enable u2f support:
chrome.hid
andchrome.usb
apischrome.windows.get
which is used by the cryptotoken extensionchrome.cryptotokenPrivate
extension apiI have tested these changes on linux, mac and windows.