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

Use callback dialog methods in RunFileChooser #8745

Merged
merged 5 commits into from Feb 24, 2017

Conversation

kevinsawicki
Copy link
Contributor

@kevinsawicki kevinsawicki commented Feb 23, 2017

This pull request switches the open and save dialogs opened in WebDialogHelper::RunFileChooser to be callback-based instead of synchronous.

Inspired by https://cs.chromium.org/chromium/src/chrome/browser/file_select_helper.h

  • Manually test on macOS
  • Manually test on Windows
  • Manually test on Linux

Closes #8457

@kevinsawicki kevinsawicki changed the title [WIP] Use callback dialog methods in RunFileChooser Use callback dialog methods in RunFileChooser Feb 23, 2017
@@ -26,6 +28,94 @@

namespace {

class FileSelectHelper : public base::RefCountedThreadSafe<
Copy link
Member

Choose a reason for hiding this comment

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

this can be just base::RefCounted, I don't see this class being used across threads. Also its good practice to make destructor private for ref counted classes.


void ShowOpenDialog(const file_dialog::DialogSettings& settings) {
auto callback = base::Bind(&FileSelectHelper::OnOpenDialogDone,
base::Unretained(this));
Copy link
Member

Choose a reason for hiding this comment

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

its not necessary for unretained wrapper since its ref counted, same with other bind call.

@kevinsawicki
Copy link
Contributor Author

Thanks @deepak1556 for taking a look at this 👍

@@ -16,7 +16,9 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
Copy link
Member

Choose a reason for hiding this comment

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

Minor change, this header is not used.

@kevinsawicki kevinsawicki merged commit 5819acb into master Feb 24, 2017
@kevinsawicki kevinsawicki deleted the async-web-dialog-helper branch February 24, 2017 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants