Skip to content

Commit

Permalink
wm: public window_types.
Browse files Browse the repository at this point in the history
Patch manually generated by:

$ git grep -l aura::client::WINDOW_TYPE | xargs sed -i -e 's/aura::client::WINDOW_TYPE/ui::wm::WINDOW_TYPE/g'
$ git commit -a -m.
$ git clang-format HEAD^ --style=Chromium
$ git commit -a -m.

* Move window_types.h header from ui/aura/client/ to ui/wm/public/

BUG=319638
TEST=ash_unittests, aura_unittests, views_unittests, unit_tests
[email protected]

Review URL: https://codereview.chromium.org/115153002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241752 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
[email protected] committed Dec 19, 2013
1 parent 8eb21c9 commit 5b251f1
Show file tree
Hide file tree
Showing 71 changed files with 228 additions and 249 deletions.
2 changes: 1 addition & 1 deletion ash/accelerators/accelerator_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ bool HandleWindowSnap(int action) {
// Disable window snapping shortcut key for full screen window due to
// http://crbug.com/135487.
if (!window_state ||
window_state->window()->type() != aura::client::WINDOW_TYPE_NORMAL ||
window_state->window()->type() != ui::wm::WINDOW_TYPE_NORMAL ||
window_state->IsFullscreen()) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion ash/display/screen_position_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ScreenPositionControllerTest : public test::AshTestBase {
virtual void SetUp() OVERRIDE {
AshTestBase::SetUp();
window_.reset(new aura::Window(&window_delegate_));
window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window_->SetType(ui::wm::WINDOW_TYPE_NORMAL);
window_->Init(ui::LAYER_NOT_DRAWN);
ParentWindowInPrimaryRootWindow(window_.get());
window_->set_id(1);
Expand Down
2 changes: 1 addition & 1 deletion ash/drag_drop/drag_drop_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace {
aura::Window* CreateCaptureWindow(aura::Window* context_root,
aura::WindowDelegate* delegate) {
aura::Window* window = new aura::Window(delegate);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_NOT_DRAWN);
aura::client::ParentWindowWithContext(window, context_root, gfx::Rect());
window->Show();
Expand Down
8 changes: 4 additions & 4 deletions ash/root_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/tooltip_client.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
Expand All @@ -68,6 +67,7 @@
#include "ui/views/corewm/visibility_controller.h"
#include "ui/views/view_model.h"
#include "ui/views/view_model_utils.h"
#include "ui/wm/public/window_types.h"

#if defined(OS_CHROMEOS)
#include "ash/wm/boot_splash_screen_chromeos.h"
Expand Down Expand Up @@ -288,7 +288,7 @@ RootWindowController* RootWindowController::ForTargetRootWindow() {
aura::Window* RootWindowController::GetContainerForWindow(
aura::Window* window) {
aura::Window* container = window->parent();
while (container && container->type() != aura::client::WINDOW_TYPE_UNKNOWN)
while (container && container->type() != ui::wm::WINDOW_TYPE_UNKNOWN)
container = container->parent();
return container;
}
Expand Down Expand Up @@ -566,8 +566,8 @@ const aura::Window* RootWindowController::GetWindowForFullscreenMode() const {
const aura::Window* topmost_window = NULL;
for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin();
iter != windows.rend(); ++iter) {
if (((*iter)->type() == aura::client::WINDOW_TYPE_NORMAL ||
(*iter)->type() == aura::client::WINDOW_TYPE_PANEL) &&
if (((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL ||
(*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) &&
(*iter)->layer()->GetTargetVisibility()) {
topmost_window = *iter;
break;
Expand Down
4 changes: 2 additions & 2 deletions ash/root_window_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
unparented_control->GetNativeView()->parent()->id());

aura::Window* panel = CreateTestWindowInShellWithDelegateAndType(
NULL, aura::client::WINDOW_TYPE_PANEL, 0, gfx::Rect(700, 100, 100, 100));
NULL, ui::wm::WINDOW_TYPE_PANEL, 0, gfx::Rect(700, 100, 100, 100));
EXPECT_EQ(root_windows[1], panel->GetRootWindow());
EXPECT_EQ(internal::kShellWindowId_PanelContainer, panel->parent()->id());

Expand Down Expand Up @@ -526,7 +526,7 @@ TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) {
DestroyedWindowObserver observer1;
aura::test::TestWindowDelegate delegate1;
aura::Window* window1 = new aura::Window(&delegate1);
window1->SetType(aura::client::WINDOW_TYPE_CONTROL);
window1->SetType(ui::wm::WINDOW_TYPE_CONTROL);
window1->set_owned_by_parent(false);
observer1.SetWindow(window1);
window1->Init(ui::LAYER_NOT_DRAWN);
Expand Down
2 changes: 1 addition & 1 deletion ash/shelf/shelf_layout_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class ShelfLayoutManagerTest : public ash::test::AshTestBase {
aura::Window* CreateTestWindow() {
aura::Window* window = new aura::Window(NULL);
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
ParentWindowInPrimaryRootWindow(window);
return window;
Expand Down
9 changes: 5 additions & 4 deletions ash/shell/window_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ aura::Window* WindowWatcher::GetWindowByID(ash::LauncherID id) {

// aura::WindowObserver overrides:
void WindowWatcher::OnWindowAdded(aura::Window* new_window) {
if (new_window->type() != aura::client::WINDOW_TYPE_NORMAL &&
new_window->type() != aura::client::WINDOW_TYPE_PANEL)
if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL &&
new_window->type() != ui::wm::WINDOW_TYPE_PANEL)
return;

static int image_count = 0;
ShelfModel* model = Shell::GetInstance()->shelf_model();
LauncherItem item;
item.type = new_window->type() == aura::client::WINDOW_TYPE_PANEL ?
ash::TYPE_APP_PANEL : ash::TYPE_PLATFORM_APP;
item.type = new_window->type() == ui::wm::WINDOW_TYPE_PANEL
? ash::TYPE_APP_PANEL
: ash::TYPE_PLATFORM_APP;
ash::LauncherID id = model->next_id();
id_to_window_[id] = new_window;

Expand Down
2 changes: 1 addition & 1 deletion ash/shell/window_watcher_shelf_item_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {

bool WindowWatcherShelfItemDelegate::ItemSelected(const ui::Event& event) {
aura::Window* window = watcher_->GetWindowByID(id_);
if (window->type() == aura::client::WINDOW_TYPE_PANEL)
if (window->type() == ui::wm::WINDOW_TYPE_PANEL)
wm::MoveWindowToEventRoot(window, event);
window->Show();
wm::ActivateWindow(window);
Expand Down
2 changes: 1 addition & 1 deletion ash/shell_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ TEST_F(ShellTest, FullscreenWindowHidesShelf) {
TEST_F(ShellTest, ToggleAutoHide) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
ParentWindowInPrimaryRootWindow(window.get());
window->Show();
Expand Down
7 changes: 2 additions & 5 deletions ash/test/ash_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,12 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegate(
int id,
const gfx::Rect& bounds) {
return CreateTestWindowInShellWithDelegateAndType(
delegate,
aura::client::WINDOW_TYPE_NORMAL,
id,
bounds);
delegate, ui::wm::WINDOW_TYPE_NORMAL, id, bounds);
}

aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType(
aura::WindowDelegate* delegate,
aura::client::WindowType type,
ui::wm::WindowType type,
int id,
const gfx::Rect& bounds) {
aura::Window* window = new aura::Window(delegate);
Expand Down
4 changes: 2 additions & 2 deletions ash/test/ash_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/client/window_types.h"
#include "ui/views/test/test_views_delegate.h"
#include "ui/wm/public/window_types.h"

#if defined(OS_WIN)
#include "ui/base/win/scoped_ole_initializer.h"
Expand Down Expand Up @@ -83,7 +83,7 @@ class AshTestBase : public testing::Test {
const gfx::Rect& bounds);
aura::Window* CreateTestWindowInShellWithDelegateAndType(
aura::WindowDelegate* delegate,
aura::client::WindowType type,
ui::wm::WindowType type,
int id,
const gfx::Rect& bounds);

Expand Down
2 changes: 1 addition & 1 deletion ash/test/test_shelf_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void TestShelfDelegate::AddLauncherItem(aura::Window* window) {
void TestShelfDelegate::AddLauncherItem(aura::Window* window,
LauncherItemStatus status) {
LauncherItem item;
if (window->type() == aura::client::WINDOW_TYPE_PANEL)
if (window->type() == ui::wm::WINDOW_TYPE_PANEL)
item.type = TYPE_APP_PANEL;
else
item.type = TYPE_PLATFORM_APP;
Expand Down
2 changes: 1 addition & 1 deletion ash/test/test_shelf_item_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TestShelfItemDelegate::~TestShelfItemDelegate() {

bool TestShelfItemDelegate::ItemSelected(const ui::Event& event) {
if (window_) {
if (window_->type() == aura::client::WINDOW_TYPE_PANEL)
if (window_->type() == ui::wm::WINDOW_TYPE_PANEL)
wm::MoveWindowToEventRoot(window_, event);
window_->Show();
wm::ActivateWindow(window_);
Expand Down
4 changes: 2 additions & 2 deletions ash/wm/always_on_top_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void AlwaysOnTopController::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) {
if (key == aura::client::kAlwaysOnTopKey) {
DCHECK(window->type() == aura::client::WINDOW_TYPE_NORMAL ||
window->type() == aura::client::WINDOW_TYPE_POPUP);
DCHECK(window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
window->type() == ui::wm::WINDOW_TYPE_POPUP);
aura::Window* container = GetContainer(window);
if (window->parent() != container)
container->AddChild(window);
Expand Down
4 changes: 2 additions & 2 deletions ash/wm/dock/docked_window_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace {

// Returns true if a window is a popup or a transient child.
bool IsPopupOrTransient(const aura::Window* window) {
return (window->type() == aura::client::WINDOW_TYPE_POPUP ||
return (window->type() == ui::wm::WINDOW_TYPE_POPUP ||
window->transient_parent());
}

Expand Down Expand Up @@ -896,7 +896,7 @@ void DockedWindowLayoutManager::RecordUmaAction(DockedAction action,
if (!IsUsedByLayout(window))
continue;
docked_visible_count++;
if (window->type() == aura::client::WINDOW_TYPE_PANEL)
if (window->type() == ui::wm::WINDOW_TYPE_PANEL)
docked_panels_count++;
const wm::WindowState* window_state = wm::GetWindowState(window);
if (window_state->HasRestoreBounds()) {
Expand Down
20 changes: 9 additions & 11 deletions ash/wm/dock/docked_window_layout_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace internal {

class DockedWindowLayoutManagerTest
: public test::AshTestBase,
public testing::WithParamInterface<aura::client::WindowType> {
public testing::WithParamInterface<ui::wm::WindowType> {
public:
DockedWindowLayoutManagerTest() : window_type_(GetParam()) {}
virtual ~DockedWindowLayoutManagerTest() {}
Expand Down Expand Up @@ -73,7 +73,7 @@ class DockedWindowLayoutManagerTest
aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
NULL, window_type_, 0, bounds);
if (window_type_ == aura::client::WINDOW_TYPE_PANEL) {
if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) {
test::TestShelfDelegate* shelf_delegate =
test::TestShelfDelegate::instance();
shelf_delegate->AddLauncherItem(window);
Expand All @@ -90,7 +90,7 @@ class DockedWindowLayoutManagerTest
aura::test::TestWindowDelegate* delegate) {
aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
delegate, window_type_, 0, bounds);
if (window_type_ == aura::client::WINDOW_TYPE_PANEL) {
if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) {
test::TestShelfDelegate* shelf_delegate =
test::TestShelfDelegate::instance();
shelf_delegate->AddLauncherItem(window);
Expand Down Expand Up @@ -151,21 +151,19 @@ class DockedWindowLayoutManagerTest
// All other windows that we are testing here have default container as a
// parent.
int CorrectContainerIdDuringDrag() {
if (window_type_ == aura::client::WINDOW_TYPE_PANEL)
if (window_type_ == ui::wm::WINDOW_TYPE_PANEL)
return internal::kShellWindowId_PanelContainer;
return internal::kShellWindowId_DockedContainer;
}

// Test dragging the window vertically (to detach if it is a panel) and then
// horizontally to the edge with an added offset from the edge of |dx|.
void DragRelativeToEdge(DockedEdge edge,
aura::Window* window,
int dx) {
void DragRelativeToEdge(DockedEdge edge, aura::Window* window, int dx) {
DragVerticallyAndRelativeToEdge(
edge,
window,
dx,
window_type_ == aura::client::WINDOW_TYPE_PANEL ? -100 : 20);
window_type_ == ui::wm::WINDOW_TYPE_PANEL ? -100 : 20);
}

void DragToVerticalPositionAndToEdge(DockedEdge edge,
Expand Down Expand Up @@ -216,7 +214,7 @@ class DockedWindowLayoutManagerTest
private:
scoped_ptr<WindowResizer> resizer_;
scoped_ptr<test::ShelfViewTestAPI> shelf_view_test_;
aura::client::WindowType window_type_;
ui::wm::WindowType window_type_;

// Location at start of the drag in |window->parent()|'s coordinates.
gfx::Point initial_location_in_parent_;
Expand Down Expand Up @@ -813,7 +811,7 @@ TEST_P(DockedWindowLayoutManagerTest, TwoWindowsHeightRestrictions) {
// Tests run twice - on both panels and normal windows
INSTANTIATE_TEST_CASE_P(NormalOrPanel,
DockedWindowLayoutManagerTest,
testing::Values(aura::client::WINDOW_TYPE_NORMAL,
aura::client::WINDOW_TYPE_PANEL));
testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
ui::wm::WINDOW_TYPE_PANEL));
} // namespace internal
} // namespace ash
7 changes: 3 additions & 4 deletions ash/wm/dock/docked_window_resizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void DockedWindowResizer::StartedDragging() {
// Reparent workspace windows during the drag to elevate them above workspace.
// Other windows for which the DockedWindowResizer is instantiated include
// panels and windows that are already docked. Those do not need reparenting.
if (GetTarget()->type() != aura::client::WINDOW_TYPE_PANEL &&
if (GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL &&
GetTarget()->parent()->id() == kShellWindowId_DefaultContainer) {
// The window is going to be reparented - avoid completing the drag.
window_state->set_continue_drag_after_reparent(true);
Expand All @@ -234,9 +234,8 @@ void DockedWindowResizer::FinishedDragging() {
did_move_or_resize_ = false;
aura::Window* window = GetTarget();
wm::WindowState* window_state = wm::GetWindowState(window);
const bool is_attached_panel =
window->type() == aura::client::WINDOW_TYPE_PANEL &&
window_state->panel_attached();
const bool is_attached_panel = window->type() == ui::wm::WINDOW_TYPE_PANEL &&
window_state->panel_attached();
const bool is_resized =
(details_.bounds_change & WindowResizer::kBoundsChange_Resizes) != 0;

Expand Down
Loading

0 comments on commit 5b251f1

Please sign in to comment.