summaryrefslogtreecommitdiff
path: root/ash
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-05-15 11:34:50 +0100
committerTorne (Richard Coles) <torne@google.com>2013-05-15 11:34:50 +0100
commita93a17c8d99d686bd4a1511e5504e5e6cc9fcadf (patch)
tree2fc96923f36ddec68fee218d79dd407c28fa46f8 /ash
parent770489ea635fbf896c1ace4db0d08d6981a2db8b (diff)
downloadchromium_org-a93a17c8d99d686bd4a1511e5504e5e6cc9fcadf.tar.gz
Merge from Chromium at DEPS revision r200144
This commit was generated by merge_to_master.py. Change-Id: I85f3a249ae157fd8253431215fb2dfcd12ee9bf3
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_switches.cc14
-rw-r--r--ash/ash_switches.h6
-rw-r--r--ash/display/display_change_observer_x11.cc6
-rw-r--r--ash/display/display_change_observer_x11.h2
-rw-r--r--ash/launcher/launcher_view.cc61
-rw-r--r--ash/launcher/launcher_view.h27
-rw-r--r--ash/resources/default_100_percent/common/window_header_base_active.pngbin389 -> 148 bytes
-rw-r--r--ash/resources/default_100_percent/common/window_header_base_inactive.pngbin389 -> 148 bytes
-rw-r--r--ash/resources/default_100_percent/common/window_header_base_incognito_active.pngbin253 -> 150 bytes
-rw-r--r--ash/resources/default_100_percent/common/window_header_base_incognito_inactive.pngbin253 -> 150 bytes
-rw-r--r--ash/resources/default_100_percent/common/window_header_base_minimal.pngbin0 -> 125 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_close_fullscreen_hover.pngbin1360 -> 1501 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_close_fullscreen_pressed.pngbin1459 -> 1607 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_close_short_black_hover.pngbin468 -> 383 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_close_short_black_pressed.pngbin497 -> 493 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_close_short_hover.pngbin1378 -> 1514 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_header_base_active.pngbin0 -> 223 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_header_base_inactive.pngbin0 -> 223 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_header_base_incognito_active.pngbin0 -> 224 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_header_base_incognito_inactive.pngbin0 -> 224 bytes
-rw-r--r--ash/resources/default_200_percent/common/window_header_base_minimal.pngbin0 -> 143 bytes
-rw-r--r--ash/shelf/shelf_layout_manager.cc6
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc16
-rw-r--r--ash/shell/content_client/shell_browser_main_parts.cc23
-rw-r--r--ash/shell/lock_view.cc7
-rw-r--r--ash/system/chromeos/audio/tray_audio.cc37
-rw-r--r--ash/system/chromeos/network/network_state_list_detailed_view.cc31
-rw-r--r--ash/system/chromeos/network/network_state_list_detailed_view.h5
-rw-r--r--ash/system/chromeos/tray_display.cc15
-rw-r--r--ash/system/power/tray_power.cc48
-rw-r--r--ash/system/power/tray_power.h3
-rw-r--r--ash/system/tray/system_tray_delegate.h4
-rw-r--r--ash/system/tray/test_system_tray_delegate.cc2
-rw-r--r--ash/system/tray/test_system_tray_delegate.h2
-rw-r--r--ash/system/tray/tray_background_view.cc7
-rw-r--r--ash/system/tray/tray_background_view.h5
-rw-r--r--ash/system/tray_update.cc3
-rw-r--r--ash/test/ash_test_helper.cc25
-rw-r--r--ash/test/launcher_view_test_api.h3
-rw-r--r--ash/wm/custom_frame_view_ash_unittest.cc5
-rw-r--r--ash/wm/frame_painter.cc38
-rw-r--r--ash/wm/frame_painter.h3
-rw-r--r--ash/wm/frame_painter_unittest.cc35
43 files changed, 268 insertions, 171 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 72cfd9dd94..fe707f2e2c 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -4,6 +4,8 @@
#include "ash/ash_switches.h"
+#include "base/command_line.h"
+
namespace ash {
namespace switches {
@@ -148,5 +150,17 @@ const char kAshDragAndDropAppListToLauncher[] =
// Enables a mode which enforces all browser & application windows to be created
// in maximized mode.
const char kForcedMaximizeMode[] = "forced-maximize-mode";
+
+bool UseNewAudioHandler() {
+ return !CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshDisableNewAudioHandler);
+}
+
+bool ShowAudioDeviceMenu() {
+ return ash::switches::UseNewAudioHandler() &&
+ CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshEnableAudioDeviceMenu);
+}
+
} // namespace switches
} // namespace ash
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index c195c3e0aa..139a27b312 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -57,6 +57,12 @@ ASH_EXPORT extern const char kForceAshToDesktop[];
#endif
ASH_EXPORT extern const char kForcedMaximizeMode[];
+// Returns true if new audio handler should be used.
+ASH_EXPORT bool UseNewAudioHandler();
+
+// Returns true if we should show the audio device switching UI.
+ASH_EXPORT bool ShowAudioDeviceMenu();
+
} // namespace switches
} // namespace ash
diff --git a/ash/display/display_change_observer_x11.cc b/ash/display/display_change_observer_x11.cc
index 90047a1716..cb405d2c66 100644
--- a/ash/display/display_change_observer_x11.cc
+++ b/ash/display/display_change_observer_x11.cc
@@ -132,11 +132,11 @@ DisplayChangeObserverX11::~DisplayChangeObserverX11() {
}
chromeos::OutputState DisplayChangeObserverX11::GetStateForOutputs(
- const std::vector<chromeos::OutputInfo>& outputs) const {
+ const chromeos::OutputSnapshotList& outputs) const {
CHECK(outputs.size() == 2);
DisplayIdPair pair = std::make_pair(
- GetDisplayId(outputs[0].output, outputs[0].output_index),
- GetDisplayId(outputs[1].output, outputs[1].output_index));
+ GetDisplayId(outputs[0].output, outputs[0].index),
+ GetDisplayId(outputs[1].output, outputs[1].index));
DisplayLayout layout = Shell::GetInstance()->display_controller()->
GetRegisteredDisplayLayout(pair);
return layout.mirrored ?
diff --git a/ash/display/display_change_observer_x11.h b/ash/display/display_change_observer_x11.h
index 137137beff..3bcf4611fe 100644
--- a/ash/display/display_change_observer_x11.h
+++ b/ash/display/display_change_observer_x11.h
@@ -29,7 +29,7 @@ class DisplayChangeObserverX11
// chromeos::OutputConfigurator::StateController overrides:
virtual chromeos::OutputState GetStateForOutputs(
- const std::vector<chromeos::OutputInfo>& outputs) const OVERRIDE;
+ const chromeos::OutputSnapshotList& outputs) const OVERRIDE;
// Overriden from chromeos::OutputConfigurator::Observer:
virtual void OnDisplayModeChanged() OVERRIDE;
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index e7eb39cae4..4c2dbf2739 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -8,6 +8,7 @@
#include "ash/ash_constants.h"
#include "ash/ash_switches.h"
+#include "ash/drag_drop/drag_image_view.h"
#include "ash/launcher/app_list_button.h"
#include "ash/launcher/launcher_button.h"
#include "ash/launcher/launcher_delegate.h"
@@ -26,6 +27,8 @@
#include "base/memory/scoped_ptr.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
+#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
@@ -303,6 +306,17 @@ void ReflectItemStatus(const ash::LauncherItem& item,
}
}
+// Get the event location in screen coordinates.
+gfx::Point GetPositionInScreen(const gfx::Point& root_location,
+ views::View* view) {
+ gfx::Point root_location_in_screen = root_location;
+ aura::RootWindow* root_window =
+ view->GetWidget()->GetNativeWindow()->GetRootWindow();
+ aura::client::GetScreenPositionClient(root_window->GetRootWindow())->
+ ConvertPointToScreen(root_window, &root_location_in_screen);
+ return root_location_in_screen;
+}
+
} // namespace
// AnimationDelegate used when deleting an item. This steadily decreased the
@@ -526,6 +540,38 @@ View* LauncherView::GetFocusTraversableParentView() {
return this;
}
+void LauncherView::CreateDragIconProxy(
+ const gfx::Point& location_in_screen_coordinates,
+ const gfx::ImageSkia& icon,
+ views::View* replaced_view,
+ float scale_factor) {
+ drag_replaced_view_ = replaced_view;
+ drag_image_.reset(new ash::internal::DragImageView(
+ drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow()));
+ drag_image_->SetImage(icon);
+ gfx::Size size = drag_image_->GetPreferredSize();
+ size.set_width(size.width() * scale_factor);
+ size.set_height(size.height() * scale_factor);
+ drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2);
+ gfx::Rect drag_image_bounds(
+ GetPositionInScreen(location_in_screen_coordinates,
+ drag_replaced_view_) - drag_image_offset_, size);
+ drag_image_->SetBoundsInScreen(drag_image_bounds);
+ drag_image_->SetWidgetVisible(true);
+}
+
+void LauncherView::UpdateDragIconProxy(
+ const gfx::Point& location_in_screen_coordinates) {
+ drag_image_->SetScreenPosition(
+ GetPositionInScreen(location_in_screen_coordinates,
+ drag_replaced_view_) - drag_image_offset_);
+}
+
+void LauncherView::DestroyDragIconProxy() {
+ drag_image_.reset();
+ drag_image_offset_ = gfx::Vector2d(0, 0);
+}
+
bool LauncherView::StartDrag(const std::string& app_id,
const gfx::Point& location_in_screen_coordinates) {
// Bail if an operation is already going on - or the cursor is not inside.
@@ -554,8 +600,12 @@ bool LauncherView::StartDrag(const std::string& app_id,
model_->ItemIndexByID(drag_and_drop_launcher_id_));
DCHECK(drag_and_drop_view);
- // Since there is already an icon presented, we hide this one for now.
- drag_and_drop_view->SetVisible(false);
+ // Since there is already an icon presented by the caller, we hide this item
+ // for now. That has to be done by reducing the size since the visibility will
+ // change once a regrouping animation is performed.
+ pre_drag_and_drop_size_ = drag_and_drop_view->size();
+ drag_and_drop_view->SetSize(gfx::Size());
+
// First we have to center the mouse cursor over the item.
gfx::Point pt = drag_and_drop_view->GetBoundsInScreen().CenterPoint();
views::View::ConvertPointFromScreen(drag_and_drop_view, &pt);
@@ -594,11 +644,11 @@ void LauncherView::EndDrag(bool cancel) {
PointerReleasedOnButton(
drag_and_drop_view, LauncherButtonHost::DRAG_AND_DROP, cancel);
+ // Either destroy the temporarily created item - or - make the item visible.
if (drag_and_drop_item_created_ && cancel)
delegate_->UnpinAppsWithID(drag_and_drop_app_id_);
-
- if (drag_and_drop_view)
- drag_and_drop_view->SetVisible(true);
+ else if (drag_and_drop_view)
+ drag_and_drop_view->SetSize(pre_drag_and_drop_size_);
drag_and_drop_launcher_id_ = 0;
}
@@ -1437,7 +1487,6 @@ void LauncherView::ButtonPressed(views::Button* sender,
Shell::GetInstance()->ToggleAppList(GetWidget()->GetNativeView());
// By setting us as DnD recipient, the app list knows that we can
// handle items.
- // TODO(skuhne): Invert the flag
if (CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshDragAndDropAppListToLauncher))
Shell::GetInstance()->SetDragAndDropHostOfCurrentAppList(this);
diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h
index b7b8c93841..26bd8c5394 100644
--- a/ash/launcher/launcher_view.h
+++ b/ash/launcher/launcher_view.h
@@ -39,6 +39,7 @@ class LauncherModel;
namespace internal {
+class DragImageView;
class LauncherButton;
class LauncherTooltipManager;
class ShelfLayoutManager;
@@ -100,12 +101,25 @@ class ASH_EXPORT LauncherView : public views::View,
virtual View* GetFocusTraversableParentView() OVERRIDE;
// Overridden from app_list::ApplicationDragAndDropHost:
+ virtual void CreateDragIconProxy(
+ const gfx::Point& location_in_screen_coordinates,
+ const gfx::ImageSkia& icon,
+ views::View* replaced_view,
+ float scale_factor) OVERRIDE;
+ virtual void UpdateDragIconProxy(
+ const gfx::Point& location_in_screen_coordinates) OVERRIDE;
+ virtual void DestroyDragIconProxy() OVERRIDE;
virtual bool StartDrag(
const std::string& app_id,
const gfx::Point& location_in_screen_coordinates) OVERRIDE;
virtual bool Drag(const gfx::Point& location_in_screen_coordinates) OVERRIDE;
virtual void EndDrag(bool cancel) OVERRIDE;
+ // Return the view model for test purposes.
+ const views::ViewModel* const view_model_for_test() const {
+ return view_model_.get();
+ }
+
private:
friend class ash::test::LauncherViewTestAPI;
@@ -340,6 +354,19 @@ class ASH_EXPORT LauncherView : public views::View,
// The application ID of the application which we drag and drop.
std::string drag_and_drop_app_id_;
+ // The original launcher item's size before the dragging operation.
+ gfx::Size pre_drag_and_drop_size_;
+
+ // The image proxy for drag operations when a drag and drop host exists and
+ // the item can be dragged outside the app grid.
+ scoped_ptr<ash::internal::DragImageView> drag_image_;
+
+ // The cursor offset to the middle of the dragged item.
+ gfx::Vector2d drag_image_offset_;
+
+ // The view which gets replaced by our drag icon proxy.
+ views::View* drag_replaced_view_;
+
DISALLOW_COPY_AND_ASSIGN(LauncherView);
};
diff --git a/ash/resources/default_100_percent/common/window_header_base_active.png b/ash/resources/default_100_percent/common/window_header_base_active.png
index b16ce42fa3..6a114e338e 100644
--- a/ash/resources/default_100_percent/common/window_header_base_active.png
+++ b/ash/resources/default_100_percent/common/window_header_base_active.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_header_base_inactive.png b/ash/resources/default_100_percent/common/window_header_base_inactive.png
index b16ce42fa3..56cc412f10 100644
--- a/ash/resources/default_100_percent/common/window_header_base_inactive.png
+++ b/ash/resources/default_100_percent/common/window_header_base_inactive.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_header_base_incognito_active.png b/ash/resources/default_100_percent/common/window_header_base_incognito_active.png
index dfaf1be205..5a10f2301e 100644
--- a/ash/resources/default_100_percent/common/window_header_base_incognito_active.png
+++ b/ash/resources/default_100_percent/common/window_header_base_incognito_active.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_header_base_incognito_inactive.png b/ash/resources/default_100_percent/common/window_header_base_incognito_inactive.png
index 10f6a616f1..ba31737594 100644
--- a/ash/resources/default_100_percent/common/window_header_base_incognito_inactive.png
+++ b/ash/resources/default_100_percent/common/window_header_base_incognito_inactive.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_header_base_minimal.png b/ash/resources/default_100_percent/common/window_header_base_minimal.png
new file mode 100644
index 0000000000..859a50c2a4
--- /dev/null
+++ b/ash/resources/default_100_percent/common/window_header_base_minimal.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png b/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png
index cb8e4d870e..62bf7929aa 100644
--- a/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png
+++ b/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png b/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png
index 3e67704724..0b6639c527 100644
--- a/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png
+++ b/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_close_short_black_hover.png b/ash/resources/default_200_percent/common/window_close_short_black_hover.png
index 729c27e0aa..7dac69cec5 100644
--- a/ash/resources/default_200_percent/common/window_close_short_black_hover.png
+++ b/ash/resources/default_200_percent/common/window_close_short_black_hover.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_close_short_black_pressed.png b/ash/resources/default_200_percent/common/window_close_short_black_pressed.png
index e546f96d26..31d30cf8c5 100644
--- a/ash/resources/default_200_percent/common/window_close_short_black_pressed.png
+++ b/ash/resources/default_200_percent/common/window_close_short_black_pressed.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_close_short_hover.png b/ash/resources/default_200_percent/common/window_close_short_hover.png
index 97ebfa2d20..0281ba237d 100644
--- a/ash/resources/default_200_percent/common/window_close_short_hover.png
+++ b/ash/resources/default_200_percent/common/window_close_short_hover.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_header_base_active.png b/ash/resources/default_200_percent/common/window_header_base_active.png
new file mode 100644
index 0000000000..97850b3c6a
--- /dev/null
+++ b/ash/resources/default_200_percent/common/window_header_base_active.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_header_base_inactive.png b/ash/resources/default_200_percent/common/window_header_base_inactive.png
new file mode 100644
index 0000000000..1bf9a0d02d
--- /dev/null
+++ b/ash/resources/default_200_percent/common/window_header_base_inactive.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_header_base_incognito_active.png b/ash/resources/default_200_percent/common/window_header_base_incognito_active.png
new file mode 100644
index 0000000000..553d7224dd
--- /dev/null
+++ b/ash/resources/default_200_percent/common/window_header_base_incognito_active.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_header_base_incognito_inactive.png b/ash/resources/default_200_percent/common/window_header_base_incognito_inactive.png
new file mode 100644
index 0000000000..8a84a35bfc
--- /dev/null
+++ b/ash/resources/default_200_percent/common/window_header_base_incognito_inactive.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_header_base_minimal.png b/ash/resources/default_200_percent/common/window_header_base_minimal.png
new file mode 100644
index 0000000000..90701ee054
--- /dev/null
+++ b/ash/resources/default_200_percent/common/window_header_base_minimal.png
Binary files differ
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 5eb491a8ed..a441ab3d1a 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -122,8 +122,10 @@ void ShelfLayoutManager::AutoHideEventFilter::OnMouseEvent(
void ShelfLayoutManager::AutoHideEventFilter::OnGestureEvent(
ui::GestureEvent* event) {
- if (gesture_handler_.ProcessGestureEvent(*event))
- event->StopPropagation();
+ if (shelf_->IsShelfWindow(static_cast<aura::Window*>(event->target()))) {
+ if (gesture_handler_.ProcessGestureEvent(*event))
+ event->StopPropagation();
+ }
}
// ShelfLayoutManager:UpdateShelfObserver --------------------------------------
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 4cf3a602ce..2449cde731 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -1084,6 +1084,22 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) {
EXPECT_EQ(shelf_hidden.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
+ // Swipe up outside the hit area. This should not change anything.
+ gfx::Point outside_start = gfx::Point(
+ (GetShelfWidget()->GetWindowBoundsInScreen().x() +
+ GetShelfWidget()->GetWindowBoundsInScreen().right())/2,
+ GetShelfWidget()->GetWindowBoundsInScreen().y() - 50);
+ end.set_y(outside_start.y() - 100);
+ generator.GestureScrollSequence(outside_start,
+ end,
+ base::TimeDelta::FromMilliseconds(10),
+ kNumScrollSteps);
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
+ EXPECT_EQ(shelf_hidden.ToString(),
+ GetShelfWidget()->GetWindowBoundsInScreen().ToString());
+
// Make the window fullscreen.
widget->SetFullscreen(true);
gfx::Rect bounds_fullscreen = window->bounds();
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc
index b2393e6737..7046ee37da 100644
--- a/ash/shell/content_client/shell_browser_main_parts.cc
+++ b/ash/shell/content_client/shell_browser_main_parts.cc
@@ -4,6 +4,7 @@
#include "ash/shell/content_client/shell_browser_main_parts.h"
+#include "ash/ash_switches.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/shell.h"
#include "ash/shell/shell_delegate_impl.h"
@@ -28,18 +29,16 @@
#include "ui/compositor/compositor.h"
#include "ui/compositor/test/compositor_test_support.h"
#include "ui/gfx/screen.h"
+#include "ui/message_center/message_center.h"
#include "ui/views/focus/accelerator_handler.h"
#include "ui/views/test/test_views_delegate.h"
-#if defined(ENABLE_MESSAGE_CENTER)
-#include "ui/message_center/message_center.h"
-#endif
-
#if defined(USE_X11)
#include "ui/base/touch/touch_factory_x11.h"
#endif
#if defined(OS_CHROMEOS)
+#include "chromeos/audio/cras_audio_handler.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#endif
@@ -48,6 +47,7 @@ namespace shell {
void InitWindowTypeLauncher();
namespace {
+
class ShellViewsDelegate : public views::TestViewsDelegate {
public:
ShellViewsDelegate() {}
@@ -109,11 +109,18 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
views::ViewsDelegate::views_delegate = new ShellViewsDelegate;
delegate_ = new ash::shell::ShellDelegateImpl;
-#if defined(ENABLE_MESSAGE_CENTER)
// The global message center state must be initialized absent
// g_browser_process.
message_center::MessageCenter::Initialize();
+
+#if defined(OS_CHROMEOS)
+ if (ash::switches::UseNewAudioHandler()) {
+ // Create CrasAudioHandler for testing since g_browser_process
+ // is absent.
+ chromeos::CrasAudioHandler::InitializeForTesting();
+ }
#endif
+
ash::Shell::CreateInstance(delegate_);
ash::Shell::GetInstance()->set_browser_context(browser_context_.get());
@@ -142,11 +149,15 @@ void ShellBrowserMainParts::PostMainMessageLoopRun() {
delegate_->SetWatcher(NULL);
delegate_ = NULL;
ash::Shell::DeleteInstance();
-#if defined(ENABLE_MESSAGE_CENTER)
// The global message center state must be shutdown absent
// g_browser_process.
message_center::MessageCenter::Shutdown();
+
+#if defined(OS_CHROMEOS)
+ if (ash::switches::UseNewAudioHandler())
+ chromeos::CrasAudioHandler::Shutdown();
#endif
+
aura::Env::DeleteInstance();
// The keyboard may have created a WebContents. The WebContents is destroyed
diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc
index 95691b0756..5663032e5e 100644
--- a/ash/shell/lock_view.cc
+++ b/ash/shell/lock_view.cc
@@ -55,10 +55,9 @@ class LockView : public views::WidgetDelegateView,
bounds.set_size(ps);
unlock_button_->SetBoundsRect(bounds);
}
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) OVERRIDE {
- if (is_add && child == this)
+ virtual void ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) OVERRIDE {
+ if (details.is_add && details.child == this)
unlock_button_->RequestFocus();
}
diff --git a/ash/system/chromeos/audio/tray_audio.cc b/ash/system/chromeos/audio/tray_audio.cc
index 102bb29ea3..7d85e0811d 100644
--- a/ash/system/chromeos/audio/tray_audio.cc
+++ b/ash/system/chromeos/audio/tray_audio.cc
@@ -17,7 +17,6 @@
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/volume_control_delegate.h"
-#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "chromeos/audio/cras_audio_handler.h"
#include "grit/ash_resources.h"
@@ -56,20 +55,8 @@ const int kNoAudioDeviceIcon = -1;
// four are used for ascending volume levels.
const int kVolumeLevels = 4;
-bool UseNewAudioHandler() {
- return !CommandLine::ForCurrentProcess()->
- HasSwitch(ash::switches::kAshDisableNewAudioHandler);
-}
-
-// Returns true if we should show the audio device switching UI.
-bool ShowAudioDeviceMenu() {
- return UseNewAudioHandler() &&
- CommandLine::ForCurrentProcess()->
- HasSwitch(ash::switches::kAshEnableAudioDeviceMenu);
-}
-
bool IsAudioMuted() {
- if(UseNewAudioHandler()) {
+ if(ash::switches::UseNewAudioHandler()) {
return chromeos::CrasAudioHandler::Get()->IsOutputMuted();
} else {
return Shell::GetInstance()->system_tray_delegate()->
@@ -78,7 +65,7 @@ bool IsAudioMuted() {
}
float GetVolumeLevel() {
- if (UseNewAudioHandler()) {
+ if (ash::switches::UseNewAudioHandler()) {
return chromeos::CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f;
} else {
return Shell::GetInstance()->system_tray_delegate()->
@@ -248,7 +235,7 @@ class VolumeView : public ActionableView,
private:
// Updates bar_, device_type_ icon, and more_ buttons.
void UpdateDeviceTypeAndMore() {
- if (!ShowAudioDeviceMenu() || !is_default_view_) {
+ if (!ash::switches::ShowAudioDeviceMenu() || !is_default_view_) {
more_->SetVisible(false);
bar_->SetVisible(false);
device_type_->SetVisible(false);
@@ -321,7 +308,7 @@ class VolumeView : public ActionableView,
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE {
CHECK(sender == icon_);
- if (UseNewAudioHandler()) {
+ if (ash::switches::UseNewAudioHandler()) {
chromeos::CrasAudioHandler::Get()->SetOutputMute(!IsAudioMuted());
} else {
ash::Shell::GetInstance()->system_tray_delegate()->
@@ -335,7 +322,7 @@ class VolumeView : public ActionableView,
float old_value,
views::SliderChangeReason reason) OVERRIDE {
if (reason == views::VALUE_CHANGED_BY_USER) {
- if (UseNewAudioHandler()) {
+ if (ash::switches::UseNewAudioHandler()) {
chromeos::CrasAudioHandler::Get()->
SetOutputVolumePercent(value * 100.0f);
}
@@ -486,14 +473,14 @@ TrayAudio::TrayAudio(SystemTray* system_tray)
volume_view_(NULL),
audio_detail_(NULL),
pop_up_volume_view_(false) {
- if (UseNewAudioHandler())
+ if (ash::switches::UseNewAudioHandler())
chromeos::CrasAudioHandler::Get()->AddAudioObserver(this);
else
Shell::GetInstance()->system_tray_notifier()->AddAudioObserver(this);
}
TrayAudio::~TrayAudio() {
- if (UseNewAudioHandler()) {
+ if (ash::switches::UseNewAudioHandler()) {
if (chromeos::CrasAudioHandler::IsInitialized())
chromeos::CrasAudioHandler::Get()->RemoveAudioObserver(this);
} else {
@@ -511,7 +498,7 @@ views::View* TrayAudio::CreateDefaultView(user::LoginStatus status) {
}
views::View* TrayAudio::CreateDetailedView(user::LoginStatus status) {
- if (!ShowAudioDeviceMenu() || pop_up_volume_view_) {
+ if (!ash::switches::ShowAudioDeviceMenu() || pop_up_volume_view_) {
volume_view_ = new tray::VolumeView(this, false);
return volume_view_;
} else {
@@ -542,7 +529,7 @@ bool TrayAudio::ShouldShowLauncher() const {
}
void TrayAudio::OnVolumeChanged(float percent) {
- DCHECK(!UseNewAudioHandler());
+ DCHECK(!ash::switches::UseNewAudioHandler());
if (tray_view())
tray_view()->SetVisible(GetInitialVisibility());
@@ -557,7 +544,7 @@ void TrayAudio::OnVolumeChanged(float percent) {
}
void TrayAudio::OnMuteToggled() {
- DCHECK(!UseNewAudioHandler());
+ DCHECK(!ash::switches::UseNewAudioHandler());
if (tray_view())
tray_view()->SetVisible(GetInitialVisibility());
@@ -569,7 +556,7 @@ void TrayAudio::OnMuteToggled() {
void TrayAudio::OnOutputVolumeChanged() {
- DCHECK(UseNewAudioHandler());
+ DCHECK(ash::switches::UseNewAudioHandler());
float percent = GetVolumeLevel();
if (tray_view())
tray_view()->SetVisible(GetInitialVisibility());
@@ -584,7 +571,7 @@ void TrayAudio::OnOutputVolumeChanged() {
}
void TrayAudio::OnOutputMuteChanged() {
- DCHECK(UseNewAudioHandler());
+ DCHECK(ash::switches::UseNewAudioHandler());
if (tray_view())
tray_view()->SetVisible(GetInitialVisibility());
diff --git a/ash/system/chromeos/network/network_state_list_detailed_view.cc b/ash/system/chromeos/network/network_state_list_detailed_view.cc
index 296e3566bb..9ba3849ab1 100644
--- a/ash/system/chromeos/network/network_state_list_detailed_view.cc
+++ b/ash/system/chromeos/network/network_state_list_detailed_view.cc
@@ -24,7 +24,7 @@
#include "base/utf_string_conversions.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/network/device_state.h"
-#include "chromeos/network/network_configuration_handler.h"
+#include "chromeos/network/network_connection_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "grit/ash_resources.h"
@@ -42,6 +42,7 @@
using chromeos::DeviceState;
using chromeos::NetworkState;
using chromeos::NetworkStateHandler;
+using chromeos::NetworkConnectionHandler;
namespace ash {
namespace internal {
@@ -759,26 +760,36 @@ views::View* NetworkStateListDetailedView::CreateNetworkInfoView() {
void NetworkStateListDetailedView::ConnectToNetwork(
const std::string& service_path) {
- NetworkStateHandler* handler = NetworkStateHandler::Get();
- const NetworkState* network = handler->GetNetworkState(service_path);
+ const NetworkState* network =
+ NetworkStateHandler::Get()->GetNetworkState(service_path);
if (!network)
return;
if (CommandLine::ForCurrentProcess()->HasSwitch(
- chromeos::switches::kUseNewNetworkConfigurationHandlers) &&
- !network->IsConnectedState()) {
- handler->SetConnectingNetwork(service_path);
- chromeos::NetworkConfigurationHandler::Get()->Connect(
+ chromeos::switches::kUseNewNetworkConfigurationHandlers)) {
+ NetworkConnectionHandler::Get()->ConnectToNetwork(
service_path,
base::Bind(&base::DoNothing),
- chromeos::network_handler::ErrorCallback());
+ base::Bind(&NetworkStateListDetailedView::OnConnectFailed,
+ AsWeakPtr(), service_path));
} else {
- // This will show the settings UI for a connected network.
- // TODO(stevenjb): Change the API to explicitly show network settings.
Shell::GetInstance()->system_tray_delegate()->ConnectToNetwork(
service_path);
}
}
+void NetworkStateListDetailedView::OnConnectFailed(
+ const std::string& service_path,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data) {
+ VLOG(1) << "ConnectFailed: " << error_name;
+ // This will show the settings UI for a connected/ing network or a connect
+ // dialog for unconfigured networks.
+ // TODO(stevenjb): Change the API to explicitly show network settings or
+ // connect dialog (i.e. explicitly handle different error types).
+ Shell::GetInstance()->system_tray_delegate()->ConnectToNetwork(
+ service_path);
+}
+
void NetworkStateListDetailedView::CallRequestScan() {
VLOG(1) << "Requesting Network Scan.";
NetworkStateHandler::Get()->RequestScan();
diff --git a/ash/system/chromeos/network/network_state_list_detailed_view.h b/ash/system/chromeos/network/network_state_list_detailed_view.h
index b176ddecb3..9f689d6d28 100644
--- a/ash/system/chromeos/network/network_state_list_detailed_view.h
+++ b/ash/system/chromeos/network/network_state_list_detailed_view.h
@@ -110,6 +110,11 @@ class NetworkStateListDetailedView
// Handle click (connect) action.
void ConnectToNetwork(const std::string& service_path);
+ // Handle connect failures (new handlers only).
+ void OnConnectFailed(const std::string& service_path,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data);
+
// Periodically request a network scan.
void CallRequestScan();
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc
index 5c19dfba6a..f3d3297078 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -14,21 +14,18 @@
#include "ash/system/tray/tray_constants.h"
#include "base/chromeos/chromeos_version.h"
#include "base/utf_string_conversions.h"
+#include "chromeos/display/output_configurator.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "ui/aura/env.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/x/x11_util.h"
#include "ui/gfx/image/image.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
-#if defined(USE_X11)
-#include "chromeos/display/output_configurator.h"
-#include "ui/base/x/x11_util.h"
-#endif
-
namespace ash {
namespace internal {
@@ -57,9 +54,6 @@ class DisplayView : public ash::internal::ActionableView {
virtual ~DisplayView() {}
void Update() {
-#if !defined(USE_X11)
- SetVisible(false);
-#else
chromeos::OutputState state =
base::chromeos::IsRunningOnChromeOS() ?
Shell::GetInstance()->output_configurator()->output_state() :
@@ -82,7 +76,6 @@ class DisplayView : public ash::internal::ActionableView {
return;
}
NOTREACHED() << "Unhandled state " << state;
-#endif
}
chromeos::OutputState InferOutputState() const {
@@ -141,16 +134,12 @@ TrayDisplay::TrayDisplay(SystemTray* system_tray)
: SystemTrayItem(system_tray),
default_(NULL) {
Shell::GetScreen()->AddObserver(this);
-#if defined(USE_X11)
Shell::GetInstance()->output_configurator()->AddObserver(this);
-#endif
}
TrayDisplay::~TrayDisplay() {
Shell::GetScreen()->RemoveObserver(this);
-#if defined(USE_X11)
Shell::GetInstance()->output_configurator()->RemoveObserver(this);
-#endif
}
views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc
index 4d27337f41..5ec9e3b37b 100644
--- a/ash/system/power/tray_power.cc
+++ b/ash/system/power/tray_power.cc
@@ -58,6 +58,10 @@ const int kLowPowerSeconds = 15 * 60;
const int kNoWarningSeconds = 30 * 60;
// Minimum battery percentage rendered in UI.
const int kMinBatteryPercent = 1;
+// Notification in battery percentage.
+const double kCriticalPercentage = 5.0;
+const double kLowPowerPercentage = 10.0;
+const double kNoWarningPercentage = 15.0;
base::string16 GetBatteryTimeAccessibilityString(int hour, int min) {
DCHECK(hour || min);
@@ -391,12 +395,21 @@ void TrayPower::OnPowerStatusChanged(const PowerSupplyStatus& status) {
bool TrayPower::UpdateNotificationState(const PowerSupplyStatus& status) {
if (!status.battery_is_present ||
status.is_calculating_battery_time ||
- status.battery_state != PowerSupplyStatus::DISCHARGING) {
+ status.battery_state == PowerSupplyStatus::CHARGING) {
notification_state_ = NOTIFICATION_NONE;
return false;
}
- int remaining_seconds = status.battery_seconds_to_empty;
+ if (TrayPower::IsBatteryChargingUnreliable(status)) {
+ return UpdateNotificationStateForRemainingPercentage(
+ status.battery_percentage);
+ } else {
+ return UpdateNotificationStateForRemainingTime(
+ status.battery_seconds_to_empty);
+ }
+}
+
+bool TrayPower::UpdateNotificationStateForRemainingTime(int remaining_seconds) {
if (remaining_seconds >= kNoWarningSeconds) {
notification_state_ = NOTIFICATION_NONE;
return false;
@@ -425,5 +438,36 @@ bool TrayPower::UpdateNotificationState(const PowerSupplyStatus& status) {
return false;
}
+bool TrayPower::UpdateNotificationStateForRemainingPercentage(
+ double remaining_percentage) {
+ if (remaining_percentage > kNoWarningPercentage) {
+ notification_state_ = NOTIFICATION_NONE;
+ return false;
+ }
+
+ switch (notification_state_) {
+ case NOTIFICATION_NONE:
+ if (remaining_percentage <= kCriticalPercentage) {
+ notification_state_ = NOTIFICATION_CRITICAL;
+ return true;
+ }
+ if (remaining_percentage <= kLowPowerPercentage) {
+ notification_state_ = NOTIFICATION_LOW_POWER;
+ return true;
+ }
+ return false;
+ case NOTIFICATION_LOW_POWER:
+ if (remaining_percentage <= kCriticalPercentage) {
+ notification_state_ = NOTIFICATION_CRITICAL;
+ return true;
+ }
+ return false;
+ case NOTIFICATION_CRITICAL:
+ return false;
+ }
+ NOTREACHED();
+ return false;
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/system/power/tray_power.h b/ash/system/power/tray_power.h
index 7865b1af5c..19eaf63638 100644
--- a/ash/system/power/tray_power.h
+++ b/ash/system/power/tray_power.h
@@ -87,6 +87,9 @@ class TrayPower : public SystemTrayItem,
// Sets |notification_state_|. Returns true if a notification should be shown.
bool UpdateNotificationState(const PowerSupplyStatus& status);
+ bool UpdateNotificationStateForRemainingTime(int remaining_seconds);
+ bool UpdateNotificationStateForRemainingPercentage(
+ double remaining_percentage);
tray::PowerTrayView* power_tray_;
tray::PowerNotificationView* notification_view_;
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index 6f8860526c..ee0409e08b 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -217,8 +217,8 @@ class SystemTrayDelegate {
// Attempts to lock the screen.
virtual void RequestLockScreen() = 0;
- // Attempts to restart the system.
- virtual void RequestRestart() = 0;
+ // Attempts to restart the system for update.
+ virtual void RequestRestartForUpdate() = 0;
// Returns a list of available bluetooth devices.
virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc
index 89fc09724b..8299249dfb 100644
--- a/ash/system/tray/test_system_tray_delegate.cc
+++ b/ash/system/tray/test_system_tray_delegate.cc
@@ -199,7 +199,7 @@ void TestSystemTrayDelegate::SignOut() {
void TestSystemTrayDelegate::RequestLockScreen() {
}
-void TestSystemTrayDelegate::RequestRestart() {
+void TestSystemTrayDelegate::RequestRestartForUpdate() {
}
void TestSystemTrayDelegate::GetAvailableBluetoothDevices(
diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h
index 516e4248b6..8f5f5c3386 100644
--- a/ash/system/tray/test_system_tray_delegate.h
+++ b/ash/system/tray/test_system_tray_delegate.h
@@ -59,7 +59,7 @@ class TestSystemTrayDelegate : public SystemTrayDelegate {
virtual void ShutDown() OVERRIDE;
virtual void SignOut() OVERRIDE;
virtual void RequestLockScreen() OVERRIDE;
- virtual void RequestRestart() OVERRIDE;
+ virtual void RequestRestartForUpdate() OVERRIDE;
virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* list) OVERRIDE;
virtual void BluetoothStartDiscovering() OVERRIDE;
virtual void BluetoothStopDiscovering() OVERRIDE;
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index 3f51d62a14..1352ecdd43 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -128,10 +128,9 @@ void TrayBackgroundView::TrayContainer::ChildVisibilityChanged(View* child) {
PreferredSizeChanged();
}
-void TrayBackgroundView::TrayContainer::ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) {
- if (parent == this)
+void TrayBackgroundView::TrayContainer::ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) {
+ if (details.parent == this)
PreferredSizeChanged();
}
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h
index 15597baa03..a5f85973c3 100644
--- a/ash/system/tray/tray_background_view.h
+++ b/ash/system/tray/tray_background_view.h
@@ -44,9 +44,8 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// Overridden from views::View.
virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
virtual void ChildVisibilityChanged(View* child) OVERRIDE;
- virtual void ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) OVERRIDE;
+ virtual void ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) OVERRIDE;
private:
void UpdateLayout();
diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc
index 902354de75..e998cc7a32 100644
--- a/ash/system/tray_update.cc
+++ b/ash/system/tray_update.cc
@@ -85,7 +85,8 @@ class UpdateView : public ash::internal::ActionableView {
private:
// Overridden from ActionableView.
virtual bool PerformAction(const ui::Event& event) OVERRIDE {
- ash::Shell::GetInstance()->system_tray_delegate()->RequestRestart();
+ ash::Shell::GetInstance()->
+ system_tray_delegate()->RequestRestartForUpdate();
return true;
}
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index c95fe28e6b..50d3879d1f 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -9,15 +9,14 @@
#include "ash/test/display_manager_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_shell_delegate.h"
-#include "base/command_line.h"
#include "base/run_loop.h"
#include "ui/aura/env.h"
#include "ui/base/ime/text_input_test_support.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
-
-
-#if defined(ENABLE_MESSAGE_CENTER)
#include "ui/message_center/message_center.h"
+
+#if defined(OS_CHROMEOS)
+#include "chromeos/audio/cras_audio_handler.h"
#endif
namespace ash {
@@ -33,10 +32,6 @@ AshTestHelper::~AshTestHelper() {
}
void AshTestHelper::SetUp() {
- // TODO(jennyz): Create mock or test AudioHandler so we can instantiate
- // an ash::Shell with the new CrasAudioHandler. crbug.com/233266
- CommandLine::ForCurrentProcess()->AppendSwitch(
- ash::switches::kAshDisableNewAudioHandler);
// Disable animations during tests.
zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
@@ -45,11 +40,18 @@ void AshTestHelper::SetUp() {
// Creates Shell and hook with Desktop.
test_shell_delegate_ = new TestShellDelegate;
-#if defined(ENABLE_MESSAGE_CENTER)
// Creates MessageCenter since g_browser_process is not created in AshTestBase
// tests.
message_center::MessageCenter::Initialize();
+
+#if defined(OS_CHROMEOS)
+ if (ash::switches::UseNewAudioHandler()) {
+ // Create CrasAuidoHandler for testing since g_browser_process is not
+ // created in AshTestBase tests.
+ chromeos::CrasAudioHandler::InitializeForTesting();
+ }
#endif
+
ash::Shell::CreateInstance(test_shell_delegate_);
Shell* shell = Shell::GetInstance();
test::DisplayManagerTestApi(shell->display_manager()).
@@ -62,9 +64,12 @@ void AshTestHelper::TearDown() {
// Tear down the shell.
Shell::DeleteInstance();
-#if defined(ENABLE_MESSAGE_CENTER)
// Remove global message center state.
message_center::MessageCenter::Shutdown();
+
+#if defined(OS_CHROMEOS)
+ if (ash::switches::UseNewAudioHandler())
+ chromeos::CrasAudioHandler::Shutdown();
#endif
aura::Env::DeleteInstance();
diff --git a/ash/test/launcher_view_test_api.h b/ash/test/launcher_view_test_api.h
index f44f617916..35cb444088 100644
--- a/ash/test/launcher_view_test_api.h
+++ b/ash/test/launcher_view_test_api.h
@@ -51,6 +51,9 @@ class LauncherViewTestAPI {
// Runs message loop and waits until all add/remove animations are done.
void RunMessageLoopUntilAnimationsDone();
+ // An accessor for |launcher_view|.
+ internal::LauncherView* launcher_view() { return launcher_view_; }
+
private:
internal::LauncherView* launcher_view_;
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc
index 5d12b114fc..c08704679b 100644
--- a/ash/wm/custom_frame_view_ash_unittest.cc
+++ b/ash/wm/custom_frame_view_ash_unittest.cc
@@ -68,7 +68,10 @@ class ShellViewsDelegate : public views::TestViewsDelegate {
// Overridden from views::TestViewsDelegate:
virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
views::Widget* widget) OVERRIDE {
- return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget);
+ // Always test CustomFrameViewAsh, which may not be the ash::Shell default.
+ CustomFrameViewAsh* frame_view = new CustomFrameViewAsh;
+ frame_view->Init(widget);
+ return frame_view;
}
virtual bool UseTransparentWindows() const OVERRIDE {
// Ash uses transparent window frames.
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index d23a6dfc39..287c5a7872 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -306,7 +306,6 @@ int FramePainter::NonClientHitTest(views::NonClientFrameView* view,
kResizeAreaCornerSize,
kResizeAreaCornerSize,
can_ever_resize);
- frame_component = AdjustFrameHitCodeForMaximizedModes(frame_component);
if (frame_component != HTNOWHERE)
return frame_component;
@@ -774,43 +773,6 @@ int FramePainter::GetHeaderOpacity(HeaderMode header_mode,
return kInactiveWindowOpacity;
}
-int FramePainter::AdjustFrameHitCodeForMaximizedModes(int hit_code) {
- if (hit_code != HTNOWHERE && wm::IsWindowNormal(window_) &&
- GetRestoreBoundsInScreen(window_)) {
- // When there is a restore rectangle, a left/right maximized window might
- // be active.
- const gfx::Rect& bounds = frame_->GetWindowBoundsInScreen();
- const gfx::Rect& screen =
- Shell::GetScreen()->GetDisplayMatching(bounds).work_area();
- if (bounds.y() == screen.y() && bounds.bottom() == screen.bottom()) {
- // The window is probably either left or right maximized.
- if (bounds.x() == screen.x()) {
- // It is left maximized and we can only allow a right resize.
- return (hit_code == HTBOTTOMRIGHT ||
- hit_code == HTTOPRIGHT ||
- hit_code == HTRIGHT) ? HTRIGHT : HTNOWHERE;
- } else if (bounds.right() == screen.right()) {
- // It is right maximized and we can only allow a left resize.
- return (hit_code == HTBOTTOMLEFT ||
- hit_code == HTTOPLEFT ||
- hit_code == HTLEFT) ? HTLEFT : HTNOWHERE;
- }
- } else if (bounds.x() == screen.x() &&
- bounds.right() == screen.right()) {
- // If horizontal fill mode is activated we don't allow a left/right
- // resizing.
- if (hit_code == HTTOPRIGHT ||
- hit_code == HTTOP ||
- hit_code == HTTOPLEFT)
- return HTTOP;
- return (hit_code == HTBOTTOMRIGHT ||
- hit_code == HTBOTTOM ||
- hit_code == HTBOTTOMLEFT) ? HTBOTTOM : HTNOWHERE;
- }
- }
- return hit_code;
-}
-
bool FramePainter::IsCyclingThroughWorkspaces() const {
aura::RootWindow* root = window_->GetRootWindow();
return root && root->GetProperty(internal::kCyclingThroughWorkspacesKey);
diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h
index 5b8f3dfb1f..fce61ad578 100644
--- a/ash/wm/frame_painter.h
+++ b/ash/wm/frame_painter.h
@@ -168,9 +168,6 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver,
int theme_frame_id,
const gfx::ImageSkia* theme_frame_overlay);
- // Adjust frame operations for left / right maximized modes.
- int AdjustFrameHitCodeForMaximizedModes(int hit_code);
-
// Returns true if the user is cycling through workspaces.
bool IsCyclingThroughWorkspaces() const;
diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc
index 275c4847ec..c72649bf98 100644
--- a/ash/wm/frame_painter_unittest.cc
+++ b/ash/wm/frame_painter_unittest.cc
@@ -646,39 +646,4 @@ TEST_F(FramePainterTest, GetHeaderOpacity) {
NULL));
}
-// Test the hit test function with windows which are "partially maximized".
-TEST_F(FramePainterTest, HitTestSpecialMaximizedModes) {
- // Create a widget and a painter for it.
- scoped_ptr<Widget> w1(CreateResizableWidget());
- FramePainter p1;
- ImageButton size1(NULL);
- ImageButton close1(NULL);
- p1.Init(w1.get(), NULL, &size1, &close1, FramePainter::SIZE_BUTTON_MAXIMIZES);
- views::NonClientFrameView* frame = w1->non_client_view()->frame_view();
- w1->Show();
- gfx::Rect any_rect = gfx::Rect(0, 0, 100, 100);
- gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(
- any_rect).work_area();
- w1->SetBounds(any_rect);
- EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
- w1->SetBounds(gfx::Rect(
- screen.x(), screen.y(), screen.width() / 2, screen.height()));
- // A hit without a set restore rect should produce a top left hit.
- EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
- ash::SetRestoreBoundsInScreen(w1->GetNativeWindow(), any_rect);
- // A hit into the corner should produce nowhere - not left.
- EXPECT_EQ(HTCAPTION, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
- // A hit into the middle upper area should generate right - not top&right.
- EXPECT_EQ(HTRIGHT,
- p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2, 15)));
- // A hit into the middle should generate right.
- EXPECT_EQ(HTRIGHT,
- p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2,
- screen.height() / 2)));
- // A hit into the middle lower area should generate right - not bottom&right.
- EXPECT_EQ(HTRIGHT,
- p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2,
- screen.height() - 1)));
-}
-
} // namespace ash