Skip to content

Commit

Permalink
Move shadow code to views\corewm
Browse files Browse the repository at this point in the history
http://crbug.com/158115
R=derat@chromium.org
Review URL: https://codereview.chromium.org/11275296

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167733 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ben@chromium.org committed Nov 14, 2012
1 parent 31882ba commit 86f2b5e
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 180 deletions.
10 changes: 0 additions & 10 deletions ash/ash.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@
'wm/gestures/two_finger_drag_handler.h',
'wm/image_cursors.cc',
'wm/image_cursors.h',
'wm/image_grid.cc',
'wm/image_grid.h',
'wm/maximize_bubble_controller.cc',
'wm/maximize_bubble_controller.h',
'wm/overlay_event_filter.cc',
Expand Down Expand Up @@ -339,12 +337,6 @@
'wm/session_state_controller_impl.h',
'wm/session_state_controller_impl2.cc',
'wm/session_state_controller_impl2.h',
'wm/shadow.cc',
'wm/shadow.h',
'wm/shadow_controller.cc',
'wm/shadow_controller.h',
'wm/shadow_types.cc',
'wm/shadow_types.h',
'wm/shelf_layout_manager.cc',
'wm/shelf_layout_manager.h',
'wm/shelf_types.h',
Expand Down Expand Up @@ -562,11 +554,9 @@
'wm/cursor_manager_unittest.cc',
'wm/custom_frame_view_ash_unittest.cc',
'wm/frame_painter_unittest.cc',
'wm/image_grid_unittest.cc',
'wm/panel_layout_manager_unittest.cc',
'wm/power_button_controller_unittest.cc',
'wm/screen_dimmer_unittest.cc',
'wm/shadow_controller_unittest.cc',
'wm/shelf_layout_manager_unittest.cc',
'wm/system_gesture_event_filter_unittest.cc',
'wm/system_modal_container_layout_manager_unittest.cc',
Expand Down
6 changes: 3 additions & 3 deletions ash/dip_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#include "ash/launcher/launcher.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/shadow.h"
#include "ash/wm/shadow_controller.h"
#include "ash/wm/shadow_types.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/memory/scoped_ptr.h"
Expand All @@ -21,6 +18,9 @@
#include "ui/gfx/display.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/screen.h"
#include "ui/views/corewm/shadow.h"
#include "ui/views/corewm/shadow_controller.h"
#include "ui/views/corewm/shadow_types.h"
#include "ui/views/widget/widget.h"

namespace ash {
Expand Down
4 changes: 2 additions & 2 deletions ash/drag_drop/drag_image_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "ash/drag_drop/drag_image_view.h"

#include "ash/wm/shadow_types.h"
#include "ui/aura/window.h"
#include "ui/views/corewm/shadow_types.h"
#include "ui/views/widget/widget.h"

namespace ash {
Expand All @@ -25,7 +25,7 @@ Widget* CreateDragWidget() {
drag_widget->Init(params);
drag_widget->SetOpacity(0xFF);
drag_widget->GetNativeWindow()->set_owned_by_parent(false);
SetShadowType(drag_widget->GetNativeView(), SHADOW_TYPE_NONE);
SetShadowType(drag_widget->GetNativeView(), views::corewm::SHADOW_TYPE_NONE);
return drag_widget;
}
}
Expand Down
5 changes: 3 additions & 2 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "ash/wm/session_state_controller.h"
#include "ash/wm/session_state_controller_impl.h"
#include "ash/wm/session_state_controller_impl2.h"
#include "ash/wm/shadow_controller.h"
#include "ash/wm/stacking_controller.h"
#include "ash/wm/system_gesture_event_filter.h"
#include "ash/wm/system_modal_container_event_filter.h"
Expand Down Expand Up @@ -85,6 +84,7 @@
#include "ui/ui_controls/ui_controls.h"
#include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/corewm/input_method_event_filter.h"
#include "ui/views/corewm/shadow_controller.h"
#include "ui/views/focus/focus_manager_factory.h"
#include "ui/views/widget/native_widget_aura.h"
#include "ui/views/widget/widget.h"
Expand Down Expand Up @@ -505,7 +505,8 @@ void Shell::Init() {

if (!command_line->HasSwitch(switches::kAuraNoShadows)) {
resize_shadow_controller_.reset(new internal::ResizeShadowController());
shadow_controller_.reset(new internal::ShadowController());
shadow_controller_.reset(
new views::corewm::ShadowController(GetPrimaryRootWindow()));
}

// Create system_tray_notifier_ before the delegate.
Expand Down
6 changes: 3 additions & 3 deletions ash/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Widget;
namespace corewm {
class CompoundEventFilter;
class InputMethodEventFilter;
class ShadowController;
}
}

Expand Down Expand Up @@ -101,7 +102,6 @@ class ResizeShadowController;
class RootWindowController;
class RootWindowLayoutManager;
class ScreenPositionController;
class ShadowController;
class SlowAnimationEventFilter;
class StatusAreaWidget;
class SystemGestureEventFilter;
Expand Down Expand Up @@ -391,7 +391,7 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
}

// Made available for tests.
internal::ShadowController* shadow_controller() {
views::corewm::ShadowController* shadow_controller() {
return shadow_controller_.get();
}

Expand Down Expand Up @@ -482,7 +482,7 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
scoped_ptr<internal::WindowModalityController> window_modality_controller_;
scoped_ptr<internal::DragDropController> drag_drop_controller_;
scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
scoped_ptr<internal::ShadowController> shadow_controller_;
scoped_ptr<views::corewm::ShadowController> shadow_controller_;
scoped_ptr<internal::TooltipController> tooltip_controller_;
scoped_ptr<internal::VisibilityController> visibility_controller_;
scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
Expand Down
6 changes: 3 additions & 3 deletions ash/shell/window_type_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "ash/shell_window_ids.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/web_notification/web_notification_tray.h"
#include "ash/wm/shadow_types.h"
#include "base/bind.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
Expand All @@ -26,6 +25,7 @@
#include "ui/views/controls/button/text_button.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/corewm/shadow_types.h"
#include "ui/views/examples/examples_window_with_content.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/widget/widget.h"
Expand Down Expand Up @@ -185,8 +185,8 @@ void InitWindowTypeLauncher() {
views::Widget::CreateWindowWithBounds(new WindowTypeLauncher,
gfx::Rect(120, 150, 300, 410));
widget->GetNativeView()->SetName("WindowTypeLauncher");
ash::internal::SetShadowType(widget->GetNativeView(),
ash::internal::SHADOW_TYPE_RECTANGULAR);
views::corewm::SetShadowType(widget->GetNativeView(),
views::corewm::SHADOW_TYPE_RECTANGULAR);
widget->Show();
}

Expand Down
4 changes: 2 additions & 2 deletions ash/wm/resize_shadow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

#include "ash/wm/resize_shadow.h"

#include "ash/wm/image_grid.h"
#include "base/time.h"
#include "grit/ash_resources.h"
#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/corewm/image_grid.h"

namespace {

Expand Down Expand Up @@ -49,7 +49,7 @@ ResizeShadow::~ResizeShadow() {}
void ResizeShadow::Init(aura::Window* window) {
// Set up our image grid and images.
ResourceBundle& res = ResourceBundle::GetSharedInstance();
image_grid_.reset(new ImageGrid);
image_grid_.reset(new views::corewm::ImageGrid);
image_grid_->SetImages(
&res.GetImageNamed(IDR_AURA_RESIZE_SHADOW_TOP_LEFT),
&res.GetImageNamed(IDR_AURA_RESIZE_SHADOW_TOP),
Expand Down
9 changes: 6 additions & 3 deletions ash/wm/resize_shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ class Rect;
namespace ui {
class Layer;
}
namespace views {
namespace corewm {
class ImageGrid;
}
}

namespace ash {
namespace internal {

class ImageGrid;

// A class to render the resize edge effect when the user moves their mouse
// over a sizing edge. This is just a visual effect; the actual resize is
// handled by the EventFilter.
Expand All @@ -46,7 +49,7 @@ class ResizeShadow {

private:
// Images for the shadow effect.
scoped_ptr<ImageGrid> image_grid_;
scoped_ptr<views::corewm::ImageGrid> image_grid_;

// Hit test value from last call to ShowForHitTest(). Used to prevent
// repeatedly triggering the same animations for the same hit.
Expand Down
31 changes: 0 additions & 31 deletions ash/wm/shadow_types.h

This file was deleted.

3 changes: 0 additions & 3 deletions ash/wm/window_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
#include "ash/root_window_controller.h"
#include "ash/wm/always_on_top_controller.h"
#include "ash/wm/frame_painter.h"
#include "ash/wm/shadow_types.h"
#include "ui/aura/window_property.h"
#include "ui/gfx/rect.h"
#include "ui/ui_controls/ui_controls_aura.h"

DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::AlwaysOnTopController*);
DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::ShadowType);
DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ASH_EXPORT, ash::FramePainter*);
DECLARE_WINDOW_PROPERTY_TYPE(ash::WindowPersistsAcrossAllWorkspacesType)
DECLARE_WINDOW_PROPERTY_TYPE(ui_controls::UIControlsAura*)
Expand All @@ -31,7 +29,6 @@ DEFINE_WINDOW_PROPERTY_KEY(
ui::WindowShowState, kRestoreShowStateKey, ui::SHOW_STATE_DEFAULT);
DEFINE_WINDOW_PROPERTY_KEY(RootWindowController*,
kRootWindowControllerKey, NULL);
DEFINE_WINDOW_PROPERTY_KEY(ShadowType, kShadowTypeKey, SHADOW_TYPE_NONE);
DEFINE_WINDOW_PROPERTY_KEY(
ash::FramePainter*, kSoloWindowFramePainterKey, NULL);
DEFINE_WINDOW_PROPERTY_KEY(bool, kStayInSameRootWindowKey, false);
Expand Down
5 changes: 0 additions & 5 deletions ash/wm/window_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "ash/ash_export.h"
#include "ash/wm/property_util.h"
#include "ash/wm/shadow_types.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_types.h"

Expand Down Expand Up @@ -51,10 +50,6 @@ extern const aura::WindowProperty<ui::WindowShowState>* const
extern const aura::WindowProperty<RootWindowController*>* const
kRootWindowControllerKey;

// A property key describing the drop shadow that should be displayed under the
// window. If unset, no shadow is displayed.
extern const aura::WindowProperty<ShadowType>* const kShadowTypeKey;

// A property key to remember the frame painter for the solo-window in the root
// window. It is only available for root windows.
ASH_EXPORT extern const aura::WindowProperty<ash::FramePainter*>* const
Expand Down
5 changes: 3 additions & 2 deletions ash/wm/workspace/phantom_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/shadow_types.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/root_window.h"
Expand All @@ -21,6 +20,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/corewm/shadow_types.h"
#include "ui/views/painter.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
Expand Down Expand Up @@ -180,7 +180,8 @@ void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds,
phantom_widget_->SetContentsView(content_view);
} else if (style_ == STYLE_DRAGGING) {
// Show shadow for the dragging window.
SetShadowType(phantom_widget_->GetNativeWindow(), SHADOW_TYPE_RECTANGULAR);
SetShadowType(phantom_widget_->GetNativeWindow(),
views::corewm::SHADOW_TYPE_RECTANGULAR);
}
SetBoundsInternal(bounds);
if (phantom_below_window_)
Expand Down
10 changes: 9 additions & 1 deletion ui/aura/test/test_activation_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "ui/aura/test/test_activation_client.h"

#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/client/activation_delegate.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
Expand All @@ -29,20 +30,27 @@ TestActivationClient::~TestActivationClient() {

void TestActivationClient::AddObserver(
client::ActivationChangeObserver* observer) {
observers_.AddObserver(observer);
}

void TestActivationClient::RemoveObserver(
client::ActivationChangeObserver* observer) {
observers_.RemoveObserver(observer);
}

void TestActivationClient::ActivateWindow(Window* window) {
Window *last_active = GetActiveWindow();
Window* last_active = GetActiveWindow();
if (last_active == window)
return;

RemoveActiveWindow(window);
active_windows_.push_back(window);
window->AddObserver(this);

FOR_EACH_OBSERVER(client::ActivationChangeObserver,
observers_,
OnWindowActivated(window, last_active));

if (aura::client::GetActivationDelegate(window))
aura::client::GetActivationDelegate(window)->OnActivated();

Expand Down
2 changes: 2 additions & 0 deletions ui/aura/test/test_activation_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class TestActivationClient : public client::ActivationClient,
// fail.
std::vector<Window*> active_windows_;

ObserverList<client::ActivationChangeObserver> observers_;

DISALLOW_COPY_AND_ASSIGN(TestActivationClient);
};

Expand Down
10 changes: 5 additions & 5 deletions ash/wm/image_grid.cc → ui/views/corewm/image_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wm/image_grid.h"
#include "ui/views/corewm/image_grid.h"

#include <algorithm>

Expand All @@ -17,8 +17,8 @@
using std::max;
using std::min;

namespace ash {
namespace internal {
namespace views {
namespace corewm {

gfx::RectF ImageGrid::TestAPI::GetTransformedLayerBounds(
const ui::Layer& layer) {
Expand Down Expand Up @@ -280,5 +280,5 @@ void ImageGrid::SetImage(const gfx::Image* image,
layer_->Add(layer_ptr->get());
}

} // namespace internal
} // namespace ash
} // namespace corewm
} // namespace views
Loading

0 comments on commit 86f2b5e

Please sign in to comment.