Skip to content

Commit

Permalink
mus namespace -> ui namespace
Browse files Browse the repository at this point in the history
TBR=sky@chromium.org,dcheng@chromium.org
http://crbug.com/623400

Review-Url: https://codereview.chromium.org/2115233002
Cr-Commit-Position: refs/heads/master@{#403634}
  • Loading branch information
ben authored and Commit bot committed Jul 4, 2016
1 parent 00e4dbc commit 3a06a27
Show file tree
Hide file tree
Showing 412 changed files with 1,921 additions and 1,948 deletions.
2 changes: 1 addition & 1 deletion ash/common/wm_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class WindowState;
}

// This class exists as a porting layer to allow ash/wm to work with
// aura::Window or mus::Window. See aura::Window for details on the functions.
// aura::Window or ui::Window. See aura::Window for details on the functions.
class ASH_EXPORT WmWindow {
public:
// See comments in SetBoundsInScreen().
Expand Down
6 changes: 3 additions & 3 deletions ash/mus/accelerator_registrar_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace {
const int kAcceleratorIdMask = 0xffff;

void CallAddAcceleratorCallback(
const ::mus::mojom::AcceleratorRegistrar::AddAcceleratorCallback& callback,
const ::ui::mojom::AcceleratorRegistrar::AddAcceleratorCallback& callback,
bool result) {
callback.Run(result);
}
Expand Down Expand Up @@ -97,15 +97,15 @@ void AcceleratorRegistrarImpl::RemoveAllAccelerators() {
}

void AcceleratorRegistrarImpl::SetHandler(
::mus::mojom::AcceleratorHandlerPtr handler) {
::ui::mojom::AcceleratorHandlerPtr handler) {
accelerator_handler_ = std::move(handler);
accelerator_handler_.set_connection_error_handler(base::Bind(
&AcceleratorRegistrarImpl::OnHandlerGone, base::Unretained(this)));
}

void AcceleratorRegistrarImpl::AddAccelerator(
uint32_t accelerator_id,
::mus::mojom::EventMatcherPtr matcher,
::ui::mojom::EventMatcherPtr matcher,
const AddAcceleratorCallback& callback) {
if (!accelerator_handler_ ||
(accelerator_id & kAcceleratorIdMask) != accelerator_id) {
Expand Down
10 changes: 5 additions & 5 deletions ash/mus/accelerator_registrar_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WindowManager;
// connection. This manages its own lifetime, and destroys itself when the
// AcceleratorRegistrar and all its AcceleratorHandlers are disconnected. Upon
// destruction, it calls the DestroyCallback.
class AcceleratorRegistrarImpl : public ::mus::mojom::AcceleratorRegistrar,
class AcceleratorRegistrarImpl : public ::ui::mojom::AcceleratorRegistrar,
public WindowManagerObserver {
public:
using DestroyCallback = base::Callback<void(AcceleratorRegistrarImpl*)>;
Expand All @@ -51,10 +51,10 @@ class AcceleratorRegistrarImpl : public ::mus::mojom::AcceleratorRegistrar,

void RemoveAllAccelerators();

// ::mus::mojom::AcceleratorRegistrar:
void SetHandler(::mus::mojom::AcceleratorHandlerPtr handler) override;
// ::ui::mojom::AcceleratorRegistrar:
void SetHandler(::ui::mojom::AcceleratorHandlerPtr handler) override;
void AddAccelerator(uint32_t accelerator_id,
::mus::mojom::EventMatcherPtr matcher,
::ui::mojom::EventMatcherPtr matcher,
const AddAcceleratorCallback& callback) override;
void RemoveAccelerator(uint32_t accelerator_id) override;

Expand All @@ -63,7 +63,7 @@ class AcceleratorRegistrarImpl : public ::mus::mojom::AcceleratorRegistrar,
void OnWindowTreeClientDestroyed() override;

WindowManager* window_manager_;
::mus::mojom::AcceleratorHandlerPtr accelerator_handler_;
::ui::mojom::AcceleratorHandlerPtr accelerator_handler_;
mojo::Binding<AcceleratorRegistrar> binding_;
uint32_t accelerator_namespace_;
std::set<uint32_t> accelerators_;
Expand Down
30 changes: 15 additions & 15 deletions ash/mus/accelerator_registrar_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/interfaces/accelerator_registrar.mojom.h"

using ::mus::mojom::AcceleratorHandler;
using ::mus::mojom::AcceleratorHandlerPtr;
using ::mus::mojom::AcceleratorRegistrar;
using ::mus::mojom::AcceleratorRegistrarPtr;
using ::ui::mojom::AcceleratorHandler;
using ::ui::mojom::AcceleratorHandlerPtr;
using ::ui::mojom::AcceleratorRegistrar;
using ::ui::mojom::AcceleratorRegistrarPtr;

namespace ash {
namespace mus {
Expand All @@ -36,7 +36,7 @@ class TestAcceleratorHandler : public AcceleratorHandler {
// Attempts to install an accelerator with the specified id and event matcher.
// Returns whether the accelerator could be successfully added or not.
bool AttemptToInstallAccelerator(uint32_t accelerator_id,
::mus::mojom::EventMatcherPtr matcher) {
::ui::mojom::EventMatcherPtr matcher) {
DCHECK(!run_loop_);
registrar_->AddAccelerator(
accelerator_id, std::move(matcher),
Expand Down Expand Up @@ -86,30 +86,30 @@ TEST_F(AcceleratorRegistrarTest, AcceleratorRegistrarBasic) {
ConnectToRegistrar(&registrar_first);
TestAcceleratorHandler handler_first(std::move(registrar_first));
EXPECT_TRUE(handler_first.AttemptToInstallAccelerator(
1, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::T,
ui::mojom::kEventFlagShiftDown)));
1, ::ui::CreateKeyMatcher(ui::mojom::KeyboardCode::T,
ui::mojom::kEventFlagShiftDown)));
// Attempting to add an accelerator with the same accelerator id from the same
// registrar should fail.
EXPECT_FALSE(handler_first.AttemptToInstallAccelerator(
1, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));
1, ::ui::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));

// Attempting to add an accelerator with the same id from a different
// registrar should be OK.
AcceleratorRegistrarPtr registrar_second;
ConnectToRegistrar(&registrar_second);
TestAcceleratorHandler handler_second(std::move(registrar_second));
EXPECT_TRUE(handler_second.AttemptToInstallAccelerator(
1, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));
1, ::ui::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));

// But attempting to add an accelerator with the same matcher should fail.
EXPECT_FALSE(handler_first.AttemptToInstallAccelerator(
3, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));
3, ::ui::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));
EXPECT_FALSE(handler_second.AttemptToInstallAccelerator(
3, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));
3, ::ui::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
ui::mojom::kEventFlagShiftDown)));
}

} // namespace mus
Expand Down
4 changes: 2 additions & 2 deletions ash/mus/app_launch_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ TEST_F(AppLaunchTest, TestQuickLaunch) {
connector()->Connect("mojo:ash");
connector()->Connect("mojo:quick_launch");

::mus::mojom::WindowServerTestPtr test_interface;
connector()->ConnectToInterface("mojo:mus", &test_interface);
::ui::mojom::WindowServerTestPtr test_interface;
connector()->ConnectToInterface("mojo:ui", &test_interface);

base::RunLoop run_loop;
bool success = false;
Expand Down
10 changes: 5 additions & 5 deletions ash/mus/bridge/mus_layout_manager_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ MusLayoutManagerAdapter::ChildWindowObserver::ChildWindowObserver(
MusLayoutManagerAdapter::ChildWindowObserver::~ChildWindowObserver() {}

void MusLayoutManagerAdapter::ChildWindowObserver::OnWindowVisibilityChanged(
::mus::Window* window) {
::ui::Window* window) {
adapter_->layout_manager_->OnChildWindowVisibilityChanged(
WmWindowMus::Get(window), window->visible());
}

MusLayoutManagerAdapter::MusLayoutManagerAdapter(
::mus::Window* window,
::ui::Window* window,
std::unique_ptr<WmLayoutManager> layout_manager)
: window_(window),
child_window_observer_(this),
layout_manager_(std::move(layout_manager)) {
window_->AddObserver(this);
for (::mus::Window* child : window_->children())
for (::ui::Window* child : window_->children())
child->AddObserver(&child_window_observer_);
}

MusLayoutManagerAdapter::~MusLayoutManagerAdapter() {
for (::mus::Window* child : window_->children())
for (::ui::Window* child : window_->children())
child->RemoveObserver(&child_window_observer_);

window_->RemoveObserver(this);
Expand All @@ -59,7 +59,7 @@ void MusLayoutManagerAdapter::OnTreeChanged(const TreeChangeParams& params) {
}

void MusLayoutManagerAdapter::OnWindowBoundsChanged(
::mus::Window* window,
::ui::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
layout_manager_->OnWindowResized();
Expand Down
24 changes: 12 additions & 12 deletions ash/mus/bridge/mus_layout_manager_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,50 @@ class WmLayoutManager;

namespace mus {

// Used to associate a mus::Window with an WmLayoutManager. This
// attaches an observer to the mus::Window and calls the appropriate methods on
// Used to associate a ui::Window with an WmLayoutManager. This
// attaches an observer to the ui::Window and calls the appropriate methods on
// the WmLayoutManager at the appropriate time.
//
// NOTE: WmLayoutManager provides the function SetChildBounds(). This is
// expected to be called to change the bounds of the Window. For aura this
// function is called by way of aura exposing a hook (aura::LayoutManager). Mus
// has no such hook. To ensure SetChildBounds() is called correctly all bounds
// changes to mus::Windows must be routed through WmWindowMus. WmWindowMus
// changes to ui::Windows must be routed through WmWindowMus. WmWindowMus
// ensures WmLayoutManager::SetChildBounds() is called appropriately.
class MusLayoutManagerAdapter : public ::mus::WindowObserver {
class MusLayoutManagerAdapter : public ::ui::WindowObserver {
public:
MusLayoutManagerAdapter(::mus::Window* window,
MusLayoutManagerAdapter(::ui::Window* window,
std::unique_ptr<WmLayoutManager> layout_manager);
~MusLayoutManagerAdapter() override;

WmLayoutManager* layout_manager() { return layout_manager_.get(); }

private:
// WindowObserver attached to child windows. A separate class is used to
// easily differentiate WindowObserver calls on the mus::Window associated
// easily differentiate WindowObserver calls on the ui::Window associated
// with the MusLayoutManagerAdapter, vs children.
class ChildWindowObserver : public ::mus::WindowObserver {
class ChildWindowObserver : public ::ui::WindowObserver {
public:
explicit ChildWindowObserver(MusLayoutManagerAdapter* adapter);
~ChildWindowObserver() override;

private:
// mus::WindowObserver:
void OnWindowVisibilityChanged(::mus::Window* window) override;
// ui::WindowObserver:
void OnWindowVisibilityChanged(::ui::Window* window) override;

MusLayoutManagerAdapter* adapter_;

DISALLOW_COPY_AND_ASSIGN(ChildWindowObserver);
};

// mus::WindowObserver:
// ui::WindowObserver:
void OnTreeChanging(const TreeChangeParams& params) override;
void OnTreeChanged(const TreeChangeParams& params) override;
void OnWindowBoundsChanged(::mus::Window* window,
void OnWindowBoundsChanged(::ui::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;

::mus::Window* window_;
::ui::Window* window_;
ChildWindowObserver child_window_observer_;
std::unique_ptr<WmLayoutManager> layout_manager_;

Expand Down
6 changes: 3 additions & 3 deletions ash/mus/bridge/wm_root_window_controller_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ WmRootWindowControllerMus::~WmRootWindowControllerMus() {

// static
const WmRootWindowControllerMus* WmRootWindowControllerMus::Get(
const ::mus::Window* window) {
const ::ui::Window* window) {
if (!window)
return nullptr;

Expand Down Expand Up @@ -120,13 +120,13 @@ void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer(
WmWindowMus::Get(root_window_controller_->root())
->GetChildByShellWindowId(shell_container_id));
DCHECK(init_params->parent_mus);
::mus::Window* new_window =
::ui::Window* new_window =
root_window_controller_->root()->window_tree()->NewWindow();
WmWindowMus::Get(new_window)
->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL);
init_params->native_widget = new views::NativeWidgetMus(
widget, root_window_controller_->GetConnector(), new_window,
::mus::mojom::SurfaceType::DEFAULT);
::ui::mojom::SurfaceType::DEFAULT);
}

WmWindow* WmRootWindowControllerMus::FindEventTarget(
Expand Down
8 changes: 4 additions & 4 deletions ash/mus/bridge/wm_root_window_controller_mus.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace display {
class Display;
}

namespace mus {
namespace ui {
class Window;
}

Expand All @@ -31,11 +31,11 @@ class WmRootWindowControllerMus : public WmRootWindowController {
RootWindowController* root_window_controller);
~WmRootWindowControllerMus() override;

static WmRootWindowControllerMus* Get(::mus::Window* window) {
static WmRootWindowControllerMus* Get(::ui::Window* window) {
return const_cast<WmRootWindowControllerMus*>(
Get(const_cast<const ::mus::Window*>(window)));
Get(const_cast<const ::ui::Window*>(window)));
}
static const WmRootWindowControllerMus* Get(const ::mus::Window* window);
static const WmRootWindowControllerMus* Get(const ::ui::Window* window);

RootWindowController* root_window_controller() {
return root_window_controller_;
Expand Down
12 changes: 6 additions & 6 deletions ash/mus/bridge/wm_shell_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class SessionStateDelegateStub : public SessionStateDelegate {

} // namespace

WmShellMus::WmShellMus(::mus::WindowTreeClient* client)
WmShellMus::WmShellMus(::ui::WindowTreeClient* client)
: client_(client), session_state_delegate_(new SessionStateDelegateStub) {
client_->AddObserver(this);
WmShell::Set(this);
Expand Down Expand Up @@ -132,7 +132,7 @@ void WmShellMus::RemoveRootWindowController(
}

// static
WmWindowMus* WmShellMus::GetToplevelAncestor(::mus::Window* window) {
WmWindowMus* WmShellMus::GetToplevelAncestor(::ui::Window* window) {
while (window) {
if (IsActivationParent(window->parent()))
return WmWindowMus::Get(window);
Expand Down Expand Up @@ -298,7 +298,7 @@ void WmShellMus::ToggleIgnoreExternalKeyboard() {
#endif // defined(OS_CHROMEOS)

// static
bool WmShellMus::IsActivationParent(::mus::Window* window) {
bool WmShellMus::IsActivationParent(::ui::Window* window) {
return window && IsActivatableShellWindowId(
WmWindowMus::Get(window)->GetShellWindowId());
}
Expand All @@ -312,8 +312,8 @@ void WmShellMus::RemoveClientObserver() {
}

// TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114.
void WmShellMus::OnWindowTreeFocusChanged(::mus::Window* gained_focus,
::mus::Window* lost_focus) {
void WmShellMus::OnWindowTreeFocusChanged(::ui::Window* gained_focus,
::ui::Window* lost_focus) {
WmWindowMus* gained_active = GetToplevelAncestor(gained_focus);
WmWindowMus* lost_active = GetToplevelAncestor(gained_focus);
if (gained_active == lost_active)
Expand All @@ -323,7 +323,7 @@ void WmShellMus::OnWindowTreeFocusChanged(::mus::Window* gained_focus,
OnWindowActivated(gained_active, lost_active));
}

void WmShellMus::OnDidDestroyClient(::mus::WindowTreeClient* client) {
void WmShellMus::OnDidDestroyClient(::ui::WindowTreeClient* client) {
DCHECK_EQ(client, client_);
RemoveClientObserver();
}
Expand Down
20 changes: 10 additions & 10 deletions ash/mus/bridge/wm_shell_mus.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "base/observer_list.h"
#include "services/ui/public/cpp/window_tree_client_observer.h"

namespace mus {
namespace ui {
class WindowTreeClient;
}

Expand All @@ -25,9 +25,9 @@ class WmRootWindowControllerMus;
class WmWindowMus;

// WmShell implementation for mus.
class WmShellMus : public WmShell, public ::mus::WindowTreeClientObserver {
class WmShellMus : public WmShell, public ::ui::WindowTreeClientObserver {
public:
explicit WmShellMus(::mus::WindowTreeClient* client);
explicit WmShellMus(::ui::WindowTreeClient* client);
~WmShellMus() override;

static WmShellMus* Get();
Expand All @@ -37,7 +37,7 @@ class WmShellMus : public WmShell, public ::mus::WindowTreeClientObserver {

// Returns the ancestor of |window| (including |window|) that is considered
// toplevel. |window| may be null.
static WmWindowMus* GetToplevelAncestor(::mus::Window* window);
static WmWindowMus* GetToplevelAncestor(::ui::Window* window);

WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id);

Expand Down Expand Up @@ -81,16 +81,16 @@ class WmShellMus : public WmShell, public ::mus::WindowTreeClientObserver {

private:
// Returns true if |window| is a window that can have active children.
static bool IsActivationParent(::mus::Window* window);
static bool IsActivationParent(::ui::Window* window);

void RemoveClientObserver();

// ::mus::WindowTreeClientObserver:
void OnWindowTreeFocusChanged(::mus::Window* gained_focus,
::mus::Window* lost_focus) override;
void OnDidDestroyClient(::mus::WindowTreeClient* client) override;
// ::ui::WindowTreeClientObserver:
void OnWindowTreeFocusChanged(::ui::Window* gained_focus,
::ui::Window* lost_focus) override;
void OnDidDestroyClient(::ui::WindowTreeClient* client) override;

::mus::WindowTreeClient* client_;
::ui::WindowTreeClient* client_;

std::vector<WmRootWindowControllerMus*> root_window_controllers_;

Expand Down
Loading

0 comments on commit 3a06a27

Please sign in to comment.