Skip to content

Commit

Permalink
chromeos: Delete ash::ShellPort
Browse files Browse the repository at this point in the history
The class is deprecated since mash switched to //services/ui/ws2.
Inline the remaining code and delete the class.

TBR=sky@chromium.org
TBR=reveman@chromium.org

Bug: 866523
Change-Id: I1b13483cf33abfeb8236a122a60b22c0372e6371
Reviewed-on: https://chromium-review.googlesource.com/1166235
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: Jun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581587}
  • Loading branch information
James Cook authored and Commit Bot committed Aug 8, 2018
1 parent a78cf8e commit fa4838e
Show file tree
Hide file tree
Showing 39 changed files with 74 additions and 289 deletions.
4 changes: 0 additions & 4 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ component("ash") {
"shell_delegate_mash.h",
"shell_init_params.h",
"shell_observer.h",
"shell_port.h",
"shell_port_classic.h",
"shell_state.h",
"shutdown_controller.h",
"shutdown_reason.h",
Expand Down Expand Up @@ -955,8 +953,6 @@ component("ash") {
"shell.cc",
"shell_delegate_mash.cc",
"shell_init_params.cc",
"shell_port.cc",
"shell_port_classic.cc",
"shell_state.cc",
"shutdown_controller.cc",
"shutdown_reason.cc",
Expand Down
3 changes: 1 addition & 2 deletions ash/app_list/app_list_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "ash/public/cpp/config.h"
#include "ash/session/session_controller.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wallpaper/wallpaper_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/logging.h"
Expand Down Expand Up @@ -622,7 +621,7 @@ void AppListControllerImpl::ContextMenuItemSelected(const std::string& id,
void AppListControllerImpl::ShowWallpaperContextMenu(
const gfx::Point& onscreen_location,
ui::MenuSourceType source_type) {
ShellPort::Get()->ShowContextMenu(onscreen_location, source_type);
Shell::Get()->ShowContextMenu(onscreen_location, source_type);
}

void AppListControllerImpl::OnVisibilityChanged(bool visible) {
Expand Down
1 change: 0 additions & 1 deletion ash/app_list/app_list_presenter_delegate_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/test/ash_test_base.h"
#include "ash/wallpaper/wallpaper_controller_test_api.h"
#include "ash/wm/overview/window_selector_controller.h"
Expand Down
2 changes: 0 additions & 2 deletions ash/ash_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "ash/shell.h"
#include "ash/shell_delegate_mash.h"
#include "ash/shell_init_params.h"
#include "ash/shell_port_classic.h"
#include "ash/ws/ash_gpu_interface_provider.h"
#include "ash/ws/window_service_owner.h"
#include "base/bind.h"
Expand Down Expand Up @@ -172,7 +171,6 @@ void AshService::InitForMash() {
statistics_provider_->SetMachineStatistic("keyboard_layout", "");

ShellInitParams shell_init_params;
shell_init_params.shell_port = std::make_unique<ash::ShellPortClassic>();
shell_init_params.delegate = std::make_unique<ShellDelegateMash>();
shell_init_params.context_factory = context_factory_.get();
shell_init_params.context_factory_private =
Expand Down
3 changes: 0 additions & 3 deletions ash/host/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ include_rules = [
]

specific_include_rules = {
"ash_window_tree_host.cc": [
"+ash/shell_port.h",
],
"ash_window_tree_host_mus.cc": [
"+ash/shell.h",
"+ash/shell_delegate.h",
Expand Down
6 changes: 2 additions & 4 deletions ash/metrics/pointer_metrics_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "ash/display/screen_orientation_controller.h"
#include "ash/public/cpp/app_types.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/metrics/histogram_macros.h"
#include "ui/aura/client/aura_constants.h"
Expand Down Expand Up @@ -85,12 +84,11 @@ void RecordUMA(ui::EventPointerType type, views::Widget* target) {
} // namespace

PointerMetricsRecorder::PointerMetricsRecorder() {
ShellPort::Get()->AddPointerWatcher(this,
views::PointerWatcherEventTypes::BASIC);
Shell::Get()->AddPointerWatcher(this, views::PointerWatcherEventTypes::BASIC);
}

PointerMetricsRecorder::~PointerMetricsRecorder() {
ShellPort::Get()->RemovePointerWatcher(this);
Shell::Get()->RemovePointerWatcher(this);
}

void PointerMetricsRecorder::OnPointerEventObserved(
Expand Down
2 changes: 1 addition & 1 deletion ash/pointer_watcher_adapter_classic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ASH_EXPORT PointerWatcherAdapterClassic : public ui::EventHandler {
PointerWatcherAdapterClassic();
~PointerWatcherAdapterClassic() override;

// See ShellPort::AddPointerWatcher() for details.
// See Shell::AddPointerWatcher() for details.
void AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events);
void RemovePointerWatcher(views::PointerWatcher* watcher);
Expand Down
7 changes: 2 additions & 5 deletions ash/pointer_watcher_adapter_classic_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "ash/public/cpp/config.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/test/ash_test_base.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
Expand All @@ -31,11 +30,9 @@ enum TestPointerCaptureEvents {
class TestPointerWatcher : public views::PointerWatcher {
public:
explicit TestPointerWatcher(views::PointerWatcherEventTypes events) {
ShellPort::Get()->AddPointerWatcher(this, events);
}
~TestPointerWatcher() override {
ShellPort::Get()->RemovePointerWatcher(this);
Shell::Get()->AddPointerWatcher(this, events);
}
~TestPointerWatcher() override { Shell::Get()->RemovePointerWatcher(this); }

void ClearCounts() {
pointer_event_count_ = capture_changed_count_ = mouse_wheel_event_count_ =
Expand Down
6 changes: 3 additions & 3 deletions ash/public/cpp/immersive/immersive_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ASH_PUBLIC_EXPORT ImmersiveContext {
public:
static ImmersiveContext* Get() { return instance_; }

// Mirrors that of ShellPort::InstallResizeHandleWindowTargeter(), see it
// Mirrors that of Shell::InstallResizeHandleWindowTargeter(), see it
// for details
virtual void InstallResizeHandleWindowTargeter(
ImmersiveFullscreenController* controller) = 0;
Expand All @@ -47,15 +47,15 @@ class ASH_PUBLIC_EXPORT ImmersiveContext {
// Returns the bounds of the display the widget is on, in screen coordinates.
virtual gfx::Rect GetDisplayBoundsInScreen(views::Widget* widget) = 0;

// See ShellPort::AddPointerWatcher for details.
// See Shell::AddPointerWatcher for details.
virtual void AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) = 0;
virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0;

// Returns true if any window has capture.
virtual bool DoesAnyWindowHaveCapture() = 0;

// See ShellPort::IsMouseEventsEnabled() for details.
// See Shell::IsMouseEventsEnabled() for details.
virtual bool IsMouseEventsEnabled() = 0;

protected:
Expand Down
6 changes: 2 additions & 4 deletions ash/shelf/overflow_bubble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/system/tray/tray_background_view.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/widget/widget.h"
Expand All @@ -20,13 +19,12 @@ namespace ash {
OverflowBubble::OverflowBubble(Shelf* shelf)
: shelf_(shelf), bubble_(nullptr), overflow_button_(nullptr) {
DCHECK(shelf_);
ShellPort::Get()->AddPointerWatcher(this,
views::PointerWatcherEventTypes::BASIC);
Shell::Get()->AddPointerWatcher(this, views::PointerWatcherEventTypes::BASIC);
}

OverflowBubble::~OverflowBubble() {
Hide();
ShellPort::Get()->RemovePointerWatcher(this);
Shell::Get()->RemovePointerWatcher(this);
}

void OverflowBubble::Show(OverflowButton* overflow_button,
Expand Down
6 changes: 2 additions & 4 deletions ash/shelf/shelf_tooltip_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/shelf/shelf_tooltip_preview_bubble.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm/window_util.h"
#include "base/bind.h"
#include "base/strings/string16.h"
Expand All @@ -37,12 +36,11 @@ ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view)
bubble_(nullptr),
weak_factory_(this) {
shelf_view_->shelf()->AddObserver(this);
ShellPort::Get()->AddPointerWatcher(this,
views::PointerWatcherEventTypes::BASIC);
Shell::Get()->AddPointerWatcher(this, views::PointerWatcherEventTypes::BASIC);
}

ShelfTooltipManager::~ShelfTooltipManager() {
ShellPort::Get()->RemovePointerWatcher(this);
Shell::Get()->RemovePointerWatcher(this);
shelf_view_->shelf()->RemoveObserver(this);
aura::Window* window = nullptr;
if (shelf_view_->GetWidget())
Expand Down
1 change: 0 additions & 1 deletion ash/shelf/shelf_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell_port.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/status_area_widget.h"
#include "ash/wm/mru_window_tracker.h"
Expand Down
43 changes: 28 additions & 15 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include "ash/multi_device_setup/multi_device_notification_presenter.h"
#include "ash/new_window_controller.h"
#include "ash/note_taking_controller.h"
#include "ash/pointer_watcher_adapter_classic.h"
#include "ash/policy/policy_recommendation_restorer.h"
#include "ash/public/cpp/ash_constants.h"
#include "ash/public/cpp/ash_features.h"
Expand All @@ -85,8 +86,6 @@
#include "ash/shell_delegate.h"
#include "ash/shell_init_params.h"
#include "ash/shell_observer.h"
#include "ash/shell_port.h"
#include "ash/shell_port_classic.h"
#include "ash/shell_state.h"
#include "ash/shutdown_controller.h"
#include "ash/sticky_keys/sticky_keys_controller.h"
Expand Down Expand Up @@ -270,9 +269,7 @@ Shell* Shell::instance_ = nullptr;
// static
Shell* Shell::CreateInstance(ShellInitParams init_params) {
CHECK(!instance_);
instance_ =
new Shell(std::move(init_params.delegate),
std::move(init_params.shell_port), init_params.connector);
instance_ = new Shell(std::move(init_params.delegate), init_params.connector);
instance_->Init(init_params.context_factory,
init_params.context_factory_private,
std::move(init_params.initial_display_prefs),
Expand Down Expand Up @@ -500,7 +497,6 @@ void Shell::EnableKeyboard() {
}

void Shell::DisableKeyboard() {
// TODO(jamescook): Move keyboard create and hide into ShellPort.
keyboard_ui_->Hide();
if (keyboard_controller_->enabled()) {
for (auto* const controller : GetAllRootWindowControllers())
Expand Down Expand Up @@ -588,6 +584,29 @@ bool Shell::IsSplitViewModeActive() const {
split_view_controller_->IsSplitViewModeActive();
}

void Shell::ShowContextMenu(const gfx::Point& location_in_screen,
ui::MenuSourceType source_type) {
// Bail with no active user session, in the lock screen, or in app/kiosk mode.
if (session_controller_->NumberOfLoggedInUsers() < 1 ||
session_controller_->IsScreenLocked() ||
session_controller_->IsRunningInAppMode()) {
return;
}

aura::Window* root = wm::GetRootWindowAt(location_in_screen);
RootWindowController::ForWindow(root)->ShowContextMenu(location_in_screen,
source_type);
}

void Shell::AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) {
pointer_watcher_adapter_->AddPointerWatcher(watcher, events);
}

void Shell::RemovePointerWatcher(views::PointerWatcher* watcher) {
pointer_watcher_adapter_->RemovePointerWatcher(watcher);
}

void Shell::AddShellObserver(ShellObserver* observer) {
shell_observers_.AddObserver(observer);
}
Expand Down Expand Up @@ -667,10 +686,8 @@ void Shell::NotifyAppListVisibilityChanged(bool visible,
// Shell, private:

Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate,
std::unique_ptr<ShellPort> shell_port,
service_manager::Connector* connector)
: shell_port_(std::move(shell_port)),
ash_display_controller_(std::make_unique<AshDisplayController>()),
: ash_display_controller_(std::make_unique<AshDisplayController>()),
brightness_control_delegate_(
std::make_unique<system::BrightnessControllerChromeos>()),
cast_config_(std::make_unique<CastConfigController>()),
Expand Down Expand Up @@ -887,7 +904,7 @@ Shell::~Shell() {
// Must be released before |focus_controller_|.
ime_focus_handler_.reset();

shell_port_->Shutdown();
pointer_watcher_adapter_.reset();

// Stop observing window activation changes before closing all windows.
focus_controller_->RemoveObserver(this);
Expand Down Expand Up @@ -916,8 +933,6 @@ Shell::~Shell() {
// Depends on SessionController.
power_event_observer_.reset();

// Needs to happen right before |instance_| is reset.
shell_port_.reset();
session_controller_->RemoveObserver(this);
// BluetoothPowerController depends on the PrefService and must be destructed
// before it.
Expand Down Expand Up @@ -991,8 +1006,6 @@ void Shell::Init(

tablet_mode_controller_ = std::make_unique<TabletModeController>();

// Some delegates access ShellPort during their construction. Create them here
// instead of the ShellPort constructor.
accessibility_focus_ring_controller_ =
std::make_unique<AccessibilityFocusRingController>();
accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate());
Expand Down Expand Up @@ -1187,7 +1200,7 @@ void Shell::Init(

// Must occur after Shell has installed its early pre-target handlers (for
// example, WindowModalityController).
shell_port_->CreatePointerWatcherAdapter();
pointer_watcher_adapter_ = std::make_unique<PointerWatcherAdapterClassic>();

resize_shadow_controller_.reset(new ResizeShadowController());
shadow_controller_.reset(new ::wm::ShadowController(
Expand Down
Loading

0 comments on commit fa4838e

Please sign in to comment.