-
Notifications
You must be signed in to change notification settings - Fork 921
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added opportunity to make multiple import requests in parallel
- Loading branch information
1 parent
43ac272
commit 45904ff
Showing
15 changed files
with
652 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) 2022 The Brave Authors. All rights reserved. | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# 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/. | ||
|
||
source_set("unittests") { | ||
if (!is_android) { | ||
testonly = true | ||
|
||
sources = [ "brave_importer_observer_unittest.cc" ] | ||
|
||
deps = [ | ||
"//base/test:test_support", | ||
"//brave/browser/ui", | ||
"//chrome/browser", | ||
"//chrome/browser/ui", | ||
"//content/test:test_support", | ||
"//testing/gtest", | ||
] | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
browser/ui/webui/settings/brave_full_disk_access_confirm_dialog_delegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Copyright (c) 2022 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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_BROWSER_UI_WEBUI_SETTINGS_BRAVE_FULL_DISK_ACCESS_CONFIRM_DIALOG_DELEGATE_H_ | ||
#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_FULL_DISK_ACCESS_CONFIRM_DIALOG_DELEGATE_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/memory/raw_ptr.h" | ||
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | ||
|
||
namespace content { | ||
class WebContents; | ||
} // namespace content | ||
|
||
class Browser; | ||
|
||
class FullDiskAccessConfirmDialogDelegate | ||
: public TabModalConfirmDialogDelegate { | ||
public: | ||
FullDiskAccessConfirmDialogDelegate(content::WebContents* web_contents, | ||
Browser* browser); | ||
~FullDiskAccessConfirmDialogDelegate() override; | ||
|
||
FullDiskAccessConfirmDialogDelegate( | ||
const FullDiskAccessConfirmDialogDelegate&) = delete; | ||
FullDiskAccessConfirmDialogDelegate& operator=( | ||
const FullDiskAccessConfirmDialogDelegate&) = delete; | ||
|
||
private: | ||
// TabModalConfirmDialogDelegate overrides: | ||
std::u16string GetTitle() override; | ||
std::u16string GetDialogMessage() override; | ||
std::u16string GetLinkText() const override; | ||
std::u16string GetAcceptButtonTitle() override; | ||
void OnAccepted() override; | ||
void OnLinkClicked(WindowOpenDisposition disposition) override; | ||
|
||
raw_ptr<Browser> browser_; | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_FULL_DISK_ACCESS_CONFIRM_DIALOG_DELEGATE_H_ |
66 changes: 66 additions & 0 deletions
66
browser/ui/webui/settings/brave_full_disk_access_confirm_dialog_delegate_mac.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* Copyright (c) 2022 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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/. */ | ||
|
||
#include "brave/browser/ui/webui/settings/brave_full_disk_access_confirm_dialog_delegate.h" | ||
|
||
#import <AppKit/AppKit.h> | ||
|
||
#include "base/bind.h" | ||
#include "base/values.h" | ||
#include "brave/components/constants/url_constants.h" | ||
#include "brave/components/l10n/common/localization_util.h" | ||
#include "chrome/browser/importer/external_process_importer_host.h" | ||
#include "chrome/browser/ui/browser.h" | ||
#include "chrome/browser/ui/browser_tabstrip.h" | ||
#include "chrome/browser/ui/tab_modal_confirm_dialog.h" | ||
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | ||
#include "chrome/common/importer/importer_data_types.h" | ||
#include "chrome/grit/generated_resources.h" | ||
#include "content/public/browser/web_ui.h" | ||
#include "ui/base/ui_base_types.h" | ||
#include "url/gurl.h" | ||
|
||
FullDiskAccessConfirmDialogDelegate::FullDiskAccessConfirmDialogDelegate( | ||
content::WebContents* web_contents, | ||
Browser* browser) | ||
: TabModalConfirmDialogDelegate(web_contents), browser_(browser) {} | ||
|
||
FullDiskAccessConfirmDialogDelegate::~FullDiskAccessConfirmDialogDelegate() = | ||
default; | ||
|
||
std::u16string FullDiskAccessConfirmDialogDelegate::GetTitle() { | ||
return brave_l10n::GetLocalizedResourceUTF16String( | ||
IDS_FULL_DISK_ACCESS_CONFIRM_DIALOG_TITLE); | ||
} | ||
|
||
std::u16string FullDiskAccessConfirmDialogDelegate::GetDialogMessage() { | ||
return brave_l10n::GetLocalizedResourceUTF16String( | ||
IDS_FULL_DISK_ACCESS_CONFIRM_DIALOG_MESSAGE); | ||
} | ||
|
||
std::u16string FullDiskAccessConfirmDialogDelegate::GetLinkText() const { | ||
return brave_l10n::GetLocalizedResourceUTF16String( | ||
IDS_FULL_DISK_ACCESS_CONFIRM_DIALOG_LINK_TEXT); | ||
} | ||
|
||
std::u16string FullDiskAccessConfirmDialogDelegate::GetAcceptButtonTitle() { | ||
return brave_l10n::GetLocalizedResourceUTF16String( | ||
IDS_FULL_DISK_ACCESS_CONFIRM_DIALOG_OPEN_PREFS_BUTTON_TEXT); | ||
} | ||
|
||
void FullDiskAccessConfirmDialogDelegate::OnAccepted() { | ||
[[NSWorkspace sharedWorkspace] | ||
openURL:[NSURL URLWithString: | ||
@"x-apple.systempreferences:com.apple.preference." | ||
@"security?Privacy_AllFiles"]]; // NOLINT | ||
} | ||
|
||
void FullDiskAccessConfirmDialogDelegate::OnLinkClicked( | ||
WindowOpenDisposition disposition) { | ||
const int target_index = browser_->tab_strip_model()->active_index() + 1; | ||
// Add import help tab right after current settings tab. | ||
chrome::AddTabAt(browser_, GURL(kImportDataHelpURL), target_index, | ||
true /* foreground */); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.