| Index: chrome/browser/ui/app_list/drive/drive_app_converter.cc
|
| diff --git a/chrome/browser/ui/app_list/drive/drive_app_converter.cc b/chrome/browser/ui/app_list/drive/drive_app_converter.cc
|
| index 096a6f37cebfd151157eb6936374b86810ff86b8..5bee46024f7a86038964699c32cbd133480bd095 100644
|
| --- a/chrome/browser/ui/app_list/drive/drive_app_converter.cc
|
| +++ b/chrome/browser/ui/app_list/drive/drive_app_converter.cc
|
| @@ -115,6 +115,8 @@ DriveAppConverter::~DriveAppConverter() {
|
| }
|
|
|
| void DriveAppConverter::Start() {
|
| + DCHECK(!IsStarted());
|
| +
|
| if (app_info_.app_name.empty() ||
|
| !app_info_.create_url.is_valid()) {
|
| finished_callback_.Run(this, false);
|
| @@ -146,6 +148,10 @@ void DriveAppConverter::Start() {
|
| StartInstall();
|
| }
|
|
|
| +bool DriveAppConverter::IsStarted() const {
|
| + return !fetchers_.empty() || crx_installer_;
|
| +}
|
| +
|
| void DriveAppConverter::OnIconFetchComplete(const IconFetcher* fetcher) {
|
| const SkBitmap& icon = fetcher->icon();
|
| if (!icon.empty() && icon.width() != 0) {
|
| @@ -167,6 +173,15 @@ void DriveAppConverter::StartInstall() {
|
| DCHECK(!crx_installer_);
|
| crx_installer_ = extensions::CrxInstaller::CreateSilent(
|
| extensions::ExtensionSystem::Get(profile_)->extension_service());
|
| +
|
| + // Sets WAS_INSTALLED_BY_DEFAULT to make the converted url app not syncable.
|
| + // Drive apps goes with the user's account and url apps will be created when
|
| + // needed. Syncing those apps could hit an edge case where the synced url
|
| + // apps become orphans when the user has corresponding chrome apps.
|
| + crx_installer_->set_creation_flags(
|
| + extensions::Extension::FROM_BOOKMARK |
|
| + extensions::Extension::WAS_INSTALLED_BY_DEFAULT);
|
| +
|
| extensions::InstallTracker::Get(profile_)->AddObserver(this);
|
| crx_installer_->InstallWebApp(web_app_);
|
| }
|
| @@ -187,7 +202,8 @@ void DriveAppConverter::OnFinishCrxInstall(const std::string& extension_id,
|
| }
|
|
|
| app_ = crx_installer_->extension();
|
| - finished_callback_.Run(this, success);
|
| -
|
| PostInstallCleanUp();
|
| +
|
| + finished_callback_.Run(this, success);
|
| + // |finished_callback_| could delete this.
|
| }
|
|
|