Skip to content

Commit

Permalink
chromeos: Remove more ash::ShellPort methods
Browse files Browse the repository at this point in the history
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/1164629
Reviewed-by: James Cook <jamescook@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581334}
  • Loading branch information
James Cook authored and Commit Bot committed Aug 7, 2018
1 parent 09c687c commit 602164e
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 119 deletions.
9 changes: 0 additions & 9 deletions ash/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ specific_include_rules = {
"shell.cc": [
"+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": [
"+ash/host/ash_window_tree_host.h"
],
Expand Down
3 changes: 0 additions & 3 deletions ash/root_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shelf/shelf_window_targeter.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/shell_state.h"
#include "ash/system/status_area_layout_manager.h"
#include "ash/system/status_area_widget.h"
Expand Down Expand Up @@ -656,8 +655,6 @@ void RootWindowController::Init(RootWindowType root_window_type) {
shell->InitRootWindow(root_window);

CreateContainers();
ShellPort::Get()->OnCreatedRootWindowContainers(this);

CreateSystemWallpaper(root_window_type);

InitLayoutManagers();
Expand Down
31 changes: 13 additions & 18 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ bool Shell::HasRemoteClient(aura::Window* window) {

// static
Config Shell::GetAshConfig() {
return Get()->shell_port_->GetAshConfig();
return Config::CLASSIC;
}

// static
Expand Down Expand Up @@ -950,8 +950,6 @@ void Shell::Init(
ui::ContextFactoryPrivate* context_factory_private,
std::unique_ptr<base::Value> initial_display_prefs,
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
// initialized here, so it needs to come early.
message_center_controller_ = std::make_unique<MessageCenterController>();
Expand Down Expand Up @@ -1027,15 +1025,13 @@ void Shell::Init(

InitializeDisplayManager();

if (config == Config::CLASSIC) {
// This will initialize aura::Env which requires |display_manager_| to
// be initialized first.
if (context_factory)
aura::Env::GetInstance()->set_context_factory(context_factory);
if (context_factory_private) {
aura::Env::GetInstance()->set_context_factory_private(
context_factory_private);
}
// This will initialize aura::Env which requires |display_manager_| to
// be initialized first.
if (context_factory)
aura::Env::GetInstance()->set_context_factory(context_factory);
if (context_factory_private) {
aura::Env::GetInstance()->set_context_factory_private(
context_factory_private);
}

// Night Light depends on the display manager, the display color manager, and
Expand Down Expand Up @@ -1175,7 +1171,10 @@ void Shell::Init(
viz::mojom::VideoDetectorObserverPtr observer;
video_detector_ =
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(
std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura)));
Expand Down Expand Up @@ -1218,12 +1217,10 @@ void Shell::Init(
std::make_unique<SystemNotificationController>();

window_tree_host_manager_->InitHosts();
shell_port_->OnHostsInitialized();

// Needs to be created after InitDisplays() since it may cause the virtual
// keyboard to be deployed.
if (config != Config::MASH_DEPRECATED)
virtual_keyboard_controller_.reset(new VirtualKeyboardController);
virtual_keyboard_controller_ = std::make_unique<VirtualKeyboardController>();

cursor_manager_->HideCursor(); // Hide the mouse cursor on startup.
cursor_manager_->SetCursor(ui::CursorType::kPointer);
Expand Down Expand Up @@ -1448,8 +1445,6 @@ void Shell::OnSessionStateChanged(session_manager::SessionState state) {
break;
}
}

shell_port_->UpdateSystemModalAndBlockingContainers();
}

void Shell::OnLoginStatusChanged(LoginStatus login_status) {
Expand Down
1 change: 0 additions & 1 deletion ash/shell/app_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
}

void DismissAppList() override {
DCHECK(ShellPort::HasInstance());
Shell::Get()->app_list_controller()->DismissAppList();
}

Expand Down
1 change: 1 addition & 0 deletions ash/shell_init_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "ash/shell_delegate.h"
#include "ash/shell_port.h"
#include "base/values.h"
#include "services/ui/ws2/gpu_interface_provider.h"

namespace ash {
Expand Down
35 changes: 0 additions & 35 deletions ash/shell_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
#ifndef ASH_SHELL_PORT_H_
#define ASH_SHELL_PORT_H_

#include <stdint.h>

#include <memory>
#include <vector>

#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"

namespace gfx {
Expand All @@ -25,9 +18,6 @@ enum class PointerWatcherEventTypes;
}

namespace ash {
class RootWindowController;

enum class Config;

// Porting layer for Shell. This class contains the part of Shell that are
// different in classic ash and mus/mash.
Expand All @@ -38,12 +28,9 @@ class ASH_EXPORT ShellPort {
virtual ~ShellPort();

static ShellPort* Get();
static bool HasInstance() { return instance_ != nullptr; }

virtual void Shutdown();

virtual Config GetAshConfig() const = 0;

// Shows the context menu for the wallpaper or shelf at |location_in_screen|.
void ShowContextMenu(const gfx::Point& location_in_screen,
ui::MenuSourceType source_type);
Expand All @@ -58,33 +45,11 @@ class ASH_EXPORT ShellPort {
views::PointerWatcherEventTypes events) = 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;

// 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:
ShellPort();

// Called after WindowTreeHostManager::InitHosts().
virtual void OnHostsInitialized() = 0;

private:
friend class Shell;

Expand Down
39 changes: 0 additions & 39 deletions ash/shell_port_classic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,21 @@
#include "ash/shell_port_classic.h"

#include <memory>
#include <utility>

#include "ash/keyboard/virtual_keyboard_controller.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 {

ShellPortClassic::ShellPortClassic() = default;

ShellPortClassic::~ShellPortClassic() = default;

// static
ShellPortClassic* ShellPortClassic::Get() {
CHECK(Shell::GetAshConfig() == Config::CLASSIC);
return static_cast<ShellPortClassic*>(ShellPort::Get());
}

void ShellPortClassic::Shutdown() {
pointer_watcher_adapter_.reset();

ShellPort::Shutdown();
}

Config ShellPortClassic::GetAshConfig() const {
return Config::CLASSIC;
}

void ShellPortClassic::AddPointerWatcher(
views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) {
Expand All @@ -46,31 +30,8 @@ void ShellPortClassic::RemovePointerWatcher(views::PointerWatcher* 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() {
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
12 changes: 0 additions & 12 deletions ash/shell_port_classic.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define ASH_SHELL_PORT_CLASSIC_H_

#include <memory>
#include <vector>

#include "ash/ash_export.h"
#include "ash/shell_port.h"
Expand All @@ -25,23 +24,12 @@ class ASH_EXPORT ShellPortClassic : public ShellPort {
ShellPortClassic();
~ShellPortClassic() override;

static ShellPortClassic* Get();

// ShellPort:
void Shutdown() override;
Config GetAshConfig() const override;
void AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) override;
void RemovePointerWatcher(views::PointerWatcher* watcher) override;
bool IsTouchDown() override;
void ToggleIgnoreExternalKeyboard() 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:
std::unique_ptr<PointerWatcherAdapterClassic> pointer_watcher_adapter_;
Expand Down
4 changes: 2 additions & 2 deletions ash/system/ime_menu/ime_list_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#include "ash/ime/ime_controller.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/interfaces/ime_info.mojom.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/tray/actionable_view.h"
#include "ash/system/tray/system_menu_button.h"
Expand Down Expand Up @@ -330,7 +330,7 @@ void ImeListView::HandleButtonPressed(views::Button* sender,
const ui::Event& event) {
DCHECK_EQ(sender, keyboard_status_row_->toggle());

ShellPort::Get()->ToggleIgnoreExternalKeyboard();
Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard();
last_selected_item_id_.clear();
last_item_selected_with_keyboard_ = false;
}
Expand Down

0 comments on commit 602164e

Please sign in to comment.