Commit a9011ed4 authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Remove the CrostiniAppLaunchObserver abstraction

This CL removes the CrostiniAppLaunchObserver abstraction, which does
not actually give us any benefit because where it is used we already
know about the derived class, and it also isn't used like a regular
observer. I also updated includes to make the dependencies clearer.

Change-Id: Id75bac0db683a9800ede6b9993c62dfa927231b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722139
Commit-Queue: Timothy Loh <timloh@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682100}
parent 2d060dd1
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_APP_LAUNCH_OBSERVER_H_
#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_APP_LAUNCH_OBSERVER_H_
#include <string>
class CrostiniAppLaunchObserver {
public:
// Invoked when a Crostini app launch has been requested.
virtual void OnAppLaunchRequested(const std::string& app_id,
int64_t display_id) = 0;
protected:
virtual ~CrostiniAppLaunchObserver() {}
};
#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_APP_LAUNCH_OBSERVER_H_
......@@ -15,7 +15,6 @@
#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/crostini/crostini_app_launch_observer.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h"
#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h"
......@@ -29,6 +28,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/crostini/crostini_app_icon.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/crostini_app_window_shelf_controller.h"
#include "chrome/browser/ui/ash/launcher/shelf_spinner_controller.h"
#include "chrome/browser/ui/ash/launcher/shelf_spinner_item_controller.h"
#include "chrome/browser/ui/browser.h"
......@@ -108,11 +108,11 @@ void LaunchContainerApplication(
bool display_scaled) {
ChromeLauncherController* chrome_launcher_controller =
ChromeLauncherController::instance();
DCHECK_NE(chrome_launcher_controller, nullptr);
CrostiniAppLaunchObserver* observer =
DCHECK(chrome_launcher_controller);
CrostiniAppWindowShelfController* shelf_controller =
chrome_launcher_controller->crostini_app_window_shelf_controller();
DCHECK_NE(observer, nullptr);
observer->OnAppLaunchRequested(app_id, display_id);
DCHECK(shelf_controller);
shelf_controller->OnAppLaunchRequested(app_id, display_id);
crostini::CrostiniManager::GetForProfile(profile)->LaunchContainerApplication(
registration.VmName(), registration.ContainerName(),
registration.DesktopFileId(), files, display_scaled,
......
......@@ -12,6 +12,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "ui/display/types/display_constants.h"
using BrowserShortcutLauncherItemControllerTest = InProcessBrowserTest;
......
......@@ -18,7 +18,6 @@
#include "chrome/browser/ui/app_icon_loader_delegate.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/crostini_app_window_shelf_controller.h"
#include "chrome/browser/ui/ash/launcher/discover_window_observer.h"
#include "chrome/browser/ui/ash/launcher/launcher_app_updater.h"
#include "chrome/browser/ui/ash/launcher/settings_window_observer.h"
......@@ -31,6 +30,7 @@ class AppWindowLauncherController;
class BrowserShortcutLauncherItemController;
class BrowserStatusMonitor;
class ChromeLauncherControllerUserSwitchObserver;
class CrostiniAppWindowShelfController;
class GURL;
class Profile;
class LauncherControllerHelper;
......
......@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/crostini/crostini_app_launch_observer.h"
#include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/crostini_app_display.h"
#include "mojo/public/cpp/bindings/binding.h"
......@@ -33,8 +32,7 @@ class ChromeLauncherController;
// Chrome OS shelf.
class CrostiniAppWindowShelfController : public AppWindowLauncherController,
public aura::EnvObserver,
public aura::WindowObserver,
public CrostiniAppLaunchObserver {
public aura::WindowObserver {
public:
explicit CrostiniAppWindowShelfController(ChromeLauncherController* owner);
~CrostiniAppWindowShelfController() override;
......@@ -51,8 +49,7 @@ class CrostiniAppWindowShelfController : public AppWindowLauncherController,
// A Crostini app with |app_id| is requested to launch on display with
// |display_id|.
void OnAppLaunchRequested(const std::string& app_id,
int64_t display_id) override;
void OnAppLaunchRequested(const std::string& app_id, int64_t display_id);
// Close app with |shelf_id| and then restart it on |display_id|.
void Restart(const ash::ShelfID& shelf_id, int64_t display_id);
......
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/crostini/crostini_app_restart_view.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/crostini_app_window_shelf_controller.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "ui/base/l10n/l10n_util.h"
......
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