Commit 602164ef authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Remove more ash::ShellPort methods

The class is deprecated. Eliminate empty methods. Inline code from
remaining methods.

TBR=rcui@chromium.org

Bug: 866523
Change-Id: I6c785a5c58b4b95f2a3b543ab80b66610fc88519
Reviewed-on: https://chromium-review.googlesource.com/1164629Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581334}
parent 09c687c3
...@@ -131,15 +131,6 @@ specific_include_rules = { ...@@ -131,15 +131,6 @@ specific_include_rules = {
"shell.cc": [ "shell.cc": [
"+ash/host/ash_window_tree_host_init_params.h" "+ash/host/ash_window_tree_host_init_params.h"
], ],
"shell_port_classic.cc": [
"+ash/host/ash_window_tree_host.h",
"+ash/host/ash_window_tree_host_init_params.h",
"+ui/ozone/public"
],
"shell_port_mash\.cc": [
"+ash/host/ash_window_tree_host_init_params.h",
"+ash/host/ash_window_tree_host_mus.h",
],
"window_manager.cc": [ "window_manager.cc": [
"+ash/host/ash_window_tree_host.h" "+ash/host/ash_window_tree_host.h"
], ],
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "ash/shelf/shelf_widget.h" #include "ash/shelf/shelf_widget.h"
#include "ash/shelf/shelf_window_targeter.h" #include "ash/shelf/shelf_window_targeter.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/shell_state.h" #include "ash/shell_state.h"
#include "ash/system/status_area_layout_manager.h" #include "ash/system/status_area_layout_manager.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
...@@ -656,8 +655,6 @@ void RootWindowController::Init(RootWindowType root_window_type) { ...@@ -656,8 +655,6 @@ void RootWindowController::Init(RootWindowType root_window_type) {
shell->InitRootWindow(root_window); shell->InitRootWindow(root_window);
CreateContainers(); CreateContainers();
ShellPort::Get()->OnCreatedRootWindowContainers(this);
CreateSystemWallpaper(root_window_type); CreateSystemWallpaper(root_window_type);
InitLayoutManagers(); InitLayoutManagers();
......
...@@ -399,7 +399,7 @@ bool Shell::HasRemoteClient(aura::Window* window) { ...@@ -399,7 +399,7 @@ bool Shell::HasRemoteClient(aura::Window* window) {
// static // static
Config Shell::GetAshConfig() { Config Shell::GetAshConfig() {
return Get()->shell_port_->GetAshConfig(); return Config::CLASSIC;
} }
// static // static
...@@ -950,8 +950,6 @@ void Shell::Init( ...@@ -950,8 +950,6 @@ void Shell::Init(
ui::ContextFactoryPrivate* context_factory_private, ui::ContextFactoryPrivate* context_factory_private,
std::unique_ptr<base::Value> initial_display_prefs, std::unique_ptr<base::Value> initial_display_prefs,
std::unique_ptr<ui::ws2::GpuInterfaceProvider> gpu_interface_provider) { std::unique_ptr<ui::ws2::GpuInterfaceProvider> gpu_interface_provider) {
const Config config = shell_port_->GetAshConfig();
// This creates the MessageCenter object which is used by some other objects // This creates the MessageCenter object which is used by some other objects
// initialized here, so it needs to come early. // initialized here, so it needs to come early.
message_center_controller_ = std::make_unique<MessageCenterController>(); message_center_controller_ = std::make_unique<MessageCenterController>();
...@@ -1027,15 +1025,13 @@ void Shell::Init( ...@@ -1027,15 +1025,13 @@ void Shell::Init(
InitializeDisplayManager(); InitializeDisplayManager();
if (config == Config::CLASSIC) { // This will initialize aura::Env which requires |display_manager_| to
// This will initialize aura::Env which requires |display_manager_| to // be initialized first.
// be initialized first. if (context_factory)
if (context_factory) aura::Env::GetInstance()->set_context_factory(context_factory);
aura::Env::GetInstance()->set_context_factory(context_factory); if (context_factory_private) {
if (context_factory_private) { aura::Env::GetInstance()->set_context_factory_private(
aura::Env::GetInstance()->set_context_factory_private( context_factory_private);
context_factory_private);
}
} }
// Night Light depends on the display manager, the display color manager, and // Night Light depends on the display manager, the display color manager, and
...@@ -1175,7 +1171,10 @@ void Shell::Init( ...@@ -1175,7 +1171,10 @@ void Shell::Init(
viz::mojom::VideoDetectorObserverPtr observer; viz::mojom::VideoDetectorObserverPtr observer;
video_detector_ = video_detector_ =
std::make_unique<VideoDetector>(mojo::MakeRequest(&observer)); std::make_unique<VideoDetector>(mojo::MakeRequest(&observer));
shell_port_->AddVideoDetectorObserver(std::move(observer)); aura::Env::GetInstance()
->context_factory_private()
->GetHostFrameSinkManager()
->AddVideoDetectorObserver(std::move(observer));
tooltip_controller_.reset(new views::corewm::TooltipController( tooltip_controller_.reset(new views::corewm::TooltipController(
std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura)));
...@@ -1218,12 +1217,10 @@ void Shell::Init( ...@@ -1218,12 +1217,10 @@ void Shell::Init(
std::make_unique<SystemNotificationController>(); std::make_unique<SystemNotificationController>();
window_tree_host_manager_->InitHosts(); window_tree_host_manager_->InitHosts();
shell_port_->OnHostsInitialized();
// Needs to be created after InitDisplays() since it may cause the virtual // Needs to be created after InitDisplays() since it may cause the virtual
// keyboard to be deployed. // keyboard to be deployed.
if (config != Config::MASH_DEPRECATED) virtual_keyboard_controller_ = std::make_unique<VirtualKeyboardController>();
virtual_keyboard_controller_.reset(new VirtualKeyboardController);
cursor_manager_->HideCursor(); // Hide the mouse cursor on startup. cursor_manager_->HideCursor(); // Hide the mouse cursor on startup.
cursor_manager_->SetCursor(ui::CursorType::kPointer); cursor_manager_->SetCursor(ui::CursorType::kPointer);
...@@ -1448,8 +1445,6 @@ void Shell::OnSessionStateChanged(session_manager::SessionState state) { ...@@ -1448,8 +1445,6 @@ void Shell::OnSessionStateChanged(session_manager::SessionState state) {
break; break;
} }
} }
shell_port_->UpdateSystemModalAndBlockingContainers();
} }
void Shell::OnLoginStatusChanged(LoginStatus login_status) { void Shell::OnLoginStatusChanged(LoginStatus login_status) {
......
...@@ -264,7 +264,6 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { ...@@ -264,7 +264,6 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
} }
void DismissAppList() override { void DismissAppList() override {
DCHECK(ShellPort::HasInstance());
Shell::Get()->app_list_controller()->DismissAppList(); Shell::Get()->app_list_controller()->DismissAppList();
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "ash/shell_port.h" #include "ash/shell_port.h"
#include "base/values.h"
#include "services/ui/ws2/gpu_interface_provider.h" #include "services/ui/ws2/gpu_interface_provider.h"
namespace ash { namespace ash {
......
...@@ -5,14 +5,7 @@ ...@@ -5,14 +5,7 @@
#ifndef ASH_SHELL_PORT_H_ #ifndef ASH_SHELL_PORT_H_
#define ASH_SHELL_PORT_H_ #define ASH_SHELL_PORT_H_
#include <stdint.h>
#include <memory>
#include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "services/viz/public/interfaces/compositing/video_detector_observer.mojom.h"
#include "ui/aura/client/window_types.h"
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"
namespace gfx { namespace gfx {
...@@ -25,9 +18,6 @@ enum class PointerWatcherEventTypes; ...@@ -25,9 +18,6 @@ enum class PointerWatcherEventTypes;
} }
namespace ash { namespace ash {
class RootWindowController;
enum class Config;
// Porting layer for Shell. This class contains the part of Shell that are // Porting layer for Shell. This class contains the part of Shell that are
// different in classic ash and mus/mash. // different in classic ash and mus/mash.
...@@ -38,12 +28,9 @@ class ASH_EXPORT ShellPort { ...@@ -38,12 +28,9 @@ class ASH_EXPORT ShellPort {
virtual ~ShellPort(); virtual ~ShellPort();
static ShellPort* Get(); static ShellPort* Get();
static bool HasInstance() { return instance_ != nullptr; }
virtual void Shutdown(); virtual void Shutdown();
virtual Config GetAshConfig() const = 0;
// Shows the context menu for the wallpaper or shelf at |location_in_screen|. // Shows the context menu for the wallpaper or shelf at |location_in_screen|.
void ShowContextMenu(const gfx::Point& location_in_screen, void ShowContextMenu(const gfx::Point& location_in_screen,
ui::MenuSourceType source_type); ui::MenuSourceType source_type);
...@@ -58,33 +45,11 @@ class ASH_EXPORT ShellPort { ...@@ -58,33 +45,11 @@ class ASH_EXPORT ShellPort {
views::PointerWatcherEventTypes events) = 0; views::PointerWatcherEventTypes events) = 0;
virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0;
// True if any touch points are down.
virtual bool IsTouchDown() = 0;
// TODO(jamescook): Remove this when VirtualKeyboardController has been moved.
virtual void ToggleIgnoreExternalKeyboard() = 0;
virtual void CreatePointerWatcherAdapter() = 0; virtual void CreatePointerWatcherAdapter() = 0;
// Called after the containers of |root_window_controller| have been created.
// Allows ShellPort to install any additional state on the containers.
virtual void OnCreatedRootWindowContainers(
RootWindowController* root_window_controller) = 0;
// Called any time the set up system modal and blocking containers needs to
// sent to the server.
virtual void UpdateSystemModalAndBlockingContainers() = 0;
// Adds an observer for viz::VideoDetector.
virtual void AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) = 0;
protected: protected:
ShellPort(); ShellPort();
// Called after WindowTreeHostManager::InitHosts().
virtual void OnHostsInitialized() = 0;
private: private:
friend class Shell; friend class Shell;
......
...@@ -5,14 +5,8 @@ ...@@ -5,14 +5,8 @@
#include "ash/shell_port_classic.h" #include "ash/shell_port_classic.h"
#include <memory> #include <memory>
#include <utility>
#include "ash/keyboard/virtual_keyboard_controller.h"
#include "ash/pointer_watcher_adapter_classic.h" #include "ash/pointer_watcher_adapter_classic.h"
#include "ash/public/cpp/config.h"
#include "ash/shell.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "ui/aura/env.h"
namespace ash { namespace ash {
...@@ -20,22 +14,12 @@ ShellPortClassic::ShellPortClassic() = default; ...@@ -20,22 +14,12 @@ ShellPortClassic::ShellPortClassic() = default;
ShellPortClassic::~ShellPortClassic() = default; ShellPortClassic::~ShellPortClassic() = default;
// static
ShellPortClassic* ShellPortClassic::Get() {
CHECK(Shell::GetAshConfig() == Config::CLASSIC);
return static_cast<ShellPortClassic*>(ShellPort::Get());
}
void ShellPortClassic::Shutdown() { void ShellPortClassic::Shutdown() {
pointer_watcher_adapter_.reset(); pointer_watcher_adapter_.reset();
ShellPort::Shutdown(); ShellPort::Shutdown();
} }
Config ShellPortClassic::GetAshConfig() const {
return Config::CLASSIC;
}
void ShellPortClassic::AddPointerWatcher( void ShellPortClassic::AddPointerWatcher(
views::PointerWatcher* watcher, views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) { views::PointerWatcherEventTypes events) {
...@@ -46,31 +30,8 @@ void ShellPortClassic::RemovePointerWatcher(views::PointerWatcher* watcher) { ...@@ -46,31 +30,8 @@ void ShellPortClassic::RemovePointerWatcher(views::PointerWatcher* watcher) {
pointer_watcher_adapter_->RemovePointerWatcher(watcher); pointer_watcher_adapter_->RemovePointerWatcher(watcher);
} }
bool ShellPortClassic::IsTouchDown() {
return aura::Env::GetInstance()->is_touch_down();
}
void ShellPortClassic::ToggleIgnoreExternalKeyboard() {
Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard();
}
void ShellPortClassic::CreatePointerWatcherAdapter() { void ShellPortClassic::CreatePointerWatcherAdapter() {
pointer_watcher_adapter_ = std::make_unique<PointerWatcherAdapterClassic>(); pointer_watcher_adapter_ = std::make_unique<PointerWatcherAdapterClassic>();
} }
void ShellPortClassic::OnCreatedRootWindowContainers(
RootWindowController* root_window_controller) {}
void ShellPortClassic::UpdateSystemModalAndBlockingContainers() {}
void ShellPortClassic::OnHostsInitialized() {}
void ShellPortClassic::AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) {
aura::Env::GetInstance()
->context_factory_private()
->GetHostFrameSinkManager()
->AddVideoDetectorObserver(std::move(observer));
}
} // namespace ash } // namespace ash
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define ASH_SHELL_PORT_CLASSIC_H_ #define ASH_SHELL_PORT_CLASSIC_H_
#include <memory> #include <memory>
#include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shell_port.h" #include "ash/shell_port.h"
...@@ -25,23 +24,12 @@ class ASH_EXPORT ShellPortClassic : public ShellPort { ...@@ -25,23 +24,12 @@ class ASH_EXPORT ShellPortClassic : public ShellPort {
ShellPortClassic(); ShellPortClassic();
~ShellPortClassic() override; ~ShellPortClassic() override;
static ShellPortClassic* Get();
// ShellPort: // ShellPort:
void Shutdown() override; void Shutdown() override;
Config GetAshConfig() const override;
void AddPointerWatcher(views::PointerWatcher* watcher, void AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) override; views::PointerWatcherEventTypes events) override;
void RemovePointerWatcher(views::PointerWatcher* watcher) override; void RemovePointerWatcher(views::PointerWatcher* watcher) override;
bool IsTouchDown() override;
void ToggleIgnoreExternalKeyboard() override;
void CreatePointerWatcherAdapter() override; void CreatePointerWatcherAdapter() override;
void OnCreatedRootWindowContainers(
RootWindowController* root_window_controller) override;
void UpdateSystemModalAndBlockingContainers() override;
void OnHostsInitialized() override;
void AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) override;
private: private:
std::unique_ptr<PointerWatcherAdapterClassic> pointer_watcher_adapter_; std::unique_ptr<PointerWatcherAdapterClassic> pointer_watcher_adapter_;
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
#include "ash/ime/ime_controller.h" #include "ash/ime/ime_controller.h"
#include "ash/ime/ime_switch_type.h" #include "ash/ime/ime_switch_type.h"
#include "ash/keyboard/virtual_keyboard_controller.h"
#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/ash_features.h"
#include "ash/public/interfaces/ime_info.mojom.h" #include "ash/public/interfaces/ime_info.mojom.h"
#include "ash/resources/vector_icons/vector_icons.h" #include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/system/tray/actionable_view.h" #include "ash/system/tray/actionable_view.h"
#include "ash/system/tray/system_menu_button.h" #include "ash/system/tray/system_menu_button.h"
...@@ -330,7 +330,7 @@ void ImeListView::HandleButtonPressed(views::Button* sender, ...@@ -330,7 +330,7 @@ void ImeListView::HandleButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
DCHECK_EQ(sender, keyboard_status_row_->toggle()); DCHECK_EQ(sender, keyboard_status_row_->toggle());
ShellPort::Get()->ToggleIgnoreExternalKeyboard(); Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard();
last_selected_item_id_.clear(); last_selected_item_id_.clear();
last_item_selected_with_keyboard_ = false; last_item_selected_with_keyboard_ = false;
} }
......
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