summaryrefslogtreecommitdiff
path: root/ash
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2013-07-18 11:57:30 +0100
committerBen Murdoch <benm@google.com>2013-07-18 11:57:30 +0100
commit9ab5563a3196760eb381d102cbb2bc0f7abc6a50 (patch)
tree1c690f8b0c998ba536a0c7aeff34764383c7dff6 /ash
parent106cdaa9e420b49e5b1ef6941f08dd990128a374 (diff)
downloadchromium_org-9ab5563a3196760eb381d102cbb2bc0f7abc6a50.tar.gz
Merge from Chromium at DEPS revision r212225
This commit was generated by merge_to_master.py. Change-Id: I9b658b6bade7aff6166611a04fb26f4bcf0ca77c
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_switches.cc30
-rw-r--r--ash/ash_switches.h6
-rw-r--r--ash/display/screen_position_controller.cc2
-rw-r--r--ash/launcher/alternate_app_list_button.cc22
-rw-r--r--ash/launcher/alternate_app_list_button.h3
-rw-r--r--ash/resources/wallpaper/default_large.jpgbin0 -> 18866 bytes
-rw-r--r--ash/resources/wallpaper/default_small.jpgbin0 -> 16154 bytes
-rw-r--r--ash/wm/drag_window_resizer_unittest.cc45
8 files changed, 82 insertions, 26 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 373bd1b9eb..d66c15b14b 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -44,13 +44,6 @@ const char kAshDefaultGuestWallpaperSmall[] =
const char kAshDefaultWallpaperLarge[] = "ash-default-wallpaper-large";
const char kAshDefaultWallpaperSmall[] = "ash-default-wallpaper-small";
-#if defined(OS_CHROMEOS)
-// Disable the status tray volume menu for allowing the user to choose an audio
-// input and output device.
-const char kAshDisableAudioDeviceMenu[] =
- "ash-disable-audio-device-menu";
-#endif
-
// Disable auto window maximization logic.
const char kAshDisableAutoMaximizing[] = "ash-disable-auto-maximizing";
@@ -63,10 +56,8 @@ const char kAshDisableAutoWindowPlacement[] =
const char kAshDisableDisplayChangeLimiter[] =
"ash-disable-display-change-limiter";
-#if defined(OS_CHROMEOS)
// Disable the new cras audio handler.
const char kAshDisableNewAudioHandler[] = "ash-disable-new-audio-handler";
-#endif
// If present new lock animations are enabled.
const char kAshDisableNewLockAnimations[] = "ash-disable-new-lock-animations";
@@ -93,6 +84,11 @@ const char kAshDisableUsbChargerNotification[] =
"ash-disable-usb-charger-notification";
#endif
+// Extend the status tray volume item to allow the user to choose an audio
+// input and output device.
+const char kAshEnableAudioDeviceMenu[] =
+ "ash-enable-audio-device-menu";
+
// Enable advanced gestures (e.g. for window management).
const char kAshEnableAdvancedGestures[] = "ash-enable-advanced-gestures";
@@ -185,12 +181,6 @@ const char kAshDisableDragAndDropAppListToLauncher[] =
// in maximized mode.
const char kForcedMaximizeMode[] = "forced-maximize-mode";
-bool UseAlternateShelfLayout() {
- return CommandLine::ForCurrentProcess()->
- HasSwitch(ash::switches::kAshUseAlternateShelfLayout);
-}
-
-#if defined(OS_CHROMEOS)
bool UseNewAudioHandler() {
return !CommandLine::ForCurrentProcess()->
HasSwitch(ash::switches::kAshDisableNewAudioHandler);
@@ -198,10 +188,16 @@ bool UseNewAudioHandler() {
bool ShowAudioDeviceMenu() {
return ash::switches::UseNewAudioHandler() &&
- !CommandLine::ForCurrentProcess()->
- HasSwitch(ash::switches::kAshDisableAudioDeviceMenu);
+ CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshEnableAudioDeviceMenu);
+}
+
+bool UseAlternateShelfLayout() {
+ return CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshUseAlternateShelfLayout);
}
+#if defined(OS_CHROMEOS)
bool UseUsbChargerNotification() {
return !CommandLine::ForCurrentProcess()->
HasSwitch(ash::switches::kAshDisableUsbChargerNotification);
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 429291ca07..c2099929a8 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -26,16 +26,11 @@ ASH_EXPORT extern const char kAshDefaultGuestWallpaperLarge[];
ASH_EXPORT extern const char kAshDefaultGuestWallpaperSmall[];
ASH_EXPORT extern const char kAshDefaultWallpaperLarge[];
ASH_EXPORT extern const char kAshDefaultWallpaperSmall[];
-#if defined(OS_CHROMEOS)
-ASH_EXPORT extern const char kAshDisableAudioDeviceMenu[];
-#endif
ASH_EXPORT extern const char kAshDisableAutoMaximizing[];
ASH_EXPORT extern const char kAshDisableAutoWindowPlacement[];
ASH_EXPORT extern const char kAshDisableDisplayChangeLimiter[];
ASH_EXPORT extern const char kAshDisableImmersiveFullscreen[];
-#if defined(OS_CHROMEOS)
ASH_EXPORT extern const char kAshDisableNewAudioHandler[];
-#endif
ASH_EXPORT extern const char kAshDisableNewLockAnimations[];
ASH_EXPORT extern const char kAshDisablePerAppLauncher[];
ASH_EXPORT extern const char kAshDisableUIScaling[];
@@ -45,6 +40,7 @@ ASH_EXPORT extern const char kAshDisableDragAndDropAppListToLauncher[];
ASH_EXPORT extern const char kAshDisableSoftwareMirroring[];
ASH_EXPORT extern const char kAshDisableUsbChargerNotification[];
#endif
+ASH_EXPORT extern const char kAshEnableAudioDeviceMenu[];
ASH_EXPORT extern const char kAshEnableAdvancedGestures[];
ASH_EXPORT extern const char kAshEnableBrightnessControl[];
ASH_EXPORT extern const char kAshEnableDockedWindows[];
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index 1d4d77e242..db88cd9648 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -208,6 +208,8 @@ void ScreenPositionController::SetBounds(aura::Window* window,
// Restore focused/active window.
if (tracker.Contains(focused)) {
aura::client::GetFocusClient(window)->FocusWindow(focused);
+ ash::Shell::GetInstance()->set_active_root_window(
+ focused->GetRootWindow());
} else if (tracker.Contains(active)) {
activation_client->ActivateWindow(active);
}
diff --git a/ash/launcher/alternate_app_list_button.cc b/ash/launcher/alternate_app_list_button.cc
index 77f11843ea..3ac4d4529b 100644
--- a/ash/launcher/alternate_app_list_button.cc
+++ b/ash/launcher/alternate_app_list_button.cc
@@ -20,6 +20,7 @@
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
+#include "ui/views/controls/button/image_button.h"
namespace ash {
namespace internal {
@@ -133,5 +134,26 @@ void AlternateAppListButton::GetAccessibleState(
state->name = host_->GetAccessibleName(this);
}
+void AlternateAppListButton::OnGestureEvent(ui::GestureEvent* event) {
+ switch (event->type()) {
+ case ui::ET_GESTURE_SCROLL_BEGIN:
+ host_->PointerPressedOnButton(this, LauncherButtonHost::TOUCH, *event);
+ event->SetHandled();
+ return;
+ case ui::ET_GESTURE_SCROLL_UPDATE:
+ host_->PointerDraggedOnButton(this, LauncherButtonHost::TOUCH, *event);
+ event->SetHandled();
+ return;
+ case ui::ET_GESTURE_SCROLL_END:
+ case ui::ET_SCROLL_FLING_START:
+ host_->PointerReleasedOnButton(this, LauncherButtonHost::TOUCH, false);
+ event->SetHandled();
+ return;
+ default:
+ ImageButton::OnGestureEvent(event);
+ return;
+ }
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/launcher/alternate_app_list_button.h b/ash/launcher/alternate_app_list_button.h
index f68207c2ac..b03c31efa8 100644
--- a/ash/launcher/alternate_app_list_button.h
+++ b/ash/launcher/alternate_app_list_button.h
@@ -43,6 +43,9 @@ class AlternateAppListButton : public views::ImageButton {
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+ // ui::EventHandler overrides:
+ virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
+
private:
LauncherButtonHost* host_;
// Reference to the shelf widget containing this button, owned by the
diff --git a/ash/resources/wallpaper/default_large.jpg b/ash/resources/wallpaper/default_large.jpg
new file mode 100644
index 0000000000..003f3f754b
--- /dev/null
+++ b/ash/resources/wallpaper/default_large.jpg
Binary files differ
diff --git a/ash/resources/wallpaper/default_small.jpg b/ash/resources/wallpaper/default_small.jpg
new file mode 100644
index 0000000000..d8641f36ca
--- /dev/null
+++ b/ash/resources/wallpaper/default_small.jpg
Binary files differ
diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc
index 1cf91d4ce3..2e8648f14d 100644
--- a/ash/wm/drag_window_resizer_unittest.cc
+++ b/ash/wm/drag_window_resizer_unittest.cc
@@ -12,6 +12,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/cursor_manager_test_api.h"
#include "ash/wm/drag_window_controller.h"
+#include "ash/wm/window_util.h"
#include "base/strings/stringprintf.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
@@ -144,7 +145,6 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) {
// The secondary display is logically on the right, but on the system (e.g. X)
// layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
UpdateDisplay("800x600,800x600");
- shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -201,13 +201,52 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) {
}
}
+// Verifies that dragging the active window to another display makes the new
+// root window the active root window.
+TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysActiveRoot) {
+ if (!SupportsMultipleDisplays())
+ return;
+
+ // The secondary display is logically on the right, but on the system (e.g. X)
+ // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
+ UpdateDisplay("800x600,800x600");
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ ASSERT_EQ(2U, root_windows.size());
+
+ aura::test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(new aura::Window(&delegate));
+ window->SetType(aura::client::WINDOW_TYPE_NORMAL);
+ window->Init(ui::LAYER_TEXTURED);
+ SetDefaultParentByPrimaryRootWindow(window.get());
+ window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
+ Shell::GetScreen()->GetPrimaryDisplay());
+ window->Show();
+ EXPECT_TRUE(ash::wm::CanActivateWindow(window.get()));
+ ash::wm::ActivateWindow(window.get());
+ EXPECT_EQ(root_windows[0], window->GetRootWindow());
+ EXPECT_EQ(root_windows[0], ash::Shell::GetActiveRootWindow());
+ {
+ // Grab (0, 0) of the window.
+ scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer(
+ window.get(), gfx::Point(), HTCAPTION));
+ ASSERT_TRUE(resizer.get());
+ // Drag the pointer to the right. Once it reaches the right edge of the
+ // primary display, it warps to the secondary.
+ resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
+ resizer->CompleteDrag(0);
+ // The whole window is on the secondary display now. The parent should be
+ // changed.
+ EXPECT_EQ(root_windows[1], window->GetRootWindow());
+ EXPECT_EQ(root_windows[1], ash::Shell::GetActiveRootWindow());
+ }
+}
+
// Verifies a window can be moved from the secondary display to primary.
TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) {
if (!SupportsMultipleDisplays())
return;
UpdateDisplay("800x600,800x600");
- shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -370,7 +409,6 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) {
// The secondary display is logically on the right, but on the system (e.g. X)
// layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
UpdateDisplay("400x400,800x800*2");
- shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -426,7 +464,6 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
// The secondary display is logically on the right, but on the system (e.g. X)
// layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
UpdateDisplay("400x400,400x400");
- shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());