Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

use chromium file chooser #361

Merged
merged 5 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/mac/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ mac_framework_bundle("electron_framework") {
"//electron:electron_framework_resources",
"//build/config:exe_and_shlib_deps",
":electron_xibs",
"//chrome/app/nibs:localizer_table",
]

ldflags = [
Expand Down Expand Up @@ -343,6 +344,7 @@ config("external_binaries_config") {
mac_xib_bundle_data("electron_xibs") {
sources = [
"resources/MainMenu.xib",
"//chrome/app/nibs/SaveAccessoryView.xib",
]
}

Expand Down
2 changes: 0 additions & 2 deletions atom/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ source_set("browser") {
"web_contents_permission_helper.h",
"web_contents_preferences.cc",
"web_contents_preferences.h",
"web_dialog_helper.cc",
"web_dialog_helper.h",
"window_list.cc",
"window_list.h",
"window_list_observer.h",
Expand Down
2 changes: 0 additions & 2 deletions atom/browser/atom_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ std::vector<std::string> AtomBrowserContext::GetCookieableSchemes() {
}

void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
pref_registry->RegisterFilePathPref(prefs::kSelectFileLastDirectory,
base::FilePath());
// moved to user_prefs in brave_browser_context
pref_registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
base::FilePath());
Expand Down
10 changes: 3 additions & 7 deletions atom/browser/common_web_contents_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
#include "atom/browser/native_window.h"
#include "atom/browser/ui/file_dialog.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_dialog_helper.h"
#include "atom/common/atom_constants.h"
#include "base/files/file_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brave/browser/brave_javascript_dialog_manager.h"
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
Expand Down Expand Up @@ -278,17 +278,13 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser(
void CommonWebContentsDelegate::RunFileChooser(
content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) {
if (!web_dialog_helper_)
web_dialog_helper_.reset(new WebDialogHelper(owner_window()));
web_dialog_helper_->RunFileChooser(render_frame_host, params);
FileSelectHelper::RunFileChooser(render_frame_host, params);
}

void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest,
int request_id,
const base::FilePath& path) {
if (!web_dialog_helper_)
web_dialog_helper_.reset(new WebDialogHelper(owner_window()));
web_dialog_helper_->EnumerateDirectory(guest, request_id, path);
FileSelectHelper::EnumerateDirectory(guest, request_id, path);
}

void CommonWebContentsDelegate::EnterFullscreenModeForTab(
Expand Down
2 changes: 0 additions & 2 deletions atom/browser/common_web_contents_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace atom {

class AtomBrowserContext;
class NativeWindow;
class WebDialogHelper;

class CommonWebContentsDelegate
: public content::WebContentsDelegate,
Expand Down Expand Up @@ -144,7 +143,6 @@ class CommonWebContentsDelegate
// Whether window is fullscreened by window api.
bool native_fullscreen_;

std::unique_ptr<WebDialogHelper> web_dialog_helper_;
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;

// Make sure BrowserContext is alwasys destroyed after WebContents.
Expand Down
222 changes: 0 additions & 222 deletions atom/browser/web_dialog_helper.cc

This file was deleted.

45 changes: 0 additions & 45 deletions atom/browser/web_dialog_helper.h

This file was deleted.

9 changes: 9 additions & 0 deletions brave/browser/brave_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,15 @@ BraveBrowserContext::GetIOTaskRunner() {
GetPath(), BrowserThread::GetBlockingPool());
}

base::FilePath BraveBrowserContext::last_selected_directory() {
return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
}

void BraveBrowserContext::set_last_selected_directory(
const base::FilePath& path) {
GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path);
}

} // namespace brave

namespace atom {
Expand Down
2 changes: 2 additions & 0 deletions brave/browser/brave_browser_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class BraveBrowserContext : public Profile {
bool HasOffTheRecordProfile() override;
Profile* GetOriginalProfile() override;
bool IsSameProfile(Profile* profile) override;
base::FilePath last_selected_directory() override;
void set_last_selected_directory(const base::FilePath& path) override;

user_prefs::PrefRegistrySyncable* pref_registry() const override {
return pref_registry_.get(); }
Expand Down
Loading