Chromium Code Reviews| Index: chrome/browser/apps/drive/drive_app_converter.cc |
| diff --git a/chrome/browser/ui/app_list/drive/drive_app_converter.cc b/chrome/browser/apps/drive/drive_app_converter.cc |
| similarity index 89% |
| rename from chrome/browser/ui/app_list/drive/drive_app_converter.cc |
| rename to chrome/browser/apps/drive/drive_app_converter.cc |
| index 096a6f37cebfd151157eb6936374b86810ff86b8..d0e2a965abb25465491a24764e8fa3cde7f111f6 100644 |
| --- a/chrome/browser/ui/app_list/drive/drive_app_converter.cc |
| +++ b/chrome/browser/apps/drive/drive_app_converter.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/ui/app_list/drive/drive_app_converter.h" |
| +#include "chrome/browser/apps/drive/drive_app_converter.h" |
| #include <algorithm> |
| #include <set> |
| @@ -115,8 +115,9 @@ DriveAppConverter::~DriveAppConverter() { |
| } |
| void DriveAppConverter::Start() { |
| - if (app_info_.app_name.empty() || |
| - !app_info_.create_url.is_valid()) { |
| + DCHECK(!IsStarted()); |
| + |
| + if (app_info_.app_name.empty() || !app_info_.create_url.is_valid()) { |
| finished_callback_.Run(this, false); |
| return; |
| } |
| @@ -146,6 +147,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 +172,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 go 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); |
|
stevenjb
2014/06/05 20:15:16
WAS_INSTALLED_BY_DEFAULT might trigger other behav
xiyuan
2014/06/05 20:36:14
The converted app is sort of a default (in a sense
Yoyo Zhou
2014/06/05 20:45:33
This isn't really what we mean by default apps; th
not at google - send to devlin
2014/06/05 20:47:47
I agree with Steven, even if this works at the mom
xiyuan
2014/06/05 21:17:06
Okay.
- Add a ExtensionPrefs backed boolean prope
Yoyo Zhou
2014/06/05 21:18:20
Minor detail: you can check this in IsSyncable ins
|
| + |
| extensions::InstallTracker::Get(profile_)->AddObserver(this); |
| crx_installer_->InstallWebApp(web_app_); |
| } |
| @@ -187,7 +201,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. |
| } |