-
Notifications
You must be signed in to change notification settings - Fork 15k
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 'accept' attribute in 'input' label. #2200
Conversation
5e309a9
to
04606a9
Compare
@@ -56,10 +108,13 @@ void WebDialogHelper::RunFileChooser(content::WebContents* web_contents, | |||
} | |||
|
|||
std::vector<base::FilePath> paths; | |||
auto browser_context = AtomBrowserMainParts::Get()->browser_context(); |
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 should use the browser_context of current WebContents.
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.
The current implementation relies on the PrefService
in brightray::BrowserContext
, which is aligned with Chromium's. And content::BrowserContext
doesn't has such interface.
I know current implementation will cause <input>
using the last used directory even in different WebContents, but this behavior is same with Chromium's(Chromium will share this last used directory to all WebContents in the same Profile
).
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.
The current implementation relies on the PrefService in brightray::BrowserContext, which is aligned with Chromium's. And content::BrowserContext doesn't has such interface.
We can get it from current window.
I know current implementation will cause using the last used directory even in different WebContents, but this behavior is same with Chromium's(Chromium will share this last used directory to all WebContents in the same Profile).
Chrome's Profile
is equivalent to Electron's Session
, both of them inherit from content::BrowserContext
.
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 can get it from current window.
I didn't find any APIs in NativeWindow
. 😢
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.
NativeWindow
is a WebContentsObserver so you can call web_contents()
.
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.
Actually all content::BrowserContext
created in Electron should be an AtomBrowserContext
, it is safe to call static_cast
.
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.
6c12bfe
to
21e5054
Compare
👍 |
Enable 'accept' attribute in 'input' label.
Fixes #1768, #1780.