Commit d479873f authored by nancy's avatar nancy Committed by Commit Bot

Show the pause and block app dialog when launch the paused/block app.

The pause app dialog and block app dialog are system type window, which
means once the dialog is opened, the user must click the OK to accept
it, and the user can't move to other windows or do another other things
on the Chromebook before he/she clicks the OK button.

Based on the discussion in 1056466, this CL is used to implement:
For app block:
1. When the app is blocked, no matter the app is running or not, we
won't show dialog, because it is Android controls the app running, and
AppService can't know whether the app is running or not, due to the
schedule issue. When AppService is notified about the app status
changed, the app has been stopped. So rollback the dialog show in arc
apps when the app status is changed.

2. After the app is blocked, when the app is clicked to launch, show the
app block dialog.

For app pause:
1. When Family link notifies AppService to pause app, AppService will
show the pause app based on the family link's parameter. If the
parameter is yes, then show the dialog, otherwise, don't show the
dialog. This has been implemented, so no change for this CL.

2. After the app is paused, when the app is clicked to launch, get the
latest time limit setting from family link, and show the app pause
dialog.

BUG=1056466

Change-Id: I2e9c5445f13820b63cca81954724bfed95c614be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2084033
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarAga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748467}
parent a0814d83
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "url/url_constants.h" #include "url/url_constants.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/child_accounts/time_limits/app_time_limit_interface.h"
#include "chrome/browser/supervised_user/grit/supervised_user_unscaled_resources.h" #include "chrome/browser/supervised_user/grit/supervised_user_unscaled_resources.h"
#endif #endif
...@@ -200,9 +201,11 @@ void AppServiceProxy::Launch(const std::string& app_id, ...@@ -200,9 +201,11 @@ void AppServiceProxy::Launch(const std::string& app_id,
if (app_service_.is_connected()) { if (app_service_.is_connected()) {
cache_.ForOneApp(app_id, [this, event_flags, launch_source, cache_.ForOneApp(app_id, [this, event_flags, launch_source,
display_id](const apps::AppUpdate& update) { display_id](const apps::AppUpdate& update) {
if (update.Paused() == apps::mojom::OptionalBool::kTrue) { #if defined(OS_CHROMEOS)
if (MaybeShowLaunchPreventionDialog(update)) {
return; return;
} }
#endif
RecordAppLaunch(update.AppId(), launch_source); RecordAppLaunch(update.AppId(), launch_source);
app_service_->Launch(update.AppType(), update.AppId(), event_flags, app_service_->Launch(update.AppType(), update.AppId(), event_flags,
launch_source, display_id); launch_source, display_id);
...@@ -218,9 +221,11 @@ void AppServiceProxy::LaunchAppWithIntent( ...@@ -218,9 +221,11 @@ void AppServiceProxy::LaunchAppWithIntent(
if (app_service_.is_connected()) { if (app_service_.is_connected()) {
cache_.ForOneApp(app_id, [this, &intent, launch_source, cache_.ForOneApp(app_id, [this, &intent, launch_source,
display_id](const apps::AppUpdate& update) { display_id](const apps::AppUpdate& update) {
if (update.Paused() == apps::mojom::OptionalBool::kTrue) { #if defined(OS_CHROMEOS)
if (MaybeShowLaunchPreventionDialog(update)) {
return; return;
} }
#endif
RecordAppLaunch(update.AppId(), launch_source); RecordAppLaunch(update.AppId(), launch_source);
app_service_->LaunchAppWithIntent(update.AppType(), update.AppId(), app_service_->LaunchAppWithIntent(update.AppType(), update.AppId(),
std::move(intent), launch_source, std::move(intent), launch_source,
...@@ -287,7 +292,11 @@ void AppServiceProxy::PauseApps( ...@@ -287,7 +292,11 @@ void AppServiceProxy::PauseApps(
} }
cache_.ForOneApp(data.first, [this, &data](const apps::AppUpdate& update) { cache_.ForOneApp(data.first, [this, &data](const apps::AppUpdate& update) {
this->LoadIconForPauseDialog(update, data.second); LoadIconForDialog(
update,
base::BindOnce(&AppServiceProxy::OnLoadIconForPauseDialog,
weak_ptr_factory_.GetWeakPtr(), update.AppType(),
update.AppId(), update.Name(), data.second));
}); });
} }
} }
...@@ -497,31 +506,84 @@ void AppServiceProxy::OnUninstallDialogClosed( ...@@ -497,31 +506,84 @@ void AppServiceProxy::OnUninstallDialogClosed(
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void AppServiceProxy::LoadIconForPauseDialog(const apps::AppUpdate& update, bool AppServiceProxy::MaybeShowLaunchPreventionDialog(
const PauseData& pause_data) { const apps::AppUpdate& update) {
// Return true, and load the icon for the app block dialog when the app
// is blocked by policy.
if (update.Readiness() == apps::mojom::Readiness::kDisabledByPolicy) {
LoadIconForDialog(
update, base::BindOnce(&AppServiceProxy::OnLoadIconForBlockDialog,
weak_ptr_factory_.GetWeakPtr(), update.Name()));
return true;
}
// Return true, and load the icon for the app pause dialog when the app
// is paused.
if (update.Paused() == apps::mojom::OptionalBool::kTrue) {
chromeos::app_time::AppTimeLimitInterface* app_limit =
chromeos::app_time::AppTimeLimitInterface::Get(profile_);
DCHECK(app_limit);
auto time_limit =
app_limit->GetTimeLimitForApp(update.AppId(), update.AppType());
if (!time_limit.has_value()) {
NOTREACHED();
return true;
}
PauseData pause_data;
pause_data.hours = time_limit.value().InHours();
pause_data.minutes = time_limit.value().InMinutes() % 60;
LoadIconForDialog(
update, base::BindOnce(&AppServiceProxy::OnLoadIconForPauseDialog,
weak_ptr_factory_.GetWeakPtr(), update.AppType(),
update.AppId(), update.Name(), pause_data));
return true;
}
// The app is not prevented from launching and we didn't show any dialog.
return false;
}
void AppServiceProxy::LoadIconForDialog(
const apps::AppUpdate& update,
apps::mojom::Publisher::LoadIconCallback callback) {
apps::mojom::IconKeyPtr icon_key = update.IconKey(); apps::mojom::IconKeyPtr icon_key = update.IconKey();
constexpr bool kAllowPlaceholderIcon = false; constexpr bool kAllowPlaceholderIcon = false;
constexpr int32_t kPauseIconSize = 48; constexpr int32_t kIconSize = 48;
// For browser tests, still load the app icon, because there is no family link // For browser tests, load the app icon, because there is no family link
// logo for browser tests. // logo for browser tests.
if (!dialog_created_callback_.is_null()) { //
LoadIconFromIconKey( // For non_child profile, load the app icon, because the app is blocked by
update.AppType(), update.AppId(), std::move(icon_key), // admin.
apps::mojom::IconCompression::kUncompressed, kPauseIconSize, if (!dialog_created_callback_.is_null() || !profile_->IsChild()) {
kAllowPlaceholderIcon, LoadIconFromIconKey(update.AppType(), update.AppId(), std::move(icon_key),
base::BindOnce(&AppServiceProxy::OnLoadIconForPauseDialog, apps::mojom::IconCompression::kUncompressed, kIconSize,
weak_ptr_factory_.GetWeakPtr(), update.AppType(), kAllowPlaceholderIcon, std::move(callback));
update.AppId(), update.Name(), pause_data));
return; return;
} }
LoadIconFromResource( // Load the family link kite logo icon for the app pause dialog or the app
apps::mojom::IconCompression::kUncompressed, kPauseIconSize, // block dialog for the child profile.
IDR_FAMILY_LINK_LOGO, kAllowPlaceholderIcon, IconEffects::kNone, LoadIconFromResource(apps::mojom::IconCompression::kUncompressed, kIconSize,
base::BindOnce(&AppServiceProxy::OnLoadIconForPauseDialog, IDR_FAMILY_LINK_LOGO, kAllowPlaceholderIcon,
weak_ptr_factory_.GetWeakPtr(), update.AppType(), IconEffects::kNone, std::move(callback));
update.AppId(), update.Name(), pause_data)); }
void AppServiceProxy::OnLoadIconForBlockDialog(
const std::string& app_name,
apps::mojom::IconValuePtr icon_value) {
if (icon_value->icon_compression !=
apps::mojom::IconCompression::kUncompressed) {
return;
}
AppServiceProxy::CreateBlockDialog(app_name, icon_value->uncompressed,
profile_);
// For browser tests, call the dialog created callback to stop the run loop.
if (!dialog_created_callback_.is_null()) {
std::move(dialog_created_callback_).Run();
}
} }
void AppServiceProxy::OnLoadIconForPauseDialog( void AppServiceProxy::OnLoadIconForPauseDialog(
...@@ -541,6 +603,7 @@ void AppServiceProxy::OnLoadIconForPauseDialog( ...@@ -541,6 +603,7 @@ void AppServiceProxy::OnLoadIconForPauseDialog(
base::BindOnce(&AppServiceProxy::OnPauseDialogClosed, base::BindOnce(&AppServiceProxy::OnPauseDialogClosed,
weak_ptr_factory_.GetWeakPtr(), app_type, app_id)); weak_ptr_factory_.GetWeakPtr(), app_type, app_id));
// For browser tests, call the dialog created callback to stop the run loop.
if (!dialog_created_callback_.is_null()) { if (!dialog_created_callback_.is_null()) {
std::move(dialog_created_callback_).Run(); std::move(dialog_created_callback_).Run();
} }
......
...@@ -42,9 +42,9 @@ class UninstallDialog; ...@@ -42,9 +42,9 @@ class UninstallDialog;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
struct PauseData { struct PauseData {
int hours; int hours = 0;
int minutes; int minutes = 0;
bool should_show_pause_dialog; bool should_show_pause_dialog = false;
}; };
#endif #endif
...@@ -237,6 +237,10 @@ class AppServiceProxy : public KeyedService, ...@@ -237,6 +237,10 @@ class AppServiceProxy : public KeyedService,
}; };
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
static void CreateBlockDialog(const std::string& app_name,
const gfx::ImageSkia& image,
Profile* profile);
static void CreatePauseDialog(const std::string& app_name, static void CreatePauseDialog(const std::string& app_name,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
const PauseData& pause_data, const PauseData& pause_data,
...@@ -275,10 +279,20 @@ class AppServiceProxy : public KeyedService, ...@@ -275,10 +279,20 @@ class AppServiceProxy : public KeyedService,
UninstallDialog* uninstall_dialog); UninstallDialog* uninstall_dialog);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void LoadIconForPauseDialog(const apps::AppUpdate& update, // Returns true if the app cannot be launched and a launch prevention dialog
const PauseData& pause_data); // is shown to the user (e.g. the app is paused or blocked). Returns false
// otherwise (and the app can be launched).
bool MaybeShowLaunchPreventionDialog(const apps::AppUpdate& update);
// Loads the icon for the app block dialog or the app pause dialog.
void LoadIconForDialog(const apps::AppUpdate& update,
apps::mojom::Publisher::LoadIconCallback callback);
// Callback invoked when the icon is loaded for the block app dialog.
void OnLoadIconForBlockDialog(const std::string& app_name,
apps::mojom::IconValuePtr icon_value);
// Callback invoked when the icon is loaded. // Callback invoked when the icon is loaded for the pause app dialog.
void OnLoadIconForPauseDialog(apps::mojom::AppType app_type, void OnLoadIconForPauseDialog(apps::mojom::AppType app_type,
const std::string& app_id, const std::string& app_id,
const std::string& app_name, const std::string& app_name,
......
...@@ -67,12 +67,4 @@ void AppServiceTest::FlushMojoCalls() { ...@@ -67,12 +67,4 @@ void AppServiceTest::FlushMojoCalls() {
} }
} }
#if defined(OS_CHROMEOS)
void AppServiceTest::SetArcAppsUseTestingProfile() {
ArcAppsFactory::GetInstance()
->GetForProfile(profile_)
->SetUseTestingProfile();
}
#endif // OS_CHROMEOS
} // namespace apps } // namespace apps
...@@ -35,12 +35,6 @@ class AppServiceTest { ...@@ -35,12 +35,6 @@ class AppServiceTest {
// Flush mojo calls to allow AppService async callbacks to run. // Flush mojo calls to allow AppService async callbacks to run.
void FlushMojoCalls(); void FlushMojoCalls();
#if defined(OS_CHROMEOS)
// Set the flag in ArcApps to indicate the test environment and not create the
// dialog.
void SetArcAppsUseTestingProfile();
#endif // OS_CHROMEOS
private: private:
AppServiceProxy* app_service_proxy_ = nullptr; AppServiceProxy* app_service_proxy_ = nullptr;
......
...@@ -399,14 +399,6 @@ ArcApps::ArcApps(Profile* profile, apps::AppServiceProxy* proxy) ...@@ -399,14 +399,6 @@ ArcApps::ArcApps(Profile* profile, apps::AppServiceProxy* proxy)
ArcApps::~ArcApps() = default; ArcApps::~ArcApps() = default;
void ArcApps::SetUseTestingProfile() {
is_using_testing_profile_ = true;
}
void ArcApps::SetDialogCreatedCallbackForTesting(base::OnceClosure callback) {
dialog_created_callback_ = std::move(callback);
}
void ArcApps::Shutdown() { void ArcApps::Shutdown() {
// Disconnect the observee-observer connections that we made during the // Disconnect the observee-observer connections that we made during the
// constructor. // constructor.
...@@ -706,25 +698,11 @@ void ArcApps::OnAppStatesChanged(const std::string& app_id, ...@@ -706,25 +698,11 @@ void ArcApps::OnAppStatesChanged(const std::string& app_id,
return; return;
} }
if (!app_info.suspended) {
blocked_apps_.erase(app_id);
}
if (!base::Contains(blocked_apps_, app_id) && app_info.suspended &&
!is_using_testing_profile_) {
LoadIconForBlockDialog(app_id, app_info);
}
if (app_info.suspended) {
blocked_apps_.insert(app_id);
}
Publish(Convert(prefs, app_id, app_info)); Publish(Convert(prefs, app_id, app_info));
} }
void ArcApps::OnAppRemoved(const std::string& app_id) { void ArcApps::OnAppRemoved(const std::string& app_id) {
paused_apps_.MaybeRemoveApp(app_id); paused_apps_.MaybeRemoveApp(app_id);
blocked_apps_.erase(app_id);
if (base::Contains(app_id_to_task_ids_, app_id)) { if (base::Contains(app_id_to_task_ids_, app_id)) {
for (int task_id : app_id_to_task_ids_[app_id]) { for (int task_id : app_id_to_task_ids_[app_id]) {
...@@ -1111,30 +1089,4 @@ void ArcApps::UpdateAppIntentFilters( ...@@ -1111,30 +1089,4 @@ void ArcApps::UpdateAppIntentFilters(
} }
} }
void ArcApps::LoadIconForBlockDialog(const std::string& app_id,
const ArcAppListPrefs::AppInfo& app_info) {
apps::mojom::IconKeyPtr icon_key =
icon_key_factory_.MakeIconKey(IconEffects::kNone);
constexpr bool kAllowPlaceholderIcon = false;
constexpr int32_t kPauseIconSize = 48;
LoadIcon(app_id, icon_key_factory_.MakeIconKey(IconEffects::kNone),
apps::mojom::IconCompression::kUncompressed, kPauseIconSize,
kAllowPlaceholderIcon,
base::BindOnce(&ArcApps::OnLoadIconForBlockDialog,
weak_ptr_factory_.GetWeakPtr(), app_info.name));
}
void ArcApps::OnLoadIconForBlockDialog(const std::string& app_name,
apps::mojom::IconValuePtr icon_value) {
if (icon_value->icon_compression !=
apps::mojom::IconCompression::kUncompressed) {
return;
}
CreateBlockDialog(app_name, icon_value->uncompressed, profile_);
if (!dialog_created_callback_.is_null()) {
std::move(dialog_created_callback_).Run();
}
}
} // namespace apps } // namespace apps
...@@ -51,17 +51,9 @@ class ArcApps : public KeyedService, ...@@ -51,17 +51,9 @@ class ArcApps : public KeyedService,
~ArcApps() override; ~ArcApps() override;
void SetUseTestingProfile();
void SetDialogCreatedCallbackForTesting(base::OnceClosure callback);
private: private:
using AppIdToTaskIds = std::map<std::string, std::set<int>>; using AppIdToTaskIds = std::map<std::string, std::set<int>>;
using TaskIdToAppId = std::map<int, std::string>; using TaskIdToAppId = std::map<int, std::string>;
using BlockedApps = std::set<std::string>;
static void CreateBlockDialog(const std::string& app_name,
const gfx::ImageSkia& image,
Profile* profile);
ArcApps(Profile* profile, apps::AppServiceProxy* proxy); ArcApps(Profile* profile, apps::AppServiceProxy* proxy);
...@@ -150,13 +142,6 @@ class ArcApps : public KeyedService, ...@@ -150,13 +142,6 @@ class ArcApps : public KeyedService,
arc::ArcIntentHelperBridge* intent_helper_bridge, arc::ArcIntentHelperBridge* intent_helper_bridge,
std::vector<apps::mojom::IntentFilterPtr>* intent_filters); std::vector<apps::mojom::IntentFilterPtr>* intent_filters);
void LoadIconForBlockDialog(const std::string& app_id,
const ArcAppListPrefs::AppInfo& app_info);
// Callback invoked when the icon is loaded.
void OnLoadIconForBlockDialog(const std::string& app_name,
apps::mojom::IconValuePtr icon_value);
mojo::Receiver<apps::mojom::Publisher> receiver_{this}; mojo::Receiver<apps::mojom::Publisher> receiver_{this};
mojo::RemoteSet<apps::mojom::Subscriber> subscribers_; mojo::RemoteSet<apps::mojom::Subscriber> subscribers_;
...@@ -167,14 +152,9 @@ class ArcApps : public KeyedService, ...@@ -167,14 +152,9 @@ class ArcApps : public KeyedService,
PausedApps paused_apps_; PausedApps paused_apps_;
BlockedApps blocked_apps_;
AppIdToTaskIds app_id_to_task_ids_; AppIdToTaskIds app_id_to_task_ids_;
TaskIdToAppId task_id_to_app_id_; TaskIdToAppId task_id_to_app_id_;
bool is_using_testing_profile_ = false;
base::OnceClosure dialog_created_callback_;
ScopedObserver<arc::ArcIntentHelperBridge, arc::ArcIntentHelperObserver> ScopedObserver<arc::ArcIntentHelperBridge, arc::ArcIntentHelperObserver>
arc_intent_helper_observer_{this}; arc_intent_helper_observer_{this};
......
...@@ -97,7 +97,6 @@ class AppServiceWrapperTest : public testing::Test { ...@@ -97,7 +97,6 @@ class AppServiceWrapperTest : public testing::Test {
app_service_test_.SetUp(&profile_); app_service_test_.SetUp(&profile_);
arc_test_.SetUp(&profile_); arc_test_.SetUp(&profile_);
app_service_test_.SetArcAppsUseTestingProfile();
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
tested_wrapper_.AddObserver(&test_listener_); tested_wrapper_.AddObserver(&test_listener_);
......
...@@ -2028,9 +2028,6 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) { ...@@ -2028,9 +2028,6 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
// Test that icon is correctly updated for suspended/non-suspended app. // Test that icon is correctly updated for suspended/non-suspended app.
TEST_P(ArcAppModelBuilderTest, IconLoaderForSuspendedApps) { TEST_P(ArcAppModelBuilderTest, IconLoaderForSuspendedApps) {
apps::ArcAppsFactory::GetInstance()
->GetForProfile(profile_.get())
->SetUseTestingProfile();
arc::mojom::AppInfo app = fake_apps()[0]; arc::mojom::AppInfo app = fake_apps()[0];
const std::string app_id = ArcAppTest::GetAppId(app); const std::string app_id = ArcAppTest::GetAppId(app);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "chrome/browser/ui/views/apps/app_block_dialog_view.h" #include "chrome/browser/ui/views/apps/app_block_dialog_view.h"
#include "chrome/browser/apps/app_service/arc_apps.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -20,9 +20,9 @@ AppBlockDialogView* g_app_block_dialog_view = nullptr; ...@@ -20,9 +20,9 @@ AppBlockDialogView* g_app_block_dialog_view = nullptr;
namespace apps { namespace apps {
// static // static
void ArcApps::CreateBlockDialog(const std::string& app_name, void AppServiceProxy::CreateBlockDialog(const std::string& app_name,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
Profile* profile) { Profile* profile) {
views::DialogDelegate::CreateDialogWidget( views::DialogDelegate::CreateDialogWidget(
new AppBlockDialogView(app_name, image, profile), nullptr, nullptr) new AppBlockDialogView(app_name, image, profile), nullptr, nullptr)
->Show(); ->Show();
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/arc_apps.h"
#include "chrome/browser/apps/app_service/arc_apps_factory.h"
#include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" #include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -26,6 +24,7 @@ ...@@ -26,6 +24,7 @@
#include "components/arc/mojom/app.mojom.h" #include "components/arc/mojom/app.mojom.h"
#include "components/arc/test/connection_holder_util.h" #include "components/arc/test/connection_holder_util.h"
#include "components/arc/test/fake_app_instance.h" #include "components/arc/test/fake_app_instance.h"
#include "ui/display/types/display_constants.h"
class AppDialogViewBrowserTest : public DialogBrowserTest { class AppDialogViewBrowserTest : public DialogBrowserTest {
public: public:
...@@ -88,15 +87,19 @@ class AppDialogViewBrowserTest : public DialogBrowserTest { ...@@ -88,15 +87,19 @@ class AppDialogViewBrowserTest : public DialogBrowserTest {
ASSERT_TRUE(app_service_proxy); ASSERT_TRUE(app_service_proxy);
base::RunLoop run_loop; base::RunLoop run_loop;
std::string app_id =
arc_app_list_pref_->GetAppId(app.package_name, app.activity);
if (name == "block") { if (name == "block") {
app.suspended = true; app.suspended = true;
apps::ArcAppsFactory::GetForProfile(profile_) app_service_proxy->SetDialogCreatedCallbackForTesting(
->SetDialogCreatedCallbackForTesting(run_loop.QuitClosure()); run_loop.QuitClosure());
app_instance_->SendRefreshAppList( app_instance_->SendRefreshAppList(
std::vector<arc::mojom::AppInfo>(1, app)); std::vector<arc::mojom::AppInfo>(1, app));
app_service_proxy->FlushMojoCallsForTesting();
app_service_proxy->Launch(app_id, ui::EventFlags::EF_NONE,
apps::mojom::LaunchSource::kFromChromeInternal,
display::kInvalidDisplayId);
} else { } else {
std::string app_id =
arc_app_list_pref_->GetAppId(app.package_name, app.activity);
std::map<std::string, apps::PauseData> pause_data; std::map<std::string, apps::PauseData> pause_data;
pause_data[app_id].hours = 3; pause_data[app_id].hours = 3;
pause_data[app_id].minutes = 30; pause_data[app_id].minutes = 30;
...@@ -111,8 +114,6 @@ class AppDialogViewBrowserTest : public DialogBrowserTest { ...@@ -111,8 +114,6 @@ class AppDialogViewBrowserTest : public DialogBrowserTest {
EXPECT_EQ(ui::DIALOG_BUTTON_OK, ActiveView(name)->GetDialogButtons()); EXPECT_EQ(ui::DIALOG_BUTTON_OK, ActiveView(name)->GetDialogButtons());
app_service_proxy->FlushMojoCallsForTesting(); app_service_proxy->FlushMojoCallsForTesting();
std::string app_id =
arc_app_list_pref_->GetAppId(app.package_name, app.activity);
bool state_is_set = false; bool state_is_set = false;
app_service_proxy->AppRegistryCache().ForOneApp( app_service_proxy->AppRegistryCache().ForOneApp(
app_id, [&state_is_set, name](const apps::AppUpdate& update) { app_id, [&state_is_set, name](const apps::AppUpdate& update) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment