Skip to content

Commit

Permalink
Move GetRootWindowController to root_window_controller.h
Browse files Browse the repository at this point in the history
Remove unnecessary includes, forward decls

BUG=272460

Review URL: https://chromiumcodereview.appspot.com/24020002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221605 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
oshima@chromium.org committed Sep 6, 2013
1 parent 3ea4291 commit 6b2d4a0
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 74 deletions.
8 changes: 4 additions & 4 deletions ash/desktop_background/desktop_background_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "ash/shell.h"
#include "ash/shell_factory.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
#include "ash/wm/root_window_layout_manager.h"
#include "base/bind.h"
#include "base/command_line.h"
Expand Down Expand Up @@ -414,10 +413,11 @@ void DesktopBackgroundController::InstallDesktopController(
NOTREACHED();
return;
}
GetRootWindowController(root_window)->SetAnimatingWallpaperController(
new internal::AnimatingDesktopController(component));
internal::GetRootWindowController(root_window)->
SetAnimatingWallpaperController(
new internal::AnimatingDesktopController(component));

component->StartAnimating(GetRootWindowController(root_window));
component->StartAnimating(internal::GetRootWindowController(root_window));
}

void DesktopBackgroundController::InstallDesktopControllerForAllWindows() {
Expand Down
1 change: 0 additions & 1 deletion ash/desktop_background/desktop_background_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
Expand Down
11 changes: 5 additions & 6 deletions ash/display/display_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/property_util.h"
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "third_party/skia/include/utils/SkMatrix44.h"
Expand Down Expand Up @@ -260,7 +259,7 @@ void DisplayController::Shutdown() {
for (std::map<int64, aura::RootWindow*>::const_reverse_iterator it =
root_windows_.rbegin(); it != root_windows_.rend(); ++it) {
internal::RootWindowController* controller =
GetRootWindowController(it->second);
internal::GetRootWindowController(it->second);
DCHECK(controller);
delete controller;
}
Expand Down Expand Up @@ -322,7 +321,7 @@ void DisplayController::CloseChildWindows() {
root_windows_.begin(); it != root_windows_.end(); ++it) {
aura::RootWindow* root_window = it->second;
internal::RootWindowController* controller =
GetRootWindowController(root_window);
internal::GetRootWindowController(root_window);
if (controller) {
controller->CloseChildWindows();
} else {
Expand All @@ -339,7 +338,7 @@ std::vector<aura::RootWindow*> DisplayController::GetAllRootWindows() {
for (std::map<int64, aura::RootWindow*>::const_iterator it =
root_windows_.begin(); it != root_windows_.end(); ++it) {
DCHECK(it->second);
if (GetRootWindowController(it->second))
if (internal::GetRootWindowController(it->second))
windows.push_back(it->second);
}
return windows;
Expand All @@ -360,7 +359,7 @@ DisplayController::GetAllRootWindowControllers() {
for (std::map<int64, aura::RootWindow*>::const_iterator it =
root_windows_.begin(); it != root_windows_.end(); ++it) {
internal::RootWindowController* controller =
GetRootWindowController(it->second);
internal::GetRootWindowController(it->second);
if (controller)
controllers.push_back(controller);
}
Expand Down Expand Up @@ -684,7 +683,7 @@ void DisplayController::OnDisplayRemoved(const gfx::Display& display) {
GetDisplayManager()->GetDisplayForId(primary_display_id));
}
internal::RootWindowController* controller =
GetRootWindowController(root_to_delete);
internal::GetRootWindowController(root_to_delete);
DCHECK(controller);
controller->MoveWindowsTo(GetPrimaryRootWindow());
// Delete most of root window related objects, but don't delete
Expand Down
3 changes: 1 addition & 2 deletions ash/extended_desktop_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "ash/system/tray/system_tray.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_cycle_controller.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
Expand Down Expand Up @@ -168,7 +167,7 @@ TEST_F(ExtendedDesktopTest, Basic) {
ASSERT_EQ(2U, root_windows.size());
for (Shell::RootWindowList::const_iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
EXPECT_TRUE(GetRootWindowController(*iter) != NULL);
EXPECT_TRUE(internal::GetRootWindowController(*iter) != NULL);
}
// Make sure root windows share the same controllers.
EXPECT_EQ(aura::client::GetFocusClient(root_windows[0]),
Expand Down
12 changes: 8 additions & 4 deletions ash/root_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "ash/wm/dock/docked_window_layout_manager.h"
#include "ash/wm/panels/panel_layout_manager.h"
#include "ash/wm/panels/panel_window_event_handler.h"
#include "ash/wm/property_util.h"
#include "ash/wm/root_window_layout_manager.h"
#include "ash/wm/screen_dimmer.h"
#include "ash/wm/stacking_controller.h"
Expand Down Expand Up @@ -219,7 +218,7 @@ RootWindowController::RootWindowController(aura::RootWindow* root_window)
panel_layout_manager_(NULL),
touch_hud_debug_(NULL),
touch_hud_projection_(NULL) {
SetRootWindowController(root_window, this);
GetRootWindowSettings(root_window)->controller = this;
screen_dimmer_.reset(new ScreenDimmer(root_window));

stacking_controller_.reset(new StackingController);
Expand Down Expand Up @@ -248,7 +247,7 @@ RootWindowController* RootWindowController::ForWindow(

// static
RootWindowController* RootWindowController::ForActiveRootWindow() {
return GetRootWindowController(Shell::GetActiveRootWindow());
return internal::GetRootWindowController(Shell::GetActiveRootWindow());
}

void RootWindowController::SetWallpaperController(
Expand Down Expand Up @@ -282,7 +281,7 @@ void RootWindowController::Shutdown() {
}

CloseChildWindows();
SetRootWindowController(root_window_.get(), NULL);
GetRootWindowSettings(root_window_.get())->controller = NULL;
screen_dimmer_.reset();
workspace_controller_.reset();
// Forget with the display ID so that display lookup
Expand Down Expand Up @@ -819,5 +818,10 @@ void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
DisableTouchHudProjection();
}

RootWindowController* GetRootWindowController(
const aura::RootWindow* root_window) {
return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
}

} // namespace internal
} // namespace ash
5 changes: 5 additions & 0 deletions ash/root_window_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ class ASH_EXPORT RootWindowController : public ShellObserver {
DISALLOW_COPY_AND_ASSIGN(RootWindowController);
};


// Gets the RootWindowController for |root_window|.
ASH_EXPORT RootWindowController* GetRootWindowController(
const aura::RootWindow* root_window);

} // namespace internal
} // ash

Expand Down
3 changes: 1 addition & 2 deletions ash/screen_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/wm/property_util.h"
#include "ash/wm/coordinate_conversion.h"
#include "base/logging.h"
#include "ui/aura/client/screen_position_client.h"
Expand Down Expand Up @@ -44,7 +43,7 @@ gfx::Display ScreenAsh::FindDisplayContainingPoint(const gfx::Point& point) {

// static
gfx::Rect ScreenAsh::GetMaximizedWindowBoundsInParent(aura::Window* window) {
if (GetRootWindowController(window->GetRootWindow())->shelf())
if (internal::GetRootWindowController(window->GetRootWindow())->shelf())
return GetDisplayWorkAreaBoundsInParent(window);
else
return GetDisplayBoundsInParent(window);
Expand Down
1 change: 0 additions & 1 deletion ash/shelf/shelf_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "ash/system/status_area_widget.h"
#include "ash/wm/gestures/shelf_gesture_handler.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
Expand Down
7 changes: 3 additions & 4 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#include "ash/wm/overlay_event_filter.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/power_button_controller.h"
#include "ash/wm/property_util.h"
#include "ash/wm/resize_shadow_controller.h"
#include "ash/wm/root_window_layout_manager.h"
#include "ash/wm/screen_dimmer.h"
Expand Down Expand Up @@ -368,7 +367,7 @@ void Shell::DeleteInstance() {

// static
internal::RootWindowController* Shell::GetPrimaryRootWindowController() {
return GetRootWindowController(GetPrimaryRootWindow());
return internal::GetRootWindowController(GetPrimaryRootWindow());
}

// static
Expand Down Expand Up @@ -646,7 +645,7 @@ void Shell::ShowContextMenu(const gfx::Point& location_in_screen,
// NULL even for the out-of-bounds |location_in_screen| (It should
// return the primary root). Investigate why/how this is
// happening. crbug.com/165214.
internal::RootWindowController* rwc = GetRootWindowController(root);
internal::RootWindowController* rwc = internal::GetRootWindowController(root);
CHECK(rwc) << "root=" << root
<< ", location:" << location_in_screen.ToString();
if (rwc)
Expand Down Expand Up @@ -796,7 +795,7 @@ void Shell::SetShelfAlignment(ShelfAlignment alignment,
}

ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) {
return GetRootWindowController(root_window)->
return internal::GetRootWindowController(root_window)->
GetShelfLayoutManager()->GetAlignment();
}

Expand Down
7 changes: 3 additions & 4 deletions ash/system/tray/tray_event_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "ash/system/tray/tray_bubble_wrapper.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_event_filter.h"
#include "ash/wm/property_util.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
Expand Down Expand Up @@ -57,10 +56,10 @@ bool TrayEventFilter::ProcessLocatedEvent(ui::LocatedEvent* event) {
if (event->target()) {
aura::Window* target = static_cast<aura::Window*>(event->target());
// Don't process events that occurred inside an embedded menu.
ash::internal::RootWindowController* root_controller =
ash::GetRootWindowController(target->GetRootWindow());
internal::RootWindowController* root_controller =
internal::GetRootWindowController(target->GetRootWindow());
if (root_controller && root_controller->GetContainer(
ash::internal::kShellWindowId_MenuContainer)->Contains(target)) {
internal::kShellWindowId_MenuContainer)->Contains(target)) {
return false;
}
}
Expand Down
1 change: 0 additions & 1 deletion ash/touch/touch_hud_debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "ash/display/display_manager.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/wm/property_util.h"
#include "base/json/json_string_value_serializer.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
Expand Down
1 change: 0 additions & 1 deletion ash/touch/touch_observer_hud.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "ash/root_window_settings.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
#include "ui/aura/root_window.h"
#include "ui/gfx/display.h"
#include "ui/gfx/rect.h"
Expand Down
1 change: 0 additions & 1 deletion ash/touch/touch_observer_hud_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/touch/touch_hud_debug.h"
#include "ash/wm/property_util.h"
#include "base/command_line.h"
#include "base/format_macros.h"
#include "base/strings/stringprintf.h"
Expand Down
1 change: 0 additions & 1 deletion ash/wm/app_list_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
#include "base/command_line.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/pagination_model.h"
Expand Down
13 changes: 5 additions & 8 deletions ash/wm/gestures/long_press_affordance_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "ash/shell.h"
#include "ash/root_window_controller.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
Expand All @@ -26,6 +25,8 @@
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"

namespace ash {
namespace internal {
namespace {

const int kAffordanceOuterRadius = 60;
Expand Down Expand Up @@ -69,9 +70,8 @@ views::Widget* CreateAffordanceWidget(aura::RootWindow* root_window) {
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
widget->Init(params);
widget->SetOpacity(0xFF);
ash::GetRootWindowController(root_window)->GetContainer(
ash::internal::kShellWindowId_OverlayContainer)->AddChild(
widget->GetNativeWindow());
GetRootWindowController(root_window)->GetContainer(
kShellWindowId_OverlayContainer)->AddChild(widget->GetNativeWindow());
return widget;
}

Expand Down Expand Up @@ -133,9 +133,6 @@ void PaintAffordanceGlow(gfx::Canvas* canvas,

} // namespace

namespace ash {
namespace internal {

// View of the LongPressAffordanceHandler. Draws the actual contents and
// updates as the animation proceeds. It also maintains the views::Widget that
// the animation is shown in.
Expand Down Expand Up @@ -297,7 +294,7 @@ void LongPressAffordanceHandler::StartAnimation() {
aura::RootWindow* root_window = NULL;
switch (current_animation_type_) {
case GROW_ANIMATION:
root_window = ash::Shell::GetInstance()->display_controller()->
root_window = Shell::GetInstance()->display_controller()->
GetRootWindowForDisplayId(tap_down_display_id_);
if (!root_window) {
StopAnimation();
Expand Down
15 changes: 0 additions & 15 deletions ash/wm/property_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@

#include "ash/wm/property_util.h"

#include "ash/ash_export.h"
#include "ash/root_window_settings.h"
#include "ash/screen_ash.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/rect.h"
Expand Down Expand Up @@ -65,15 +61,4 @@ bool GetWindowAlwaysRestoresToRestoreBounds(const aura::Window* window) {
return window->GetProperty(internal::kWindowRestoresToRestoreBounds);
}

internal::RootWindowController* GetRootWindowController(
const aura::RootWindow* root_window) {
return root_window ?
internal::GetRootWindowSettings(root_window)->controller : NULL;
}

void SetRootWindowController(aura::RootWindow* root_window,
internal::RootWindowController* controller) {
internal::GetRootWindowSettings(root_window)->controller = controller;
}

} // namespace ash
13 changes: 1 addition & 12 deletions ash/wm/property_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "ash/ash_export.h"

namespace aura {
class RootWindow;
class Window;
}

Expand All @@ -17,9 +16,6 @@ class Rect;
}

namespace ash {
namespace internal {
class RootWindowController;
}

// Sets the restore bounds property on |window| in the virtual screen
// coordinates. Deletes existing bounds value if exists.
Expand Down Expand Up @@ -63,13 +59,6 @@ ASH_EXPORT bool GetWindowAlwaysRestoresToRestoreBounds(
ASH_EXPORT void SetTrackedByWorkspace(aura::Window* window, bool value);
ASH_EXPORT bool GetTrackedByWorkspace(const aura::Window* window);

// Sets/Gets the RootWindowController for |root_window|.
ASH_EXPORT void SetRootWindowController(
aura::RootWindow* root_window,
internal::RootWindowController* controller);
ASH_EXPORT internal::RootWindowController* GetRootWindowController(
const aura::RootWindow* root_window);

}
} // namespace ash

#endif // ASH_WM_PROPERTY_UTIL_H_
1 change: 0 additions & 1 deletion ash/wm/root_window_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/root_window_controller.h"
#include "ash/wm/property_util.h"
#include "ui/aura/root_window.h"
#include "ui/compositor/layer.h"
#include "ui/views/widget/widget.h"
Expand Down
Loading

0 comments on commit 6b2d4a0

Please sign in to comment.