Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3801)

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_launcher.cc

Issue 2751913004: arc: Fix race conditon when Play Store is started too early. (Closed)
Patch Set: nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/arc/arc_app_launcher.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_launcher.cc b/chrome/browser/ui/app_list/arc/arc_app_launcher.cc
index 878e244f56a9693f59b7f3f6f2a1512c5596ba92..8509703179bcdf5470de48834fcd7a99a12146fe 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_launcher.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_launcher.cc
@@ -7,16 +7,21 @@
#include <memory>
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
+#include "ui/events/event_constants.h"
ArcAppLauncher::ArcAppLauncher(content::BrowserContext* context,
const std::string& app_id,
- bool landscape_layout)
- : context_(context), app_id_(app_id), landscape_layout_(landscape_layout) {
+ bool landscape_layout,
+ bool deferred_launch_allowed)
+ : context_(context),
+ app_id_(app_id),
+ landscape_layout_(landscape_layout),
+ deferred_launch_allowed_(deferred_launch_allowed) {
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context_);
DCHECK(prefs);
std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id_);
- if (app_info && app_info->ready)
+ if (app_info && (app_info->ready || deferred_launch_allowed_))
LaunchApp();
else
prefs->AddObserver(this);
@@ -34,12 +39,12 @@ ArcAppLauncher::~ArcAppLauncher() {
void ArcAppLauncher::OnAppRegistered(
const std::string& app_id,
const ArcAppListPrefs::AppInfo& app_info) {
- if (app_id == app_id_ && app_info.ready)
+ if (app_id == app_id_ && (app_info.ready || deferred_launch_allowed_))
LaunchApp();
}
void ArcAppLauncher::OnAppReadyChanged(const std::string& app_id, bool ready) {
- if (app_id == app_id_ && ready)
+ if (app_id == app_id_ && (ready || deferred_launch_allowed_))
LaunchApp();
}
@@ -50,7 +55,7 @@ void ArcAppLauncher::LaunchApp() {
DCHECK(prefs && prefs->GetApp(app_id_));
prefs->RemoveObserver(this);
- if (!arc::LaunchApp(context_, app_id_, landscape_layout_))
+ if (!arc::LaunchApp(context_, app_id_, landscape_layout_, ui::EF_NONE))
VLOG(2) << "Failed to launch app: " + app_id_ + ".";
app_launched_ = true;
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_launcher.h ('k') | chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698