Skip to content

Commit

Permalink
Nits from review
Browse files Browse the repository at this point in the history
  • Loading branch information
spylogsster committed Jan 24, 2023
1 parent 2dce8ef commit cb5bb35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions browser/ui/webui/settings/brave_import_bulk_data_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ void BraveImportBulkDataHandler::HandleImportDataBulk(
const auto& list = args[0].GetList();
// Bulk profiles import assumes new profiles will be created on our side if
// they do not exist.
const base::Value& types = args[1];
for (const auto& it : list) {
int browser_index = it.GetInt();
importing_profiles_.insert(browser_index);
base::Value::List single_profile_args;
single_profile_args.Append(base::Value(browser_index));
single_profile_args.Append(types.Clone());
single_profile_args.Append(args[1].Clone());
BraveImportDataHandler::HandleImportData(single_profile_args);
}
}
Expand All @@ -132,14 +131,14 @@ absl::optional<int> BraveImportBulkDataHandler::GetProfileIndex(
void BraveImportBulkDataHandler::StartImport(
const importer::SourceProfile& source_profile,
uint16_t imported_items) {
if (!imported_items)
return;
// If profile is not from the bulk import request fallback to single profile
// import.
if (!GetProfileIndex(source_profile).has_value()) {
BraveImportDataHandler::StartImport(source_profile, imported_items);
return;
}
if (!imported_items)
return;
auto profile_name = source_profile.profile.empty()
? source_profile.importer_name
: source_profile.profile;
Expand Down Expand Up @@ -168,7 +167,9 @@ void BraveImportBulkDataHandler::OnImportEnded(
auto index = GetProfileIndex(source_profile);
if (index.has_value()) {
importing_profiles_.erase(index.value());
return;
}
BraveImportDataHandler::OnImportEnded(source_profile);
}

} // namespace settings
4 changes: 2 additions & 2 deletions browser/ui/webui/settings/brave_import_data_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ bool HasProperDiskAccessPermission(uint16_t imported_items) {
return true;
}
#endif // BUILDFLAG(IS_MAC)
const char kImportStatusSucceeded[] = "succeeded";
const char kImportStatusFailed[] = "failed";
constexpr char kImportStatusSucceeded[] = "succeeded";
constexpr char kImportStatusFailed[] = "failed";
} // namespace

namespace settings {
Expand Down

0 comments on commit cb5bb35

Please sign in to comment.