This repository has been archived by the owner on Jan 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix brave/browser-laptop#8849 Auditors: @bridiver, @bbondy
- Loading branch information
Showing
8 changed files
with
81 additions
and
12 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
31 changes: 31 additions & 0 deletions
31
brave/browser/importer/brave_external_process_importer_host.cc
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,31 @@ | ||
// Copyright (c) 2017 The Brave Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "brave/browser/importer/brave_external_process_importer_host.h" | ||
|
||
#include "atom/browser/importer/external_process_importer_client.h" | ||
#include "atom/browser/importer/in_process_importer_bridge.h" | ||
|
||
BraveExternalProcessImporterHost::BraveExternalProcessImporterHost() | ||
: ExternalProcessImporterHost() {} | ||
|
||
void BraveExternalProcessImporterHost::LaunchImportIfReady() { | ||
if (waiting_for_bookmarkbar_model_ || template_service_subscription_.get() || | ||
!is_source_readable_ || cancelled_) | ||
return; | ||
|
||
// This is the in-process half of the bridge, which catches data from the IPC | ||
// pipe and feeds it to the ProfileWriter. The external process half of the | ||
// bridge lives in the external process (see ProfileImportThread). | ||
// The ExternalProcessImporterClient created in the next line owns the bridge, | ||
// and will delete it. | ||
atom::InProcessImporterBridge* bridge = | ||
new atom::InProcessImporterBridge(writer_.get(), | ||
weak_ptr_factory_.GetWeakPtr()); | ||
client_ = new atom::ExternalProcessImporterClient( | ||
weak_ptr_factory_.GetWeakPtr(), source_profile_, items_, bridge); | ||
client_->Start(); | ||
} | ||
|
||
BraveExternalProcessImporterHost::~BraveExternalProcessImporterHost() {} |
26 changes: 26 additions & 0 deletions
26
brave/browser/importer/brave_external_process_importer_host.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,26 @@ | ||
// Copyright (c) 2017 The Brave Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef BRAVE_BROWSER_IMPORTER_BRAVE_EXTERNAL_PROCESS_IMPORTER_HOST_H_ | ||
#define BRAVE_BROWSER_IMPORTER_BRAVE_EXTERNAL_PROCESS_IMPORTER_HOST_H_ | ||
|
||
#include "chrome/browser/importer/external_process_importer_host.h" | ||
|
||
class BraveExternalProcessImporterHost : public ExternalProcessImporterHost { | ||
public: | ||
BraveExternalProcessImporterHost(); | ||
|
||
private: | ||
~BraveExternalProcessImporterHost() override; | ||
|
||
// Launches the utility process that starts the import task, unless bookmark | ||
// or template model are not yet loaded. If load is not detected, this method | ||
// will be called when the loading observer sees that model loading is | ||
// complete. | ||
void LaunchImportIfReady() override; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(BraveExternalProcessImporterHost); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_IMPORTER_BRAVE_EXTERNAL_PROCESS_IMPORTER_HOST_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
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