Chromium Code Reviews| Index: chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| index 017ecaa23967ecdede358b9d5744db36615be9a9..969e69920d0f9212deda2162f8e0ba7c5ef69bcc 100644 |
| --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| @@ -23,6 +23,7 @@ |
| #include "chrome/common/pref_names.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/arc/arc_service_manager.h" |
| +#include "components/arc/arc_util.h" |
| #include "components/crx_file/id_util.h" |
| #include "components/pref_registry/pref_registry_syncable.h" |
| #include "components/prefs/scoped_user_pref_update.h" |
| @@ -142,6 +143,8 @@ void DeleteAppFolderFromFileThread(const base::FilePath& path) { |
| } |
| bool IsArcEnabled() { |
| + if (arc::ShouldArcAlwaysStart()) |
| + return true; |
| const auto* arc_session_manager = arc::ArcSessionManager::Get(); |
| return arc_session_manager && arc_session_manager->IsArcPlayStoreEnabled(); |
| } |
| @@ -294,6 +297,12 @@ base::FilePath ArcAppListPrefs::GetIconPath( |
| void ArcAppListPrefs::RequestIcon(const std::string& app_id, |
| ui::ScaleFactor scale_factor) { |
| + // FIXME: what's the best way/place to detect and cancel this? |
|
Yusuke Sato
2017/03/01 20:43:57
FIXME is unusual in Chromium code. TODO(your_ldap)
victorhsieh
2017/03/01 21:57:56
Sorry, I meant to ask if the reviewers have any th
|
| + // ArcSessionManager can be terminated during test tear down, before callback |
| + // into this function. |
| + if (arc::ArcSessionManager::Get() == nullptr) |
| + return; |
| + |
| if (!IsRegistered(app_id)) { |
| VLOG(2) << "Request to load icon for non-registered app: " << app_id << "."; |
| return; |
| @@ -417,7 +426,7 @@ std::unique_ptr<ArcAppListPrefs::PackageInfo> ArcAppListPrefs::GetPackage( |
| } |
| std::vector<std::string> ArcAppListPrefs::GetAppIds() const { |
| - if (!IsArcEnabled()) { |
| + if (!arc::ShouldArcAlwaysStart() && !IsArcEnabled()) { |
| // Default ARC apps available before OptIn. |
| std::vector<std::string> ids; |
| for (const auto& default_app : default_apps_.app_map()) { |
| @@ -431,7 +440,6 @@ std::vector<std::string> ArcAppListPrefs::GetAppIds() const { |
| std::vector<std::string> ArcAppListPrefs::GetAppIdsNoArcEnabledCheck() const { |
| std::vector<std::string> ids; |
| - |
| const base::DictionaryValue* apps = prefs_->GetDictionary(prefs::kArcApps); |
| DCHECK(apps); |
| @@ -595,6 +603,10 @@ void ArcAppListPrefs::RemoveAllApps() { |
| void ArcAppListPrefs::OnArcPlayStoreEnabledChanged(bool enabled) { |
| UpdateDefaultAppsHiddenState(); |
| + // TODO(victorhsieh): Implement opt-in and opt-out. |
| + if (arc::ShouldArcAlwaysStart()) |
| + return; |
| + |
| if (enabled) |
| NotifyRegisteredApps(); |
| else |