Merge from Chromium at DEPS revision 260458

This commit was generated by merge_to_master.py.

Change-Id: I140fa91b7f09c8efba4424e99ccb87b94a11d022
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 7195004..9f1d226 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -1140,13 +1140,7 @@
 
 void AcceleratorController::SetBrightnessControlDelegate(
     scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) {
-  // Install brightness control delegate only when internal
-  // display exists.
-  if (Shell::GetInstance()->display_manager()->HasInternalDisplay() ||
-      CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kAshEnableBrightnessControl)) {
-    brightness_control_delegate_ = brightness_control_delegate.Pass();
-  }
+  brightness_control_delegate_ = brightness_control_delegate.Pass();
 }
 
 void AcceleratorController::SetImeControlDelegate(
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index 80a2345..5be401a 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -754,18 +754,6 @@
   const ui::Accelerator brightness_down(ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE);
   const ui::Accelerator brightness_up(ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE);
   {
-    EXPECT_FALSE(ProcessWithContext(brightness_down));
-    EXPECT_FALSE(ProcessWithContext(brightness_up));
-    DummyBrightnessControlDelegate* delegate =
-        new DummyBrightnessControlDelegate(true);
-    GetController()->SetBrightnessControlDelegate(
-        scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
-    EXPECT_FALSE(ProcessWithContext(brightness_down));
-    EXPECT_FALSE(ProcessWithContext(brightness_up));
-  }
-  // Enable internal display.
-  EnableInternalDisplay();
-  {
     DummyBrightnessControlDelegate* delegate =
         new DummyBrightnessControlDelegate(false);
     GetController()->SetBrightnessControlDelegate(
@@ -1167,19 +1155,6 @@
   const ui::Accelerator brightness_down(ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE);
   const ui::Accelerator brightness_up(ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE);
   {
-    EXPECT_FALSE(ProcessWithContext(brightness_down));
-    EXPECT_FALSE(ProcessWithContext(brightness_up));
-    DummyBrightnessControlDelegate* delegate =
-        new DummyBrightnessControlDelegate(true);
-    GetController()->SetBrightnessControlDelegate(
-        scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
-    EXPECT_FALSE(ProcessWithContext(brightness_down));
-    EXPECT_FALSE(ProcessWithContext(brightness_up));
-  }
-  EnableInternalDisplay();
-  {
-    EXPECT_FALSE(ProcessWithContext(brightness_down));
-    EXPECT_FALSE(ProcessWithContext(brightness_up));
     DummyBrightnessControlDelegate* delegate =
         new DummyBrightnessControlDelegate(false);
     GetController()->SetBrightnessControlDelegate(
diff --git a/ash/accelerators/nested_dispatcher_controller.h b/ash/accelerators/nested_dispatcher_controller.h
index 74dcd90..b3db4e9 100644
--- a/ash/accelerators/nested_dispatcher_controller.h
+++ b/ash/accelerators/nested_dispatcher_controller.h
@@ -8,7 +8,7 @@
 #include "ash/ash_export.h"
 #include "base/callback.h"
 #include "base/message_loop/message_loop.h"
-#include "ui/aura/client/dispatcher_client.h"
+#include "ui/wm/public/dispatcher_client.h"
 
 namespace ash {
 
diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc
index b40903e..cc0a352 100644
--- a/ash/accelerators/nested_dispatcher_controller_unittest.cc
+++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc
@@ -10,13 +10,13 @@
 #include "base/bind.h"
 #include "base/event_types.h"
 #include "base/message_loop/message_loop.h"
-#include "ui/aura/client/dispatcher_client.h"
 #include "ui/aura/test/test_windows.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/base/accelerators/accelerator.h"
 #include "ui/events/event_constants.h"
 #include "ui/events/event_utils.h"
+#include "ui/wm/public/dispatcher_client.h"
 
 #if defined(USE_X11)
 #include <X11/Xlib.h>
diff --git a/ash/accessibility_delegate.h b/ash/accessibility_delegate.h
index 037a40f..7a1b400 100644
--- a/ash/accessibility_delegate.h
+++ b/ash/accessibility_delegate.h
@@ -21,7 +21,7 @@
   A11Y_ALERT_WINDOW_NEEDED
 };
 
-// A deletate class to control accessibility features.
+// A delegate class to control and query accessibility features.
 class ASH_EXPORT AccessibilityDelegate {
  public:
   virtual ~AccessibilityDelegate() {}
@@ -45,7 +45,7 @@
   // Invoked to change the type of the screen magnifier.
   virtual void SetMagnifierType(MagnifierType type) = 0;
 
-  // Returns true if the screen magnifier is enabled or not.
+  // Returns true if the screen magnifier is enabled.
   virtual bool IsMagnifierEnabled() const = 0;
 
   // Returns the current screen magnifier mode.
@@ -54,7 +54,7 @@
   // Invoked to enable Large Cursor.
   virtual void SetLargeCursorEnabled(bool enabled) = 0;
 
-  // Returns ture if Large Cursor is enabled or not.
+  // Returns ture if Large Cursor is enabled.
   virtual bool IsLargeCursorEnabled() const = 0;
 
   // Invoked to enable autoclick.
@@ -72,6 +72,9 @@
   // Returns true when the accessibility menu should be shown.
   virtual bool ShouldShowAccessibilityMenu() const = 0;
 
+  // Returns true if a braille display is connected to the system.
+  virtual bool IsBrailleDisplayConnected() const = 0;
+
   // Cancel all current and queued speech immediately.
   virtual void SilenceSpokenFeedback() const = 0;
 
diff --git a/ash/ash.gyp b/ash/ash.gyp
index c65d6ed..ebb6e60 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -25,12 +25,14 @@
         '../skia/skia.gyp:skia',
         '../third_party/icu/icu.gyp:icui18n',
         '../third_party/icu/icu.gyp:icuuc',
+        '../ui/accessibility/accessibility.gyp:accessibility',
         '../ui/app_list/app_list.gyp:app_list',
         '../ui/aura/aura.gyp:aura',
         '../ui/base/strings/ui_strings.gyp:ui_strings',
         '../ui/base/ui_base.gyp:ui_base',
         '../ui/compositor/compositor.gyp:compositor',
         '../ui/events/events.gyp:events',
+        '../ui/events/events.gyp:events_base',
         '../ui/gfx/gfx.gyp:gfx',
         '../ui/gfx/gfx.gyp:gfx_geometry',
         '../ui/keyboard/keyboard.gyp:keyboard',
@@ -550,7 +552,7 @@
         'wm/maximize_mode/maximize_mode_window_manager.cc',
         'wm/maximize_mode/maximize_mode_window_manager.h',
         'wm/maximize_mode/maximize_mode_window_state.cc',
-        'wm/maximize_mode/maximize_mode_window_state.h',        
+        'wm/maximize_mode/maximize_mode_window_state.h',
         'wm/maximize_mode/workspace_backdrop_delegate.cc',
         'wm/maximize_mode/workspace_backdrop_delegate.h',
         'wm/mru_window_tracker.cc',
@@ -675,10 +677,6 @@
             ['exclude', 'accelerators/magnifier_key_scroller.h'],
             ['exclude', 'accelerators/spoken_feedback_toggler.cc'],
             ['exclude', 'accelerators/spoken_feedback_toggler.h'],
-            ['exclude', 'display/display_change_observer_chromeos.cc'],
-            ['exclude', 'display/display_change_observer_chromeos.h'],
-            ['exclude', 'display/display_error_observer_chromeos.cc'],
-            ['exclude', 'display/display_error_observer_chromeos.h'],
           ],
         }],
         ['chromeos==1', {
@@ -847,10 +845,10 @@
         '../ui/message_center/message_center.gyp:message_center_test_support',
         '../ui/resources/ui_resources.gyp:ui_resources',
         '../ui/ui_unittests.gyp:ui_test_support',
+        '../ui/views/controls/webview/webview_tests.gyp:webview_test_support',
+        '../ui/views/examples/examples.gyp:views_examples_with_content_lib',
         '../ui/views/views.gyp:views',
-        '../ui/views/views.gyp:views_examples_with_content_lib',
         '../ui/views/views.gyp:views_test_support',
-        '../ui/views/views.gyp:views_with_content_test_support',
         '../ui/web_dialogs/web_dialogs.gyp:web_dialogs_test_support',
         '../ui/wm/wm.gyp:wm_core',
         '../url/url.gyp:url_lib',
@@ -1029,8 +1027,6 @@
           'sources/': [
             ['exclude', 'accelerators/magnifier_key_scroller_unittest.cc'],
             ['exclude', 'accelerators/spoken_feedback_toggler_unittest.cc'],
-            ['exclude', 'display/display_change_observer_chromeos_unittest.cc'],
-            ['exclude', 'display/display_error_observer_chromeos_unittest.cc'],
           ],
         }],
         ['chromeos==1', {
@@ -1082,9 +1078,9 @@
         '../ui/keyboard/keyboard.gyp:keyboard',
         '../ui/message_center/message_center.gyp:message_center',
         '../ui/resources/ui_resources.gyp:ui_resources',
+        '../ui/views/examples/examples.gyp:views_examples_lib',
+        '../ui/views/examples/examples.gyp:views_examples_with_content_lib',
         '../ui/views/views.gyp:views',
-        '../ui/views/views.gyp:views_examples_lib',
-        '../ui/views/views.gyp:views_examples_with_content_lib',
         '../ui/views/views.gyp:views_test_support',
         'ash',
         'ash_resources',
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd
index e0531e4..1e5ed6f 100644
--- a/ash/ash_strings.grd
+++ b/ash/ash_strings.grd
@@ -208,6 +208,9 @@
       <message name="IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the status tray.">
         Status tray
       </message>
+      <message name="IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED_BUBBLE" desc="The message shown on a bubble when a braille display is connected">
+Braille display connected.
+      </message>
       <message name="IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_ENABLED_BUBBLE" desc="The message shown on a bubble when spoken feedback is enabled">
 ChromeVox (spoken feedback) is enabled.
 Press Ctrl+Alt+Z to disable.
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index a96fafd..7c3146f 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -57,10 +57,6 @@
 const char kAshEnableAlternateFrameCaptionButtonStyle[] =
     "ash-enable-alternate-caption-button";
 
-// Always enable brightness control. Used by machines that don't report their
-// main monitor as internal.
-const char kAshEnableBrightnessControl[] = "ash-enable-brightness-control";
-
 #if defined(OS_CHROMEOS)
 // Enables key bindings to scroll magnified screen.
 const char kAshEnableMagnifierKeyScroller[] =
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 80ab2db..829ee96 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -28,7 +28,6 @@
 ASH_EXPORT extern const char kAshDisableAlternateShelfLayout[];
 ASH_EXPORT extern const char kAshDisableDockedWindows[];
 ASH_EXPORT extern const char kAshEnableAlternateFrameCaptionButtonStyle[];
-ASH_EXPORT extern const char kAshEnableBrightnessControl[];
 #if defined(OS_CHROMEOS)
 ASH_EXPORT extern const char kAshEnableMagnifierKeyScroller[];
 ASH_EXPORT extern const char kAshEnableMultiUserTray[];
diff --git a/ash/default_accessibility_delegate.cc b/ash/default_accessibility_delegate.cc
index 975c3b6..169b4f7 100644
--- a/ash/default_accessibility_delegate.cc
+++ b/ash/default_accessibility_delegate.cc
@@ -83,6 +83,10 @@
          virtual_keyboard_enabled_;
 }
 
+bool DefaultAccessibilityDelegate::IsBrailleDisplayConnected() const {
+  return false;
+}
+
 void DefaultAccessibilityDelegate::SilenceSpokenFeedback() const {
 }
 
diff --git a/ash/default_accessibility_delegate.h b/ash/default_accessibility_delegate.h
index 6254218..4804bbd 100644
--- a/ash/default_accessibility_delegate.h
+++ b/ash/default_accessibility_delegate.h
@@ -32,6 +32,7 @@
   virtual void SetVirtualKeyboardEnabled(bool enabled) OVERRIDE;
   virtual bool IsVirtualKeyboardEnabled() const OVERRIDE;
   virtual bool ShouldShowAccessibilityMenu() const OVERRIDE;
+  virtual bool IsBrailleDisplayConnected() const OVERRIDE;
   virtual void SilenceSpokenFeedback() const OVERRIDE;
   virtual void ToggleSpokenFeedback(
       AccessibilityNotificationVisibility notify) OVERRIDE;
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc
index 0f14604..b0e3149 100644
--- a/ash/desktop_background/desktop_background_view.cc
+++ b/ash/desktop_background/desktop_background_view.cc
@@ -188,6 +188,7 @@
     params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
   params.parent = root_window->GetChildById(container_id);
   desktop_widget->Init(params);
+  desktop_widget->GetNativeWindow()->layer()->SetMasksToBounds(true);
   desktop_widget->SetContentsView(
       new LayerControlView(new DesktopBackgroundView()));
   int animation_type = wallpaper_delegate->GetAnimationType();
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc
index 6c23910..748c78f 100644
--- a/ash/dip_unittest.cc
+++ b/ash/dip_unittest.cc
@@ -15,7 +15,6 @@
 #include "ash/wm/window_util.h"
 #include "base/command_line.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/compositor/layer.h"
@@ -26,6 +25,7 @@
 #include "ui/wm/core/shadow.h"
 #include "ui/wm/core/shadow_controller.h"
 #include "ui/wm/core/shadow_types.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 
diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc
index 6fb1a08..abc5175 100644
--- a/ash/display/cursor_window_controller.cc
+++ b/ash/display/cursor_window_controller.cc
@@ -58,8 +58,6 @@
   virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {}
   virtual bool HasHitTestMask() const OVERRIDE { return false; }
   virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
-  virtual void DidRecreateLayer(ui::Layer* old_layer,
-                                ui::Layer* new_layer) OVERRIDE {}
 
   // Sets cursor compositing mode on/off.
   void SetCursorCompositingEnabled(bool enabled) {
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc
index 6aca864..97c9d26 100644
--- a/ash/display/display_change_observer_chromeos.cc
+++ b/ash/display/display_change_observer_chromeos.cc
@@ -158,13 +158,17 @@
     ids.insert(id);
 
     displays.push_back(DisplayInfo(id, name, has_overscan));
-    displays.back().set_device_scale_factor(device_scale_factor);
-    displays.back().SetBounds(display_bounds);
-    displays.back().set_native(true);
-    displays.back().set_display_modes(display_modes);
-    displays.back().set_touch_support(
+    DisplayInfo& new_info = displays.back();
+    new_info.set_device_scale_factor(device_scale_factor);
+    new_info.SetBounds(display_bounds);
+    new_info.set_native(true);
+    new_info.set_display_modes(display_modes);
+    new_info.set_touch_support(
         output.touch_device_id == 0 ? gfx::Display::TOUCH_SUPPORT_UNAVAILABLE :
                                       gfx::Display::TOUCH_SUPPORT_AVAILABLE);
+    new_info.set_available_color_profiles(
+        Shell::GetInstance()->output_configurator()->
+        GetAvailableColorCalibrationProfiles(id));
   }
 
   // DisplayManager can be null during the boot.
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index 03dda59..496eb1e 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -24,7 +24,6 @@
 #include "ash/wm/coordinate_conversion.h"
 #include "base/command_line.h"
 #include "base/strings/stringprintf.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/capture_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/client/screen_position_client.h"
@@ -37,12 +36,13 @@
 #include "ui/compositor/compositor_vsync_manager.h"
 #include "ui/gfx/display.h"
 #include "ui/gfx/screen.h"
+#include "ui/wm/public/activation_client.h"
 
 #if defined(OS_CHROMEOS)
+#include "ash/display/output_configurator_animation.h"
 #include "base/sys_info.h"
 #include "base/time/time.h"
 #if defined(USE_X11)
-#include "ash/display/output_configurator_animation.h"
 #include "ui/base/x/x11_util.h"
 #include "ui/gfx/x/x11_types.h"
 
@@ -227,9 +227,7 @@
     : primary_root_window_for_replace_(NULL),
       focus_activation_store_(new internal::FocusActivationStore()),
       cursor_window_controller_(new internal::CursorWindowController()),
-      mirror_window_controller_(new internal::MirrorWindowController()),
-      virtual_keyboard_window_controller_(
-          new internal::VirtualKeyboardWindowController) {
+      mirror_window_controller_(new internal::MirrorWindowController()) {
 #if defined(OS_CHROMEOS)
   if (base::SysInfo::IsRunningOnChromeOS())
     limiter_.reset(new DisplayChangeLimiter);
@@ -243,6 +241,10 @@
 }
 
 void DisplayController::Start() {
+  // Created here so that Shell has finished being created. Adds itself
+  // as a ShellObserver.
+  virtual_keyboard_window_controller_.reset(
+      new internal::VirtualKeyboardWindowController);
   Shell::GetScreen()->AddObserver(this);
   Shell::GetInstance()->display_manager()->set_delegate(this);
 
@@ -371,7 +373,7 @@
       return;
     limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs);
   }
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   Shell* shell = Shell::GetInstance();
   internal::OutputConfiguratorAnimation* animation =
       shell->output_configurator_animation();
@@ -390,7 +392,7 @@
   }
 
   if (Shell::GetScreen()->GetNumDisplays() > 1) {
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
     internal::OutputConfiguratorAnimation* animation =
         Shell::GetInstance()->output_configurator_animation();
     if (animation) {
@@ -720,7 +722,7 @@
 }
 
 void DisplayController::OnFadeOutForSwapDisplayFinished() {
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay());
   Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation();
 #endif
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 6a49e2a..8c64560 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -20,8 +20,6 @@
 #include "ash/wm/window_state.h"
 #include "ash/wm/wm_event.h"
 #include "base/command_line.h"
-#include "ui/aura/client/activation_change_observer.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/focus_change_observer.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/env.h"
@@ -32,6 +30,8 @@
 #include "ui/gfx/display.h"
 #include "ui/gfx/screen.h"
 #include "ui/views/widget/widget.h"
+#include "ui/wm/public/activation_change_observer.h"
+#include "ui/wm/public/activation_client.h"
 
 #if defined(USE_X11)
 #include <X11/Xlib.h>
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index 17a1bc1..e3a4b63 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -173,7 +173,8 @@
       device_scale_factor_(1.0f),
       overscan_insets_in_dip_(0, 0, 0, 0),
       configured_ui_scale_(1.0f),
-      native_(false) {
+      native_(false),
+      color_profile_(ui::COLOR_PROFILE_STANDARD) {
 }
 
 DisplayInfo::DisplayInfo(int64 id,
@@ -187,7 +188,8 @@
       device_scale_factor_(1.0f),
       overscan_insets_in_dip_(0, 0, 0, 0),
       configured_ui_scale_(1.0f),
-      native_(false) {
+      native_(false),
+      color_profile_(ui::COLOR_PROFILE_STANDARD) {
 }
 
 DisplayInfo::~DisplayInfo() {
@@ -212,13 +214,17 @@
   if (!native_info.overscan_insets_in_dip_.empty())
     overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_;
 
-  // Rotation_ and ui_scale_ are given by preference, or unit
-  // tests. Don't copy if this native_info came from
+  // Rotation_ and ui_scale_ color_profile_ are given by preference,
+  // or unit tests. Don't copy if this native_info came from
   // DisplayChangeObserver.
   if (!native_info.native()) {
     rotation_ = native_info.rotation_;
     configured_ui_scale_ = native_info.configured_ui_scale_;
+    color_profile_ = native_info.color_profile();
   }
+
+  available_color_profiles_ = native_info.available_color_profiles();
+
   // Don't copy insets as it may be given by preference.  |rotation_|
   // is treated as a native so that it can be specified in
   // |CreateFromSpec|.
@@ -298,5 +304,17 @@
   return ToString() + ", display_modes==" + display_modes_str;
 }
 
+void DisplayInfo::SetColorProfile(ui::ColorCalibrationProfile profile) {
+  if (IsColorProfileAvailable(profile))
+    color_profile_ = profile;
+}
+
+bool DisplayInfo::IsColorProfileAvailable(
+    ui::ColorCalibrationProfile profile) const {
+  return std::find(available_color_profiles_.begin(),
+                   available_color_profiles_.end(),
+                   profile) != available_color_profiles_.end();
+}
+
 }  // namespace internal
 }  // namespace ash
diff --git a/ash/display/display_info.h b/ash/display/display_info.h
index ccb989a..14af285 100644
--- a/ash/display/display_info.h
+++ b/ash/display/display_info.h
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "ash/ash_export.h"
+#include "ui/display/display_constants.h"
 #include "ui/gfx/display.h"
 #include "ui/gfx/insets.h"
 #include "ui/gfx/rect.h"
@@ -154,6 +155,27 @@
     display_modes_.swap(display_modes);
   }
 
+  ui::ColorCalibrationProfile color_profile() const {
+    return color_profile_;
+  }
+
+  // Sets the color profile. It will ignore if the specified |profile| is not in
+  // |available_color_profiles_|.
+  void SetColorProfile(ui::ColorCalibrationProfile profile);
+
+  // Returns true if |profile| is in |available_color_profiles_|.
+  bool IsColorProfileAvailable(ui::ColorCalibrationProfile profile) const;
+
+  const std::vector<ui::ColorCalibrationProfile>&
+      available_color_profiles() const {
+    return available_color_profiles_;
+  }
+
+  void set_available_color_profiles(
+      const std::vector<ui::ColorCalibrationProfile>& profiles) {
+    available_color_profiles_ = profiles;
+  }
+
   // Returns a string representation of the DisplayInfo, excluding display
   // modes.
   std::string ToString() const;
@@ -195,6 +217,12 @@
 
   // The list of modes supported by this display.
   std::vector<DisplayMode> display_modes_;
+
+  // The current profile of the color calibration.
+  ui::ColorCalibrationProfile color_profile_;
+
+  // The list of available variations for the color calibration.
+  std::vector<ui::ColorCalibrationProfile> available_color_profiles_;
 };
 
 }  // namespace internal
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index ac3da91..fb4bd6e 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -17,6 +17,7 @@
 #include "base/auto_reset.h"
 #include "base/command_line.h"
 #include "base/logging.h"
+#include "base/metrics/histogram.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
@@ -453,7 +454,7 @@
     return;
   }
   display_modes_[display_id] = *iter;
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   if (base::SysInfo::IsRunningOnChromeOS())
     Shell::GetInstance()->output_configurator()->OnConfigurationChanged();
 #endif
@@ -464,11 +465,13 @@
     gfx::Display::Rotation rotation,
     float ui_scale,
     const gfx::Insets* overscan_insets,
-    const gfx::Size& resolution_in_pixels) {
+    const gfx::Size& resolution_in_pixels,
+    ui::ColorCalibrationProfile color_profile) {
   if (display_info_.find(display_id) == display_info_.end())
     display_info_[display_id] = DisplayInfo(display_id, std::string(), false);
 
   display_info_[display_id].set_rotation(rotation);
+  display_info_[display_id].SetColorProfile(color_profile);
   // Just in case the preference file was corrupted.
   if (0.5f <= ui_scale && ui_scale <= 2.0f)
     display_info_[display_id].set_configured_ui_scale(ui_scale);
@@ -502,6 +505,26 @@
       it->second.overscan_insets_in_dip() : gfx::Insets();
 }
 
+void DisplayManager::SetColorCalibrationProfile(
+    int64 display_id,
+    ui::ColorCalibrationProfile profile) {
+#if defined(OS_CHROMEOS)
+  if (!display_info_[display_id].IsColorProfileAvailable(profile))
+    return;
+
+  if (delegate_)
+    delegate_->PreDisplayConfigurationChange(false);
+  if (Shell::GetInstance()->output_configurator()->SetColorCalibrationProfile(
+          display_id, profile)) {
+    display_info_[display_id].SetColorProfile(profile);
+    UMA_HISTOGRAM_ENUMERATION(
+        "ChromeOS.Display.ColorProfile", profile, ui::NUM_COLOR_PROFILES);
+  }
+  if (delegate_)
+    delegate_->PostDisplayConfigurationChange();
+#endif
+}
+
 void DisplayManager::OnNativeDisplaysChanged(
     const std::vector<DisplayInfo>& updated_displays) {
   if (updated_displays.empty()) {
@@ -972,6 +995,18 @@
     display_info_[new_info.id()].set_native(false);
   }
   display_info_[new_info.id()].UpdateDisplaySize();
+
+  OnDisplayInfoUpdated(display_info_[new_info.id()]);
+}
+
+void DisplayManager::OnDisplayInfoUpdated(const DisplayInfo& display_info) {
+#if defined(OS_CHROMEOS)
+  ui::ColorCalibrationProfile color_profile = display_info.color_profile();
+  if (color_profile != ui::COLOR_PROFILE_STANDARD) {
+    Shell::GetInstance()->output_configurator()->SetColorCalibrationProfile(
+        display_info.id(), color_profile);
+  }
+#endif
 }
 
 gfx::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64 id) {
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index c17f73f..c672524 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -174,7 +174,8 @@
                                gfx::Display::Rotation rotation,
                                float ui_scale,
                                const gfx::Insets* overscan_insets,
-                               const gfx::Size& resolution_in_pixels);
+                               const gfx::Size& resolution_in_pixels,
+                               ui::ColorCalibrationProfile color_profile);
 
   // Returns the display's selected mode.
   bool GetSelectedModeForDisplayId(int64 display_id,
@@ -188,6 +189,10 @@
   // the display.
   gfx::Insets GetOverscanInsets(int64 display_id) const;
 
+  // Sets the color calibration of the display to |profile|.
+  void SetColorCalibrationProfile(int64 display_id,
+                                  ui::ColorCalibrationProfile profile);
+
   // Called when display configuration has changed. The new display
   // configurations is passed as a vector of Display object, which
   // contains each display's new infomration.
@@ -304,6 +309,9 @@
   // a display.
   void InsertAndUpdateDisplayInfo(const DisplayInfo& new_info);
 
+  // Called when the display info is updated through InsertAndUpdateDisplayInfo.
+  void OnDisplayInfoUpdated(const DisplayInfo& display_info);
+
   // Creates a display object from the DisplayInfo for |display_id|.
   gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id);
 
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index c0079c8..6572ac1 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -12,7 +12,6 @@
 #include "ash/wm/system_modal_container_layout_manager.h"
 #include "ash/wm/window_properties.h"
 #include "ash/wm/window_state.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/capture_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/window_event_dispatcher.h"
@@ -21,6 +20,7 @@
 #include "ui/gfx/display.h"
 #include "ui/gfx/screen.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace {
diff --git a/ash/display/virtual_keyboard_window_controller.cc b/ash/display/virtual_keyboard_window_controller.cc
index bef3b45..531aa9b 100644
--- a/ash/display/virtual_keyboard_window_controller.cc
+++ b/ash/display/virtual_keyboard_window_controller.cc
@@ -19,14 +19,17 @@
 #include "ui/aura/root_window_transformer.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/keyboard/keyboard_controller.h"
+#include "ui/keyboard/keyboard_util.h"
 
 namespace ash {
 namespace internal {
 
 VirtualKeyboardWindowController::VirtualKeyboardWindowController() {
+  Shell::GetInstance()->AddShellObserver(this);
 }
 
 VirtualKeyboardWindowController::~VirtualKeyboardWindowController() {
+  Shell::GetInstance()->RemoveShellObserver(this);
   // Make sure the root window gets deleted before cursor_window_delegate.
   Close();
 }
@@ -92,5 +95,16 @@
   host->SetRootWindowTransformer(transformer.Pass());
 }
 
+void VirtualKeyboardWindowController::OnMaximizeModeStarted() {
+  keyboard::SetTouchKeyboardEnabled(true);
+  Shell::GetInstance()->CreateKeyboard();
+}
+
+void VirtualKeyboardWindowController::OnMaximizeModeEnded() {
+  keyboard::SetTouchKeyboardEnabled(false);
+  if (!keyboard::IsKeyboardEnabled())
+    Shell::GetInstance()->DeactivateKeyboard();
+}
+
 }  // namespace internal
 }  // namespace ash
diff --git a/ash/display/virtual_keyboard_window_controller.h b/ash/display/virtual_keyboard_window_controller.h
index 6a46659..1686539 100644
--- a/ash/display/virtual_keyboard_window_controller.h
+++ b/ash/display/virtual_keyboard_window_controller.h
@@ -6,6 +6,7 @@
 #define ASH_DISPLAY_VIRTUAL_KEYBOARD_WINDOW_CONTROLLER_H_
 
 #include "ash/ash_export.h"
+#include "ash/shell_observer.h"
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "ui/gfx/display.h"
@@ -26,7 +27,7 @@
 
 // This class maintains the RootWindowController dedicated for
 // virtual keyboard.
-class ASH_EXPORT VirtualKeyboardWindowController {
+class ASH_EXPORT VirtualKeyboardWindowController : public ShellObserver {
  public:
   VirtualKeyboardWindowController();
   virtual ~VirtualKeyboardWindowController();
@@ -40,6 +41,10 @@
   // Close the mirror window.
   void Close();
 
+  // ShellObserver:
+  virtual void OnMaximizeModeStarted() OVERRIDE;
+  virtual void OnMaximizeModeEnded() OVERRIDE;
+
  private:
   friend class test::VirtualKeyboardWindowControllerTest;
 
diff --git a/ash/display/virtual_keyboard_window_controller_unittest.cc b/ash/display/virtual_keyboard_window_controller_unittest.cc
index 720690e..915be43 100644
--- a/ash/display/virtual_keyboard_window_controller_unittest.cc
+++ b/ash/display/virtual_keyboard_window_controller_unittest.cc
@@ -12,6 +12,7 @@
 #include "ash/test/ash_test_base.h"
 #include "base/command_line.h"
 #include "ui/keyboard/keyboard_switches.h"
+#include "ui/keyboard/keyboard_util.h"
 
 namespace ash {
 namespace test {
@@ -22,16 +23,6 @@
       : virtual_keyboard_window_controller_(NULL) {}
   virtual ~VirtualKeyboardWindowControllerTest() {}
 
-  virtual void SetUp() OVERRIDE {
-    if (SupportsMultipleDisplays()) {
-      CommandLine::ForCurrentProcess()->AppendSwitchASCII(
-          switches::kAshHostWindowBounds, "1+1-300x300,1+301-300x300");
-      CommandLine::ForCurrentProcess()->AppendSwitch(
-          keyboard::switches::kKeyboardUsabilityExperiment);
-    }
-    test::AshTestBase::SetUp();
-  }
-
   void set_virtual_keyboard_window_controller(
       internal::VirtualKeyboardWindowController* controller) {
     virtual_keyboard_window_controller_ = controller;
@@ -48,8 +39,28 @@
   DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardWindowControllerTest);
 };
 
+class VirtualKeyboardUsabilityExperimentTest
+    : public VirtualKeyboardWindowControllerTest {
+ public:
+  VirtualKeyboardUsabilityExperimentTest()
+    : VirtualKeyboardWindowControllerTest() {}
+  virtual ~VirtualKeyboardUsabilityExperimentTest() {}
 
-TEST_F(VirtualKeyboardWindowControllerTest, VirtualKeyboardWindowTest) {
+  virtual void SetUp() OVERRIDE {
+    if (SupportsMultipleDisplays()) {
+      CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+          switches::kAshHostWindowBounds, "1+1-300x300,1+301-300x300");
+      CommandLine::ForCurrentProcess()->AppendSwitch(
+          keyboard::switches::kKeyboardUsabilityExperiment);
+    }
+    test::AshTestBase::SetUp();
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardUsabilityExperimentTest);
+};
+
+TEST_F(VirtualKeyboardUsabilityExperimentTest, VirtualKeyboardWindowTest) {
   if (!SupportsMultipleDisplays())
     return;
   RunAllPendingInMessageLoop();
@@ -62,5 +73,19 @@
       internal::kShellWindowId_VirtualKeyboardContainer));
 }
 
+// Tests that the onscreen keyboard becomes enabled when maximize mode is
+// enabled.
+TEST_F(VirtualKeyboardWindowControllerTest, EnabledDuringMaximizeMode) {
+  set_virtual_keyboard_window_controller(
+      Shell::GetInstance()->display_controller()->
+          virtual_keyboard_window_controller());
+
+  ASSERT_FALSE(keyboard::IsKeyboardEnabled());
+  Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
+  EXPECT_TRUE(keyboard::IsKeyboardEnabled());
+  Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
+  EXPECT_FALSE(keyboard::IsKeyboardEnabled());
+}
+
 }  // namespace test
 }  // namespace ash
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 472172b..cc8d96b 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -12,7 +12,6 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "ui/aura/client/capture_client.h"
-#include "ui/aura/client/drag_drop_delegate.h"
 #include "ui/aura/env.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_delegate.h"
@@ -29,6 +28,7 @@
 #include "ui/gfx/rect_conversions.h"
 #include "ui/views/views_delegate.h"
 #include "ui/views/widget/native_widget_aura.h"
+#include "ui/wm/public/drag_drop_delegate.h"
 
 namespace ash {
 namespace internal {
@@ -123,8 +123,6 @@
   virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {
     DCHECK(mask->isEmpty());
   }
-  virtual void DidRecreateLayer(ui::Layer* old_layer,
-                                ui::Layer* new_layer) OVERRIDE {}
 
  private:
   DragDropController* drag_drop_controller_;
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index a9220db..5d05ec9 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -8,13 +8,13 @@
 #include "ash/ash_export.h"
 #include "base/callback.h"
 #include "base/memory/weak_ptr.h"
-#include "ui/aura/client/drag_drop_client.h"
 #include "ui/aura/window_observer.h"
 #include "ui/base/dragdrop/os_exchange_data.h"
 #include "ui/events/event_constants.h"
 #include "ui/events/event_handler.h"
 #include "ui/gfx/animation/animation_delegate.h"
 #include "ui/gfx/rect.h"
+#include "ui/wm/public/drag_drop_client.h"
 
 namespace gfx {
 class LinearAnimation;
diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc
index 48badf3..55cb7b9 100644
--- a/ash/drag_drop/drag_drop_tracker.cc
+++ b/ash/drag_drop/drag_drop_tracker.cc
@@ -7,12 +7,12 @@
 #include "ash/shell.h"
 #include "ash/shell_window_ids.h"
 #include "ash/wm/coordinate_conversion.h"
-#include "ui/aura/client/activation_delegate.h"
 #include "ui/aura/client/window_tree_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/events/event.h"
 #include "ui/gfx/screen.h"
+#include "ui/wm/public/activation_delegate.h"
 
 namespace ash {
 namespace internal {
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc
index 0554398..0bc1ed4 100644
--- a/ash/extended_desktop_unittest.cc
+++ b/ash/extended_desktop_unittest.cc
@@ -15,7 +15,6 @@
 #include "ash/wm/window_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/capture_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/test/event_generator.h"
@@ -30,6 +29,7 @@
 #include "ui/views/controls/textfield/textfield.h"
 #include "ui/views/widget/widget.h"
 #include "ui/views/widget/widget_delegate.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace {
diff --git a/ash/focus_cycler.cc b/ash/focus_cycler.cc
index efd958c..0fa83aa 100644
--- a/ash/focus_cycler.cc
+++ b/ash/focus_cycler.cc
@@ -8,11 +8,11 @@
 #include "ash/wm/mru_window_tracker.h"
 #include "ash/wm/window_state.h"
 #include "ash/wm/window_util.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/window.h"
 #include "ui/views/accessible_pane_view.h"
 #include "ui/views/focus/focus_search.h"
 #include "ui/views/widget/widget.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 
diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc
index 96bcafb..196f901 100644
--- a/ash/frame/custom_frame_view_ash.cc
+++ b/ash/frame/custom_frame_view_ash.cc
@@ -10,7 +10,10 @@
 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h"
 #include "ash/frame/default_header_painter.h"
 #include "ash/frame/frame_border_hit_test_controller.h"
+#include "ash/frame/frame_util.h"
 #include "ash/frame/header_painter.h"
+#include "ash/session_state_delegate.h"
+#include "ash/shell.h"
 #include "ash/wm/immersive_fullscreen_controller.h"
 #include "ash/wm/window_state.h"
 #include "ash/wm/window_state_delegate.h"
@@ -20,9 +23,11 @@
 #include "ui/aura/window.h"
 #include "ui/aura/window_observer.h"
 #include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image.h"
 #include "ui/gfx/rect.h"
 #include "ui/gfx/rect_conversions.h"
 #include "ui/gfx/size.h"
+#include "ui/views/controls/image_view.h"
 #include "ui/views/view.h"
 #include "ui/views/widget/widget.h"
 #include "ui/views/widget/widget_delegate.h"
@@ -45,6 +50,9 @@
       ash::wm::WindowState* window_state,
       ash::CustomFrameViewAsh* custom_frame_view)
       : window_state_(NULL) {
+#if defined(OS_CHROMEOS)
+    // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
+    // Windows Ash.
     immersive_fullscreen_controller_.reset(
         new ash::ImmersiveFullscreenController);
     custom_frame_view->InitImmersiveFullscreenControllerForView(
@@ -58,6 +66,7 @@
     window_state_ = window_state;
     window_state_->AddObserver(this);
     window_state_->window()->AddObserver(this);
+#endif
   }
   virtual ~CustomFrameViewAshWindowStateDelegate() {
     if (window_state_) {
@@ -142,6 +151,8 @@
   // Returns the view's minimum width.
   int GetMinimumWidth() const;
 
+  void UpdateAvatarIcon();
+
   // views::View overrides:
   virtual void Layout() OVERRIDE;
   virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
@@ -150,6 +161,10 @@
     return caption_button_container_;
   }
 
+  views::View* avatar_icon() const {
+    return avatar_icon_;
+  }
+
  private:
   // ImmersiveFullscreenController::Delegate overrides:
   virtual void OnImmersiveRevealStarted() OVERRIDE;
@@ -167,6 +182,8 @@
   // Helper for painting the header.
   scoped_ptr<DefaultHeaderPainter> header_painter_;
 
+  views::ImageView* avatar_icon_;
+
   // View which contains the window caption buttons.
   FrameCaptionButtonContainerView* caption_button_container_;
 
@@ -187,6 +204,7 @@
 CustomFrameViewAsh::HeaderView::HeaderView(views::Widget* frame)
     : frame_(frame),
       header_painter_(new ash::DefaultHeaderPainter),
+      avatar_icon_(NULL),
       caption_button_container_(NULL),
       maximize_bubble_(NULL),
       fullscreen_visible_fraction_(0) {
@@ -205,6 +223,7 @@
     frame_maximize_button->AddObserver(this);
 
   header_painter_->Init(frame_, this, NULL, caption_button_container_);
+  UpdateAvatarIcon();
 }
 
 CustomFrameViewAsh::HeaderView::~HeaderView() {
@@ -238,6 +257,33 @@
   return header_painter_->GetMinimumHeaderWidth();
 }
 
+void CustomFrameViewAsh::HeaderView::UpdateAvatarIcon() {
+  SessionStateDelegate* delegate =
+      Shell::GetInstance()->session_state_delegate();
+  aura::Window* window = frame_->GetNativeView();
+  bool show = delegate->ShouldShowAvatar(window);
+  int icon_size = 0;
+  if (!show) {
+    if (!avatar_icon_)
+      return;
+    delete avatar_icon_;
+    avatar_icon_ = NULL;
+  } else {
+    gfx::ImageSkia image = GetAvatarImageForContext(
+        delegate->GetBrowserContextForWindow(window)).AsImageSkia();
+    DCHECK(!image.isNull());
+    DCHECK_EQ(image.width(), image.height());
+    if (!avatar_icon_) {
+      avatar_icon_ = new views::ImageView();
+      AddChildView(avatar_icon_);
+    }
+    avatar_icon_->SetImage(image);
+    icon_size = image.width();
+  }
+  header_painter_->UpdateWindowIcon(avatar_icon_, icon_size);
+  Layout();
+}
+
 void CustomFrameViewAsh::HeaderView::Layout() {
   header_painter_->LayoutHeader();
 }
@@ -475,10 +521,20 @@
   return false;
 }
 
+void CustomFrameViewAsh::VisibilityChanged(views::View* starting_from,
+                                           bool is_visible) {
+  if (is_visible)
+    header_view_->UpdateAvatarIcon();
+}
+
 views::View* CustomFrameViewAsh::GetHeaderView() {
   return header_view_;
 }
 
+const views::View* CustomFrameViewAsh::GetAvatarIconViewForTest() const {
+  return header_view_->avatar_icon();
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // CustomFrameViewAsh, private:
 
diff --git a/ash/frame/custom_frame_view_ash.h b/ash/frame/custom_frame_view_ash.h
index 6fd9bdf..bfa6729 100644
--- a/ash/frame/custom_frame_view_ash.h
+++ b/ash/frame/custom_frame_view_ash.h
@@ -58,10 +58,14 @@
   virtual gfx::Size GetMaximumSize() OVERRIDE;
   virtual void SchedulePaintInRect(const gfx::Rect& r) OVERRIDE;
   virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
+  virtual void VisibilityChanged(views::View* starting_from,
+                                 bool is_visible) OVERRIDE;
 
   // Get the view of the header.
   views::View* GetHeaderView();
 
+  const views::View* GetAvatarIconViewForTest() const;
+
  private:
   class OverlayView;
   friend class TestWidgetConstraintsDelegate;
diff --git a/ash/frame/custom_frame_view_ash_unittest.cc b/ash/frame/custom_frame_view_ash_unittest.cc
index eb0a543..68a85a8 100644
--- a/ash/frame/custom_frame_view_ash_unittest.cc
+++ b/ash/frame/custom_frame_view_ash_unittest.cc
@@ -4,7 +4,9 @@
 
 #include "ash/frame/custom_frame_view_ash.h"
 
+#include "ash/shell.h"
 #include "ash/test/ash_test_base.h"
+#include "ash/test/test_session_state_delegate.h"
 #include "base/memory/scoped_ptr.h"
 #include "grit/ash_resources.h"
 #include "ui/base/resource/resource_bundle.h"
@@ -97,6 +99,11 @@
     return widget.Pass();
   }
 
+  test::TestSessionStateDelegate* GetTestSessionStateDelegate() {
+    return static_cast<ash::test::TestSessionStateDelegate*>(
+        Shell::GetInstance()->session_state_delegate());
+  }
+
  private:
   DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshTest);
 };
@@ -158,4 +165,30 @@
             max_frame_size.height());
 }
 
+// Verify that CustomFrameViewAsh updates the avatar icon based on the
+// state of the SessionStateDelegate after visibility change.
+TEST_F(CustomFrameViewAshTest, AvatarIcon) {
+  TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate;
+  scoped_ptr<views::Widget> widget(CreateWidget(delegate));
+
+  CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view();
+  EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest());
+
+  // Avatar image becomes available.
+  const gfx::ImageSkia user_image =
+      *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+          IDR_AURA_UBER_TRAY_GUEST_ICON);
+  GetTestSessionStateDelegate()->SetUserImage(user_image);
+  widget->Hide();
+  widget->Show();
+  EXPECT_TRUE(custom_frame_view->GetAvatarIconViewForTest());
+
+  // Avatar image is gone; the ImageView for the avatar icon should be
+  // removed.
+  GetTestSessionStateDelegate()->SetUserImage(gfx::ImageSkia());
+  widget->Hide();
+  widget->Show();
+  EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest());
+}
+
 }  // namespace ash
diff --git a/ash/frame/default_header_painter.cc b/ash/frame/default_header_painter.cc
index 80e2f53..fd31d77 100644
--- a/ash/frame/default_header_painter.cc
+++ b/ash/frame/default_header_painter.cc
@@ -31,10 +31,10 @@
 // Color for the window title text.
 const SkColor kTitleTextColor = SkColorSetRGB(40, 40, 40);
 // Color of the active window header/content separator line.
-const SkColor kHeaderContentSeparatorColor = SkColorSetRGB(180, 180, 182);
+const SkColor kHeaderContentSeparatorColor = SkColorSetRGB(150, 150, 152);
 // Color of the inactive window header/content separator line.
 const SkColor kHeaderContentSeparatorInactiveColor =
-    SkColorSetRGB(150, 150, 152);
+    SkColorSetRGB(180, 180, 182);
 // Duration of crossfade animation for activating and deactivating frame.
 const int kActivationCrossfadeDurationMs = 200;
 
@@ -75,6 +75,7 @@
     : frame_(NULL),
       view_(NULL),
       window_icon_(NULL),
+      window_icon_size_(HeaderPainterUtil::GetDefaultIconSize()),
       caption_button_container_(NULL),
       height_(0),
       mode_(MODE_INACTIVE),
@@ -168,23 +169,20 @@
   int active_alpha = activation_animation_->CurrentValueBetween(0, 255);
   int inactive_alpha = 255 - active_alpha;
 
-  ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
   SkPaint paint;
   if (inactive_alpha > 0) {
     if (active_alpha > 0)
       paint.setXfermodeMode(SkXfermode::kPlus_Mode);
 
     paint.setAlpha(inactive_alpha);
-    gfx::ImageSkia inactive_frame =
-        *rb.GetImageSkiaNamed(IDR_AURA_WINDOW_HEADER_BASE_INACTIVE);
+    gfx::ImageSkia inactive_frame = *GetInactiveFrameImage();
     TileRoundRect(canvas, inactive_frame, paint, GetLocalBounds(),
         corner_radius);
   }
 
   if (active_alpha > 0) {
     paint.setAlpha(active_alpha);
-    gfx::ImageSkia active_frame =
-        *rb.GetImageSkiaNamed(IDR_AURA_WINDOW_HEADER_BASE_ACTIVE);
+    gfx::ImageSkia active_frame = *GetActiveFrameImage();
     TileRoundRect(canvas, active_frame, paint, GetLocalBounds(),
         corner_radius);
   }
@@ -215,11 +213,11 @@
   if (window_icon_) {
     // Vertically center the window icon with respect to the caption button
     // container.
-    int icon_size = HeaderPainterUtil::GetIconSize();
     // Floor when computing the center of |caption_button_container_|.
-    int icon_offset_y = caption_button_container_->height() / 2 - icon_size / 2;
+    int icon_offset_y =
+        caption_button_container_->height() / 2 - window_icon_size_ / 2;
     window_icon_->SetBounds(HeaderPainterUtil::GetIconXOffset(), icon_offset_y,
-        icon_size, icon_size);
+                            window_icon_size_, window_icon_size_);
   }
 
   // The header/content separator line overlays the caption buttons.
@@ -238,6 +236,12 @@
   view_->SchedulePaintInRect(GetTitleBounds());
 }
 
+void DefaultHeaderPainter::UpdateWindowIcon(views::View* window_icon,
+                                            int window_icon_size) {
+  window_icon_ = window_icon;
+  window_icon_size_ = window_icon_size;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // gfx::AnimationDelegate overrides:
 
@@ -318,4 +322,17 @@
       window_icon_, caption_button_container_, GetTitleFontList());
 }
 
+gfx::ImageSkia* DefaultHeaderPainter::GetActiveFrameImage() const {
+  return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+      IDR_AURA_WINDOW_HEADER_BASE);
+}
+
+gfx::ImageSkia* DefaultHeaderPainter::GetInactiveFrameImage() const {
+  int frame_image_id = (frame_->IsMaximized() || frame_->IsFullscreen()) ?
+      IDR_AURA_WINDOW_HEADER_BASE :
+      IDR_AURA_WINDOW_HEADER_BASE_RESTORED_INACTIVE;
+  return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+      frame_image_id);
+}
+
 }  // namespace ash
diff --git a/ash/frame/default_header_painter.h b/ash/frame/default_header_painter.h
index 80990c1..e06c312 100644
--- a/ash/frame/default_header_painter.h
+++ b/ash/frame/default_header_painter.h
@@ -14,6 +14,7 @@
 #include "ui/gfx/animation/animation_delegate.h"
 
 namespace gfx {
+class ImageSkia;
 class Rect;
 class SlideAnimation;
 }
@@ -46,6 +47,9 @@
   virtual void SetHeaderHeightForPainting(int height) OVERRIDE;
   virtual void SchedulePaintForTitle() OVERRIDE;
 
+  // Sets the window icon for the header. Passing NULL removes the window icon.
+  void UpdateWindowIcon(views::View* window_icon, int icon_size);
+
  private:
   FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
 
@@ -70,9 +74,16 @@
   // Returns the bounds for the title.
   gfx::Rect GetTitleBounds() const;
 
+  // Returns the frame image to use when |frame_| is active.
+  gfx::ImageSkia* GetActiveFrameImage() const;
+
+  // Returns the frame image to use when |frame_| is inactive.
+  gfx::ImageSkia* GetInactiveFrameImage() const;
+
   views::Widget* frame_;
   views::View* view_;
   views::View* window_icon_;  // May be NULL.
+  int window_icon_size_;
   FrameCaptionButtonContainerView* caption_button_container_;
 
   // The height of the header including the header/content separator.
diff --git a/ash/frame/header_painter_util.cc b/ash/frame/header_painter_util.cc
index ca83824..1054291 100644
--- a/ash/frame/header_painter_util.cc
+++ b/ash/frame/header_painter_util.cc
@@ -22,8 +22,8 @@
 // Distance between left edge of the window and the header icon.
 const int kIconXOffset = 9;
 
-// Height and width of header icon.
-const int kIconSize = 16;
+// Default height and width of header icon.
+const int kDefaultIconSize = 16;
 
 // Space between the title text and the caption buttons.
 const int kTitleCaptionButtonSpacing = 5;
@@ -57,8 +57,8 @@
 }
 
 // static
-int HeaderPainterUtil::GetIconSize() {
-  return kIconSize;
+int HeaderPainterUtil::GetDefaultIconSize() {
+  return kDefaultIconSize;
 }
 
 // static
diff --git a/ash/frame/header_painter_util.h b/ash/frame/header_painter_util.h
index 468184a..5e4bde4 100644
--- a/ash/frame/header_painter_util.h
+++ b/ash/frame/header_painter_util.h
@@ -31,7 +31,7 @@
   static int GetIconXOffset();
 
   // Returns the size of the header icon.
-  static int GetIconSize();
+  static int GetDefaultIconSize();
 
   // Returns the amount that the frame background is inset from the left edge of
   // the window.
diff --git a/ash/ime/OWNERS b/ash/ime/OWNERS
index 7224e3b..cb42d0b 100644
--- a/ash/ime/OWNERS
+++ b/ash/ime/OWNERS
@@ -1,3 +1,7 @@
-komatsu@chromium.org
+# primary reviewer
 mukai@chromium.org
+
+# backup reviewers
+komatsu@chromium.org
 nona@chromium.org
+yukishiino@chromium.org
diff --git a/ash/resources/ash_resources.grd b/ash/resources/ash_resources.grd
index 1a051da..75c3a69 100644
--- a/ash/resources/ash_resources.grd
+++ b/ash/resources/ash_resources.grd
@@ -253,8 +253,8 @@
       <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_CONTROL_ICON_SIZE" file="common/window_control_icon_size.png" />
       <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_CONTROL_ICON_SIZE_I" file="common/window_control_icon_size_inactive.png" />
 
-      <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_BASE_ACTIVE" file="common/window_header_base_active.png" />
-      <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_BASE_INACTIVE" file="common/window_header_base_inactive.png" />
+      <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_BASE" file="common/window_header_base_active.png" />
+      <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_BASE_RESTORED_INACTIVE" file="common/window_header_base_inactive.png" />
       <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_BOTTOM" file="common/window_header_shade_bottom_inactive.png" />
       <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_LEFT" file="common/window_header_shade_left_inactive.png" />
       <structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_RIGHT" file="common/window_header_shade_right_inactive.png" />
diff --git a/ash/resources/default_100_percent/common/browser_window_control_icon_restored_close.png b/ash/resources/default_100_percent/common/browser_window_control_icon_restored_close.png
index 506c3fe..edd1e96 100644
--- a/ash/resources/default_100_percent/common/browser_window_control_icon_restored_close.png
+++ b/ash/resources/default_100_percent/common/browser_window_control_icon_restored_close.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/browser_window_control_icon_restored_size.png b/ash/resources/default_100_percent/common/browser_window_control_icon_restored_size.png
index 619995f..e63715e 100644
--- a/ash/resources/default_100_percent/common/browser_window_control_icon_restored_size.png
+++ b/ash/resources/default_100_percent/common/browser_window_control_icon_restored_size.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_bottom.png b/ash/resources/default_100_percent/common/phantom_window_bottom.png
index d6e9295..6873a1e 100644
--- a/ash/resources/default_100_percent/common/phantom_window_bottom.png
+++ b/ash/resources/default_100_percent/common/phantom_window_bottom.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_bottom_left.png b/ash/resources/default_100_percent/common/phantom_window_bottom_left.png
index d74a7ef..0158807 100644
--- a/ash/resources/default_100_percent/common/phantom_window_bottom_left.png
+++ b/ash/resources/default_100_percent/common/phantom_window_bottom_left.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_bottom_right.png b/ash/resources/default_100_percent/common/phantom_window_bottom_right.png
index 52623b5..a423777 100644
--- a/ash/resources/default_100_percent/common/phantom_window_bottom_right.png
+++ b/ash/resources/default_100_percent/common/phantom_window_bottom_right.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_left.png b/ash/resources/default_100_percent/common/phantom_window_left.png
index f49c69f..17efe04 100644
--- a/ash/resources/default_100_percent/common/phantom_window_left.png
+++ b/ash/resources/default_100_percent/common/phantom_window_left.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_right.png b/ash/resources/default_100_percent/common/phantom_window_right.png
index 35c83a2..b4f1d9c 100644
--- a/ash/resources/default_100_percent/common/phantom_window_right.png
+++ b/ash/resources/default_100_percent/common/phantom_window_right.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_top.png b/ash/resources/default_100_percent/common/phantom_window_top.png
index c13c63f..0189e53 100644
--- a/ash/resources/default_100_percent/common/phantom_window_top.png
+++ b/ash/resources/default_100_percent/common/phantom_window_top.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_top_left.png b/ash/resources/default_100_percent/common/phantom_window_top_left.png
index 608bc0d..fdd2740 100644
--- a/ash/resources/default_100_percent/common/phantom_window_top_left.png
+++ b/ash/resources/default_100_percent/common/phantom_window_top_left.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/phantom_window_top_right.png b/ash/resources/default_100_percent/common/phantom_window_top_right.png
index 8550c44..d49a6aa 100644
--- a/ash/resources/default_100_percent/common/phantom_window_top_right.png
+++ b/ash/resources/default_100_percent/common/phantom_window_top_right.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_overview_close_hover.png b/ash/resources/default_100_percent/common/window_overview_close_hover.png
index 243cf1b..2a57bf0 100644
--- a/ash/resources/default_100_percent/common/window_overview_close_hover.png
+++ b/ash/resources/default_100_percent/common/window_overview_close_hover.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_overview_close_normal.png b/ash/resources/default_100_percent/common/window_overview_close_normal.png
index 954ceb3..2a80812 100644
--- a/ash/resources/default_100_percent/common/window_overview_close_normal.png
+++ b/ash/resources/default_100_percent/common/window_overview_close_normal.png
Binary files differ
diff --git a/ash/resources/default_100_percent/common/window_overview_close_pressed.png b/ash/resources/default_100_percent/common/window_overview_close_pressed.png
index 6fb5bdf..80fdce7 100644
--- a/ash/resources/default_100_percent/common/window_overview_close_pressed.png
+++ b/ash/resources/default_100_percent/common/window_overview_close_pressed.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/avatar_holder.png b/ash/resources/default_100_percent/cros/avatar_holder.png
index fe79fd7..276d3c2 100644
--- a/ash/resources/default_100_percent/cros/avatar_holder.png
+++ b/ash/resources/default_100_percent/cros/avatar_holder.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/avatar_holder_mask.png b/ash/resources/default_100_percent/cros/avatar_holder_mask.png
index 387ffaf..e66457b 100644
--- a/ash/resources/default_100_percent/cros/avatar_holder_mask.png
+++ b/ash/resources/default_100_percent/cros/avatar_holder_mask.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png
index bcd8193..b201c39 100644
--- a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png
+++ b/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png
index 24d0b07..0079811 100644
--- a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png
+++ b/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/notification/display_notification_icon.png b/ash/resources/default_100_percent/cros/notification/display_notification_icon.png
index 7ded7aa..e49d82a 100644
--- a/ash/resources/default_100_percent/cros/notification/display_notification_icon.png
+++ b/ash/resources/default_100_percent/cros/notification/display_notification_icon.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_auto_rotate.png b/ash/resources/default_100_percent/cros/status/status_auto_rotate.png
new file mode 100644
index 0000000..646efca
--- /dev/null
+++ b/ash/resources/default_100_percent/cros/status/status_auto_rotate.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_auto_rotate_dark.png b/ash/resources/default_100_percent/cros/status/status_auto_rotate_dark.png
new file mode 100644
index 0000000..4e9569c
--- /dev/null
+++ b/ash/resources/default_100_percent/cros/status/status_auto_rotate_dark.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_auto_rotate_locked.png b/ash/resources/default_100_percent/cros/status/status_auto_rotate_locked.png
new file mode 100644
index 0000000..640c3f3
--- /dev/null
+++ b/ash/resources/default_100_percent/cros/status/status_auto_rotate_locked.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_auto_rotate_locked_dark.png b/ash/resources/default_100_percent/cros/status/status_auto_rotate_locked_dark.png
new file mode 100644
index 0000000..7a4a150
--- /dev/null
+++ b/ash/resources/default_100_percent/cros/status/status_auto_rotate_locked_dark.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_overview_mode.png b/ash/resources/default_100_percent/cros/status/status_overview_mode.png
index 67a8aef..d145a94 100644
--- a/ash/resources/default_100_percent/cros/status/status_overview_mode.png
+++ b/ash/resources/default_100_percent/cros/status/status_overview_mode.png
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_virtual_keyboard.png b/ash/resources/default_100_percent/cros/status/status_virtual_keyboard.png
index c36c944..52813bf 100644
--- a/ash/resources/default_100_percent/cros/status/status_virtual_keyboard.png
+++ b/ash/resources/default_100_percent/cros/status/status_virtual_keyboard.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_bottom.png b/ash/resources/default_200_percent/common/phantom_window_bottom.png
index cc4e32e..ecc8ac3 100644
--- a/ash/resources/default_200_percent/common/phantom_window_bottom.png
+++ b/ash/resources/default_200_percent/common/phantom_window_bottom.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_bottom_left.png b/ash/resources/default_200_percent/common/phantom_window_bottom_left.png
index 7999cc5..15d21ea 100644
--- a/ash/resources/default_200_percent/common/phantom_window_bottom_left.png
+++ b/ash/resources/default_200_percent/common/phantom_window_bottom_left.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_bottom_right.png b/ash/resources/default_200_percent/common/phantom_window_bottom_right.png
index 0b6bf34..7e1e9b6 100644
--- a/ash/resources/default_200_percent/common/phantom_window_bottom_right.png
+++ b/ash/resources/default_200_percent/common/phantom_window_bottom_right.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_center.png b/ash/resources/default_200_percent/common/phantom_window_center.png
index 7619d39..05b4d6e 100644
--- a/ash/resources/default_200_percent/common/phantom_window_center.png
+++ b/ash/resources/default_200_percent/common/phantom_window_center.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_left.png b/ash/resources/default_200_percent/common/phantom_window_left.png
index dd0e81a..a9709f8 100644
--- a/ash/resources/default_200_percent/common/phantom_window_left.png
+++ b/ash/resources/default_200_percent/common/phantom_window_left.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_right.png b/ash/resources/default_200_percent/common/phantom_window_right.png
index 0c27eed..468f108 100644
--- a/ash/resources/default_200_percent/common/phantom_window_right.png
+++ b/ash/resources/default_200_percent/common/phantom_window_right.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_top.png b/ash/resources/default_200_percent/common/phantom_window_top.png
index 5ca087b..930a8d6 100644
--- a/ash/resources/default_200_percent/common/phantom_window_top.png
+++ b/ash/resources/default_200_percent/common/phantom_window_top.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_top_left.png b/ash/resources/default_200_percent/common/phantom_window_top_left.png
index 699e049..8ec1e8a 100644
--- a/ash/resources/default_200_percent/common/phantom_window_top_left.png
+++ b/ash/resources/default_200_percent/common/phantom_window_top_left.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/phantom_window_top_right.png b/ash/resources/default_200_percent/common/phantom_window_top_right.png
index 1f14869..f11c024 100644
--- a/ash/resources/default_200_percent/common/phantom_window_top_right.png
+++ b/ash/resources/default_200_percent/common/phantom_window_top_right.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_overview_close_hover.png b/ash/resources/default_200_percent/common/window_overview_close_hover.png
index e135dc1..7835d49 100644
--- a/ash/resources/default_200_percent/common/window_overview_close_hover.png
+++ b/ash/resources/default_200_percent/common/window_overview_close_hover.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_overview_close_normal.png b/ash/resources/default_200_percent/common/window_overview_close_normal.png
index 3b3ed84..54c9910 100644
--- a/ash/resources/default_200_percent/common/window_overview_close_normal.png
+++ b/ash/resources/default_200_percent/common/window_overview_close_normal.png
Binary files differ
diff --git a/ash/resources/default_200_percent/common/window_overview_close_pressed.png b/ash/resources/default_200_percent/common/window_overview_close_pressed.png
index fb77bfa..ea10e07 100644
--- a/ash/resources/default_200_percent/common/window_overview_close_pressed.png
+++ b/ash/resources/default_200_percent/common/window_overview_close_pressed.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/avatar_holder.png b/ash/resources/default_200_percent/cros/avatar_holder.png
index ce1aeb8..fefe883 100644
--- a/ash/resources/default_200_percent/cros/avatar_holder.png
+++ b/ash/resources/default_200_percent/cros/avatar_holder.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/avatar_holder_mask.png b/ash/resources/default_200_percent/cros/avatar_holder_mask.png
index 267b336..3b8c042 100644
--- a/ash/resources/default_200_percent/cros/avatar_holder_mask.png
+++ b/ash/resources/default_200_percent/cros/avatar_holder_mask.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png
index c43eb29..b10d869 100644
--- a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png
+++ b/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png
index e531c2f..49930ee 100644
--- a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png
+++ b/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/notification/display_notification_icon.png b/ash/resources/default_200_percent/cros/notification/display_notification_icon.png
index ca326e2..832e974 100644
--- a/ash/resources/default_200_percent/cros/notification/display_notification_icon.png
+++ b/ash/resources/default_200_percent/cros/notification/display_notification_icon.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_accessibility_mode.png b/ash/resources/default_200_percent/cros/status/status_accessibility_mode.png
index cf900eb..3ea908b 100644
--- a/ash/resources/default_200_percent/cros/status/status_accessibility_mode.png
+++ b/ash/resources/default_200_percent/cros/status/status_accessibility_mode.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_auto_rotate.png b/ash/resources/default_200_percent/cros/status/status_auto_rotate.png
new file mode 100644
index 0000000..9bc087f
--- /dev/null
+++ b/ash/resources/default_200_percent/cros/status/status_auto_rotate.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_auto_rotate_dark.png b/ash/resources/default_200_percent/cros/status/status_auto_rotate_dark.png
new file mode 100644
index 0000000..1f9b5ce
--- /dev/null
+++ b/ash/resources/default_200_percent/cros/status/status_auto_rotate_dark.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_auto_rotate_locked.png b/ash/resources/default_200_percent/cros/status/status_auto_rotate_locked.png
new file mode 100644
index 0000000..c0f228b
--- /dev/null
+++ b/ash/resources/default_200_percent/cros/status/status_auto_rotate_locked.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_auto_rotate_locked_dark.png b/ash/resources/default_200_percent/cros/status/status_auto_rotate_locked_dark.png
new file mode 100644
index 0000000..68477fc
--- /dev/null
+++ b/ash/resources/default_200_percent/cros/status/status_auto_rotate_locked_dark.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_overview_mode.png b/ash/resources/default_200_percent/cros/status/status_overview_mode.png
index 1986cd9..f684c7e 100644
--- a/ash/resources/default_200_percent/cros/status/status_overview_mode.png
+++ b/ash/resources/default_200_percent/cros/status/status_overview_mode.png
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_virtual_keyboard.png b/ash/resources/default_200_percent/cros/status/status_virtual_keyboard.png
index f9decd0..a882f85 100644
--- a/ash/resources/default_200_percent/cros/status/status_virtual_keyboard.png
+++ b/ash/resources/default_200_percent/cros/status/status_virtual_keyboard.png
Binary files differ
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index ba8eb3f..429c9c5 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -48,9 +48,7 @@
 #include "base/command_line.h"
 #include "base/time/time.h"
 #include "ui/aura/client/aura_constants.h"
-#include "ui/aura/client/drag_drop_client.h"
 #include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/client/tooltip_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_delegate.h"
 #include "ui/aura/window_event_dispatcher.h"
@@ -69,6 +67,8 @@
 #include "ui/wm/core/easy_resize_window_targeter.h"
 #include "ui/wm/core/visibility_controller.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/drag_drop_client.h"
+#include "ui/wm/public/tooltip_client.h"
 #include "ui/wm/public/window_types.h"
 
 #if defined(OS_CHROMEOS)
@@ -253,8 +253,6 @@
     return false;
   }
   virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
-  virtual void DidRecreateLayer(ui::Layer* old_layer,
-                                ui::Layer* new_layer) OVERRIDE {}
 
  private:
   DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate);
diff --git a/ash/session_state_delegate.h b/ash/session_state_delegate.h
index 4df1617..f0e7f22 100644
--- a/ash/session_state_delegate.h
+++ b/ash/session_state_delegate.h
@@ -51,6 +51,10 @@
   virtual content::BrowserContext* GetBrowserContextByIndex(
       MultiProfileIndex index) = 0;
 
+  // Returns the browser context associated with the window.
+  virtual content::BrowserContext* GetBrowserContextForWindow(
+      aura::Window* window) = 0;
+
   // Returns the maximum possible number of logged in users.
   virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
 
diff --git a/ash/session_state_delegate_stub.cc b/ash/session_state_delegate_stub.cc
index 7fc01da..dcbd346 100644
--- a/ash/session_state_delegate_stub.cc
+++ b/ash/session_state_delegate_stub.cc
@@ -6,6 +6,7 @@
 
 #include "ash/shell.h"
 #include "ash/shell/example_factory.h"
+#include "ash/shell_delegate.h"
 #include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
 
@@ -20,7 +21,13 @@
 content::BrowserContext*
 SessionStateDelegateStub::GetBrowserContextByIndex(
     MultiProfileIndex index) {
-  return NULL;
+  return Shell::GetInstance()->delegate()->GetActiveBrowserContext();
+}
+
+content::BrowserContext*
+SessionStateDelegateStub::GetBrowserContextForWindow(
+    aura::Window* window) {
+  return Shell::GetInstance()->delegate()->GetActiveBrowserContext();
 }
 
 int SessionStateDelegateStub::GetMaximumNumberOfLoggedInUsers() const {
@@ -79,11 +86,11 @@
 
 const gfx::ImageSkia& SessionStateDelegateStub::GetUserImage(
     content::BrowserContext* context) const {
-  return null_image_;
+  return user_image_;
 }
 
 bool SessionStateDelegateStub::ShouldShowAvatar(aura::Window* window) {
-  return false;
+  return !user_image_.isNull();
 }
 
 void SessionStateDelegateStub::SwitchActiveUser(const std::string& user_id) {
diff --git a/ash/session_state_delegate_stub.h b/ash/session_state_delegate_stub.h
index 8c27e9a..5693fa7 100644
--- a/ash/session_state_delegate_stub.h
+++ b/ash/session_state_delegate_stub.h
@@ -21,6 +21,8 @@
   // SessionStateDelegate:
   virtual content::BrowserContext* GetBrowserContextByIndex(
       MultiProfileIndex index) OVERRIDE;
+  virtual content::BrowserContext* GetBrowserContextForWindow(
+      aura::Window* window) OVERRIDE;
   virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE;
   virtual int NumberOfLoggedInUsers() const OVERRIDE;
   virtual bool IsActiveUserSessionStarted() const OVERRIDE;
@@ -50,7 +52,7 @@
   bool screen_locked_;
 
   // A pseudo user image.
-  gfx::ImageSkia null_image_;
+  gfx::ImageSkia user_image_;
 
   DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub);
 };
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
index 4f433ce..c973157 100644
--- a/ash/shelf/shelf.cc
+++ b/ash/shelf/shelf.cc
@@ -24,7 +24,6 @@
 #include "ash/shell_window_ids.h"
 #include "ash/wm/window_properties.h"
 #include "grit/ash_resources.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/aura/window_observer.h"
@@ -37,6 +36,7 @@
 #include "ui/views/accessible_pane_view.h"
 #include "ui/views/widget/widget.h"
 #include "ui/views/widget/widget_delegate.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 9cc67d6..8db87f4 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -36,7 +36,6 @@
 #include "base/i18n/rtl.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/cursor_client.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/base/ui_base_switches.h"
@@ -48,6 +47,7 @@
 #include "ui/events/event_handler.h"
 #include "ui/gfx/screen.h"
 #include "ui/views/widget/widget.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace internal {
@@ -198,6 +198,8 @@
 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf)
     : root_window_(shelf->GetNativeView()->GetRootWindow()),
       updating_bounds_(false),
+      force_shelf_always_visibile_(
+          Shell::GetInstance()->IsMaximizeModeWindowManagerEnabled()),
       auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER),
       alignment_(SHELF_ALIGNMENT_BOTTOM),
       shelf_(shelf),
@@ -318,7 +320,8 @@
   if (!workspace_controller_)
     return;
 
-  if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) {
+  if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked() ||
+      force_shelf_always_visibile_) {
     SetState(SHELF_VISIBLE);
   } else {
     // TODO(zelidrag): Verify shelf drag animation still shows on the device
@@ -393,6 +396,9 @@
 // ShelfLayoutManager, Gesture functions:
 
 void ShelfLayoutManager::OnGestureEdgeSwipe(const ui::GestureEvent& gesture) {
+  if (force_shelf_always_visibile_)
+    return;
+
   if (visibility_state() == SHELF_AUTO_HIDE) {
     gesture_drag_auto_hide_state_ = SHELF_AUTO_HIDE_SHOWN;
     gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS;
@@ -402,6 +408,8 @@
 }
 
 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) {
+  if (force_shelf_always_visibile_)
+    return;
   gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS;
   gesture_drag_amount_ = 0.f;
   gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ?
@@ -411,6 +419,8 @@
 
 ShelfLayoutManager::DragState ShelfLayoutManager::UpdateGestureDrag(
     const ui::GestureEvent& gesture) {
+  if (force_shelf_always_visibile_)
+    return DRAG_SHELF;
   bool horizontal = IsHorizontalAlignment();
   gesture_drag_amount_ += horizontal ? gesture.details().scroll_y() :
                                        gesture.details().scroll_x();
@@ -435,6 +445,8 @@
 }
 
 void ShelfLayoutManager::CompleteGestureDrag(const ui::GestureEvent& gesture) {
+  if (force_shelf_always_visibile_)
+    return;
   bool horizontal = IsHorizontalAlignment();
   bool should_change = false;
   if (gesture.type() == ui::ET_GESTURE_SCROLL_END) {
@@ -555,6 +567,21 @@
   LayoutShelf();
 }
 
+void ShelfLayoutManager::OnMaximizeModeStarted() {
+  DCHECK(!force_shelf_always_visibile_);
+  force_shelf_always_visibile_ = true;
+  UpdateVisibilityState();
+}
+
+void ShelfLayoutManager::OnMaximizeModeEnded() {
+  DCHECK(force_shelf_always_visibile_);
+  // Note: At this time Ash::Shell::IsMaximizeModeWindowManagerEnabled() will
+  // report true, even though it is in progress of shut down. To address this
+  // |force_shelf_always_visibile_| will be read.
+  force_shelf_always_visibile_ = false;
+  UpdateVisibilityState();
+}
+
 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active,
                                            aura::Window* lost_active) {
   UpdateAutoHideStateNow();
@@ -1003,6 +1030,9 @@
 
 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
     ShelfVisibilityState visibility_state) const {
+  if (force_shelf_always_visibile_)
+    return SHELF_AUTO_HIDE_SHOWN;
+
   if (visibility_state != SHELF_AUTO_HIDE || !shelf_)
     return SHELF_AUTO_HIDE_HIDDEN;
 
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index 861b25b..4e03c7a 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -21,12 +21,12 @@
 #include "base/logging.h"
 #include "base/observer_list.h"
 #include "base/timer/timer.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/layout_manager.h"
 #include "ui/gfx/insets.h"
 #include "ui/gfx/rect.h"
 #include "ui/keyboard/keyboard_controller.h"
 #include "ui/keyboard/keyboard_controller_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 class RootWindow;
@@ -184,6 +184,8 @@
 
   // Overridden from ash::ShellObserver:
   virtual void OnLockStateChanged(bool locked) OVERRIDE;
+  virtual void OnMaximizeModeStarted() OVERRIDE;
+  virtual void OnMaximizeModeEnded() OVERRIDE;
 
   // Overriden from aura::client::ActivationChangeObserver:
   virtual void OnWindowActivated(aura::Window* gained_active,
@@ -346,6 +348,10 @@
   // UpdateBoundsAndOpacity() again from SetChildBounds().
   bool updating_bounds_;
 
+  // If true, the shelf gets forced (e.g. by the maximize mode) to be always
+  // visible.
+  bool force_shelf_always_visibile_;
+
   // See description above setter.
   ShelfAutoHideBehavior auto_hide_behavior_;
 
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 7b3b5d8..9217b2a 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -861,6 +861,38 @@
   EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
 }
 
+// Check that swipes and mouse interactions do have no impact in Maximize mode.
+TEST_F(ShelfLayoutManagerTest, MaximizeModePreventsMouseHide) {
+  aura::Window* root = Shell::GetPrimaryRootWindow();
+  aura::test::EventGenerator generator(root, root);
+  generator.MoveMouseTo(0, 0);
+
+  ShelfLayoutManager* shelf = GetShelfLayoutManager();
+  shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+  views::Widget* widget = new views::Widget;
+  views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+  params.bounds = gfx::Rect(0, 0, 200, 200);
+  params.context = CurrentContext();
+  // Widget is now owned by the parent window.
+  widget->Init(params);
+  widget->Maximize();
+  widget->Show();
+  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+
+  shelf->OnMaximizeModeStarted();
+  // LayoutShelf() forces the animation to completion.
+  shelf->LayoutShelf();
+
+  // Drag mouse to bottom of screen. In contrast to normal operation the shelf
+  // should remain visible.
+  generator.MoveMouseTo(0, 0);
+  generator.PressLeftButton();
+  generator.MoveMouseTo(0, root->bounds().bottom() - 1);
+  UpdateAutoHideStateNow();
+  EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
+}
+
 // Test the behavior of the shelf when it is auto hidden and it is on the
 // boundary between the primary and the secondary display.
 TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) {
@@ -1493,7 +1525,8 @@
             display.work_area().y() - display.bounds().y());
 }
 
-TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) {
+//  https://code.google.com/p/chromium/issues/detail?id=356419
+TEST_F(ShelfLayoutManagerTest, DISABLED_GestureEdgeSwipe) {
   ShelfLayoutManager* shelf = GetShelfLayoutManager();
   shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
   views::Widget* widget = new views::Widget;
@@ -1504,41 +1537,63 @@
   widget->Show();
   widget->Maximize();
 
-  aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
-
   aura::Window* window = widget->GetNativeWindow();
   shelf->LayoutShelf();
 
   gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen();
   gfx::Rect bounds_shelf = window->bounds();
-
-  // Edge swipe when SHELF_VISIBLE should not change visibility state.
-  EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
-  generator.GestureEdgeSwipe();
   EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
 
-  // Edge swipe when AUTO_HIDE_HIDDEN should change to AUTO_HIDE_SHOWN.
   shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
   shelf->LayoutShelf();
-  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
   EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+
+  aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
   generator.GestureEdgeSwipe();
-  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
-  EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
+
+  EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
 
   widget->SetFullscreen(true);
   wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
   shelf->UpdateVisibilityState();
 
-  // Edge swipe in fullscreen + AUTO_HIDE_HIDDEN should show the shelf and
-  // remain fullscreen.
+  gfx::Rect bounds_fullscreen = window->bounds();
   EXPECT_TRUE(widget->IsFullscreen());
-  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
   EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+
   generator.GestureEdgeSwipe();
-  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
+  EXPECT_FALSE(widget->IsFullscreen());
+}
+
+// Check that in maximize mode gesture swipes on the shelf have no effect.
+TEST_F(ShelfLayoutManagerTest, MaximizeModeGestureEdgeSwipe) {
+  ShelfLayoutManager* shelf = GetShelfLayoutManager();
+  shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+  views::Widget* widget = new views::Widget;
+  views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+  params.bounds = gfx::Rect(0, 0, 200, 200);
+  params.context = CurrentContext();
+  widget->Init(params);
+  widget->Show();
+  widget->Maximize();
+
+  shelf->LayoutShelf();
+
+  shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+  shelf->LayoutShelf();
+  EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+
+  shelf->OnMaximizeModeStarted();
+  shelf->LayoutShelf();
   EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
-  EXPECT_TRUE(widget->IsFullscreen());
+
+  aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+  generator.GestureEdgeSwipe();
+
+  EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
 }
 
 #if defined(OS_WIN)
@@ -1933,6 +1988,34 @@
   EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
 }
 
+// Verify that setting the shelf's auto hide mode in maximize mode does not
+// hide.
+TEST_F(ShelfLayoutManagerTest, DoesNotHideInMaximizeMode) {
+  EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
+
+  GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+  scoped_ptr<aura::Window> w1(CreateTestWindow());
+  w1->Show();
+  ShelfLayoutManager* shelf = GetShelfLayoutManager();
+
+  EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+
+  GetShelfLayoutManager()->OnMaximizeModeStarted();
+  EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
+
+  // Setting the state again should have no impact.
+  GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+  EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
+
+  GetShelfLayoutManager()->OnMaximizeModeEnded();
+  EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+  EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+}
+
 #if defined(OS_CHROMEOS)
 #define MAYBE_StatusAreaHitBoxCoversEdge StatusAreaHitBoxCoversEdge
 #else
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 47c6d07..f3f1f29 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -22,7 +22,6 @@
 #include "ash/wm/window_properties.h"
 #include "ash/wm/workspace_controller.h"
 #include "grit/ash_resources.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/aura/window_observer.h"
@@ -38,6 +37,7 @@
 #include "ui/views/widget/widget.h"
 #include "ui/views/widget/widget_delegate.h"
 #include "ui/wm/core/easy_resize_window_targeter.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace {
 // Size of black border at bottom (or side) of shelf.
diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc
index 59cb38b..9488d10 100644
--- a/ash/shelf/shelf_window_watcher.cc
+++ b/ash/shelf/shelf_window_watcher.cc
@@ -16,11 +16,11 @@
 #include "ash/wm/window_state.h"
 #include "ash/wm/window_util.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/window.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/image/image_skia.h"
 #include "ui/gfx/screen.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace {
 
diff --git a/ash/shelf/shelf_window_watcher.h b/ash/shelf/shelf_window_watcher.h
index 57b4ed2..ba42756 100644
--- a/ash/shelf/shelf_window_watcher.h
+++ b/ash/shelf/shelf_window_watcher.h
@@ -10,9 +10,9 @@
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/scoped_observer.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/window_observer.h"
 #include "ui/gfx/display_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 
diff --git a/ash/shell.cc b/ash/shell.cc
index 8f47b57..34c386d 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -113,16 +113,13 @@
 #if defined(USE_X11)
 #include "ash/accelerators/magnifier_key_scroller.h"
 #include "ash/accelerators/spoken_feedback_toggler.h"
+#include "base/message_loop/message_pump_x11.h"
+#endif  // defined(USE_X11)
 #include "ash/ash_constants.h"
 #include "ash/display/display_change_observer_chromeos.h"
 #include "ash/display/display_error_observer_chromeos.h"
 #include "ash/display/output_configurator_animation.h"
 #include "ash/display/projecting_observer_chromeos.h"
-#include "ash/system/chromeos/session/last_window_closed_logout_reminder.h"
-#include "base/message_loop/message_pump_x11.h"
-#include "base/sys_info.h"
-#include "ui/display/chromeos/output_configurator.h"
-#endif  // defined(USE_X11)
 #include "ash/display/resolution_notification_controller.h"
 #include "ash/sticky_keys/sticky_keys_controller.h"
 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h"
@@ -131,8 +128,11 @@
 #include "ash/system/chromeos/power/power_status.h"
 #include "ash/system/chromeos/power/user_activity_notifier.h"
 #include "ash/system/chromeos/power/video_activity_notifier.h"
+#include "ash/system/chromeos/session/last_window_closed_logout_reminder.h"
 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
 #include "base/bind_helpers.h"
+#include "base/sys_info.h"
+#include "ui/display/chromeos/output_configurator.h"
 #endif  // defined(OS_CHROMEOS)
 
 namespace ash {
@@ -606,12 +606,12 @@
       delegate_(delegate),
       window_positioner_(new WindowPositioner),
       activation_client_(NULL),
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
       output_configurator_(new ui::OutputConfigurator()),
-#endif  // defined(OS_CHROMEOS) && defined(USE_X11)
+#endif  // defined(OS_CHROMEOS)
       native_cursor_manager_(new AshNativeCursorManager),
-      cursor_manager_(scoped_ptr< ::wm::NativeCursorManager>(
-          native_cursor_manager_)),
+      cursor_manager_(
+          scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)),
       simulate_modal_window_open_for_testing_(false),
       is_touch_hud_projection_enabled_(false) {
   DCHECK(delegate_.get());
@@ -630,6 +630,8 @@
 Shell::~Shell() {
   TRACE_EVENT0("shutdown", "ash::Shell::Destructor");
 
+  delegate_->PreShutdown();
+
   views::FocusManagerFactory::Install(NULL);
 
   // Remove the focus from any window. This will prevent overhead and side
@@ -760,7 +762,7 @@
   new_window_delegate_.reset();
   media_delegate_.reset();
 
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   if (display_change_observer_)
     output_configurator_->RemoveObserver(display_change_observer_.get());
   if (output_configurator_animation_)
@@ -787,7 +789,7 @@
         internal::DisplayManager::VIRTUAL_KEYBOARD);
   }
   bool display_initialized = display_manager_->InitFromCommandLine();
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled());
   output_configurator_animation_.reset(
       new internal::OutputConfiguratorAnimation());
@@ -809,7 +811,7 @@
         delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0);
     display_initialized = true;
   }
-#endif  // defined(OS_CHROMEOS) && defined(USE_X11)
+#endif  // defined(OS_CHROMEOS)
   if (!display_initialized)
     display_manager_->InitDefaultDisplay();
 
@@ -910,7 +912,7 @@
   lock_state_controller_.reset(new LockStateController);
   power_button_controller_.reset(new PowerButtonController(
       lock_state_controller_.get()));
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   // Pass the initial display state to PowerButtonController.
   power_button_controller_->OnDisplayModeChanged(
       output_configurator_->cached_outputs());
diff --git a/ash/shell.h b/ash/shell.h
index ddb59b6..1f511db 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -19,7 +19,6 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/window.h"
 #include "ui/base/ui_base_types.h"
 #include "ui/events/event_target.h"
@@ -27,6 +26,7 @@
 #include "ui/gfx/screen.h"
 #include "ui/gfx/size.h"
 #include "ui/wm/core/cursor_manager.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace app_list {
 class AppListView;
@@ -501,7 +501,6 @@
   void DoInitialWorkspaceAnimation();
 
 #if defined(OS_CHROMEOS)
-#if defined(USE_X11)
   // TODO(oshima): Move these objects to DisplayController.
   ui::OutputConfigurator* output_configurator() {
     return output_configurator_.get();
@@ -512,7 +511,6 @@
   internal::DisplayErrorObserver* display_error_observer() {
     return display_error_observer_.get();
   }
-#endif  // defined(USE_X11)
 
   internal::ResolutionNotificationController*
       resolution_notification_controller() {
@@ -712,7 +710,6 @@
       logout_confirmation_controller_;
   scoped_ptr<internal::LastWindowClosedLogoutReminder>
       last_window_closed_logout_reminder_;
-#if defined(USE_X11)
   // Controls video output device state.
   scoped_ptr<ui::OutputConfigurator> output_configurator_;
   scoped_ptr<internal::OutputConfiguratorAnimation>
@@ -723,6 +720,7 @@
   // Listens for output changes and updates the display manager.
   scoped_ptr<internal::DisplayChangeObserver> display_change_observer_;
 
+#if defined(USE_X11)
   scoped_ptr<ui::EventHandler> magnifier_key_scroll_handler_;
   scoped_ptr<ui::EventHandler> speech_feedback_handler_;
 #endif  // defined(USE_X11)
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index d21f7ac..4efd104 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -101,7 +101,7 @@
 void ShellDelegateImpl::PreInit() {
 }
 
-void ShellDelegateImpl::Shutdown() {
+void ShellDelegateImpl::PreShutdown() {
 }
 
 void ShellDelegateImpl::Exit() {
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 2b5aa12..705ef21 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -39,7 +39,7 @@
   virtual bool IsMultiProfilesEnabled() const OVERRIDE;
   virtual bool IsRunningInForcedAppMode() const OVERRIDE;
   virtual void PreInit() OVERRIDE;
-  virtual void Shutdown() OVERRIDE;
+  virtual void PreShutdown() OVERRIDE;
   virtual void Exit() OVERRIDE;
   virtual keyboard::KeyboardControllerProxy*
       CreateKeyboardControllerProxy() OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index ba28e0c..9a4ac77 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -76,8 +76,9 @@
   // can perform tasks necessary before the shell is initialized.
   virtual void PreInit() = 0;
 
-  // Shuts down the environment.
-  virtual void Shutdown() = 0;
+  // Called at the beginninig of Shell destructor so that
+  // delegate can use Shell instance to perform cleanup tasks.
+  virtual void PreShutdown() = 0;
 
   // Invoked when the user uses Ctrl-Shift-Q to close chrome.
   virtual void Exit() = 0;
diff --git a/ash/sticky_keys/sticky_keys_controller.cc b/ash/sticky_keys/sticky_keys_controller.cc
index 812e46e..e5bb0af 100644
--- a/ash/sticky_keys/sticky_keys_controller.cc
+++ b/ash/sticky_keys/sticky_keys_controller.cc
@@ -97,7 +97,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 //  StickyKeys
 StickyKeysController::StickyKeysController()
-    : enabled_(false) {
+    : enabled_(false),
+      mod3_enabled_(false),
+      altgr_enabled_(false) {
 }
 
 StickyKeysController::~StickyKeysController() {
@@ -124,12 +126,21 @@
                                 new StickyKeysHandlerDelegateImpl()));
 
       overlay_.reset(new StickyKeysOverlay());
-    } else if (overlay_.get()) {
+      overlay_->SetModifierVisible(ui::EF_ALTGR_DOWN, altgr_enabled_);
+    } else if (overlay_) {
       overlay_->Show(false);
     }
   }
 }
 
+void StickyKeysController::SetModifiersEnabled(bool mod3_enabled,
+                                               bool altgr_enabled) {
+  mod3_enabled_ = mod3_enabled;
+  altgr_enabled_ = altgr_enabled;
+  if (overlay_)
+    overlay_->SetModifierVisible(ui::EF_ALTGR_DOWN, altgr_enabled_);
+}
+
 bool StickyKeysController::HandleKeyEvent(ui::KeyEvent* event) {
   return shift_sticky_key_->HandleKeyEvent(event) ||
       alt_sticky_key_->HandleKeyEvent(event) ||
diff --git a/ash/sticky_keys/sticky_keys_controller.h b/ash/sticky_keys/sticky_keys_controller.h
index 018d4f5..792f2c5 100644
--- a/ash/sticky_keys/sticky_keys_controller.h
+++ b/ash/sticky_keys/sticky_keys_controller.h
@@ -67,6 +67,8 @@
   // Activate sticky keys to intercept and modify incoming events.
   void Enable(bool enabled);
 
+  void SetModifiersEnabled(bool mod3_enabled, bool altgr_enabled);
+
   // Overridden from ui::EventHandler:
   virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
   virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
@@ -92,6 +94,12 @@
   // Whether sticky keys is activated and modifying events.
   bool enabled_;
 
+  // Whether the current layout has a mod3 key.
+  bool mod3_enabled_;
+
+  // Whether the current layout has an altgr key.
+  bool altgr_enabled_;
+
   // Sticky key handlers.
   scoped_ptr<StickyKeysHandler> shift_sticky_key_;
   scoped_ptr<StickyKeysHandler> alt_sticky_key_;
diff --git a/ash/sticky_keys/sticky_keys_overlay.cc b/ash/sticky_keys/sticky_keys_overlay.cc
index 4d32f03..e91caf4 100644
--- a/ash/sticky_keys/sticky_keys_overlay.cc
+++ b/ash/sticky_keys/sticky_keys_overlay.cc
@@ -130,6 +130,8 @@
 
   StickyKeyState GetKeyState(ui::EventFlags modifier);
 
+  void SetModifierVisible(ui::EventFlags modifier, bool visible);
+
  private:
   void AddKeyLabel(ui::EventFlags modifier, const std::string& key_label);
 
@@ -191,6 +193,13 @@
   return it->second->state();
 }
 
+void StickyKeysOverlayView::SetModifierVisible(ui::EventFlags modifier,
+                                               bool visible) {
+  ModifierLabelMap::iterator it = modifier_label_map_.find(modifier);
+  DCHECK(it != modifier_label_map_.end());
+  it->second->SetVisible(visible);
+}
+
 void StickyKeysOverlayView::AddKeyLabel(ui::EventFlags modifier,
                                         const std::string& key_label) {
   StickyKeyOverlayLabel* label = new StickyKeyOverlayLabel(key_label);
@@ -257,6 +266,12 @@
   overlay_widget_->GetLayer()->SetTransform(gfx::Transform());
 }
 
+void StickyKeysOverlay::SetModifierVisible(ui::EventFlags modifier,
+                                           bool visible) {
+  overlay_view_->SetModifierVisible(modifier, visible);
+  widget_size_ = overlay_view_->GetPreferredSize();
+}
+
 void StickyKeysOverlay::SetModifierKeyState(ui::EventFlags modifier,
                                             StickyKeyState state) {
   overlay_view_->SetKeyState(modifier, state);
diff --git a/ash/sticky_keys/sticky_keys_overlay.h b/ash/sticky_keys/sticky_keys_overlay.h
index 88d195a..74d082a 100644
--- a/ash/sticky_keys/sticky_keys_overlay.h
+++ b/ash/sticky_keys/sticky_keys_overlay.h
@@ -36,6 +36,8 @@
   // Shows or hides the overlay.
   void Show(bool visible);
 
+  void SetModifierVisible(ui::EventFlags modifier, bool visible);
+
   // Updates the overlay with the current state of a sticky key modifier.
   void SetModifierKeyState(ui::EventFlags modifier,
                            StickyKeyState state);
diff --git a/ash/strings/ash_strings_am.xtb b/ash/strings/ash_strings_am.xtb
index dd99043..99cec7e 100644
--- a/ash/strings/ash_strings_am.xtb
+++ b/ash/strings/ash_strings_am.xtb
@@ -203,7 +203,7 @@
 <translation id="7593891976182323525">Search ወይም Shift</translation>
 <translation id="7649070708921625228">እገዛ</translation>
 <translation id="3050422059534974565">CAPS LOCK በርቷል።
-ለመሰረዝ Search ወይም Shift ይጫኑ።</translation>
+ይቅር ለማለት Search ወይም Shift ይጫኑ።</translation>
 <translation id="397105322502079400">በማስላት ላይ...</translation>
 <translation id="158849752021629804">የቤት አውታረ መረብ ያስፈልጋል</translation>
 <translation id="6857811139397017780"><ph name="NETWORKSERVICE"/>ን አግብር</translation>
@@ -221,7 +221,7 @@
 ለማሰናከል Ctrl+Alt+Z ይጫኑ።</translation>
 <translation id="5045002648206642691">የGoogle Drive ቅንብሮች...</translation>
 <translation id="7209101170223508707">CAPS LOCK በርቷል።
-ለመሰረዝ Alt+Search ወይም Shift ይጫኑ።</translation>
+ይቅር ለማለት Alt+Search ወይም Shift ይጫኑ።</translation>
 <translation id="8940956008527784070">ባትሪ ዝቅተኛ ነው (<ph name="PERCENTAGE"/>%)</translation>
 <translation id="4918086044614829423">ይቀበሉ</translation>
 <translation id="5102001756192215136"><ph name="HOUR"/>:<ph name="MINUTE"/> ቀርቷል</translation>
diff --git a/ash/system/chromeos/network/network_connect.cc b/ash/system/chromeos/network/network_connect.cc
index d83357d..e239ff9 100644
--- a/ash/system/chromeos/network/network_connect.cc
+++ b/ash/system/chromeos/network/network_connect.cc
@@ -109,6 +109,32 @@
   NOTREACHED();
 }
 
+// If |shared| is true, sets |profile_path| to the shared profile path.
+// Otherwise sets |profile_path| to the user profile path if authenticated and
+// available. Returns 'false' if unable to set |profile_path|.
+bool GetNetworkProfilePath(bool shared, std::string* profile_path) {
+  if (shared) {
+    *profile_path = NetworkProfileHandler::GetSharedProfilePath();
+    return true;
+  }
+
+  if (!chromeos::LoginState::Get()->IsUserAuthenticated()) {
+    NET_LOG_ERROR("User profile specified before login", "");
+    return false;
+  }
+
+  const NetworkProfile* profile  =
+      NetworkHandler::Get()->network_profile_handler()->
+      GetDefaultUserProfile();
+  if (!profile) {
+    NET_LOG_ERROR("No user profile for unshared network configuration", "");
+    return false;
+  }
+
+  *profile_path = profile->path;
+  return true;
+}
+
 void OnConnectFailed(const std::string& service_path,
                      gfx::NativeWindow parent_window,
                      const std::string& error_name,
@@ -213,14 +239,33 @@
   ShowErrorNotification(NetworkConnectionHandler::kErrorConfigureFailed, "");
 }
 
-void OnConfigureSucceeded(const std::string& service_path) {
+void OnConfigureSucceeded(bool connect_on_configure,
+                          const std::string& service_path) {
   NET_LOG_USER("Configure Succeeded", service_path);
+  if (!connect_on_configure)
+    return;
   // After configuring a network, ignore any (possibly stale) error state.
   const bool check_error_state = false;
   const gfx::NativeWindow parent_window = NULL;
   CallConnectToNetwork(service_path, check_error_state, parent_window);
 }
 
+void CallCreateConfiguration(base::DictionaryValue* properties,
+                             bool shared,
+                             bool connect_on_configure) {
+  std::string profile_path;
+  if (!GetNetworkProfilePath(shared, &profile_path)) {
+    ShowErrorNotification(NetworkConnectionHandler::kErrorConfigureFailed, "");
+    return;
+  }
+  properties->SetStringWithoutPathExpansion(
+      shill::kProfileProperty, profile_path);
+  NetworkHandler::Get()->network_configuration_handler()->CreateConfiguration(
+      *properties,
+      base::Bind(&OnConfigureSucceeded, connect_on_configure),
+      base::Bind(&OnConfigureFailed));
+}
+
 void SetPropertiesFailed(const std::string& desc,
                          const std::string& service_path,
                          const std::string& config_error_name,
@@ -262,31 +307,6 @@
       base::Bind(&SetPropertiesFailed, "ClearProperties", service_path));
 }
 
-// Returns false if !shared and no valid profile is available, which will
-// trigger an error and abort.
-bool GetNetworkProfilePath(bool shared, std::string* profile_path) {
-  if (shared) {
-    *profile_path = NetworkProfileHandler::GetSharedProfilePath();
-    return true;
-  }
-
-  if (!chromeos::LoginState::Get()->IsUserAuthenticated()) {
-    NET_LOG_ERROR("User profile specified before login", "");
-    return false;
-  }
-
-  const NetworkProfile* profile  =
-      NetworkHandler::Get()->network_profile_handler()->
-      GetDefaultUserProfile();
-  if (!profile) {
-    NET_LOG_ERROR("No user profile for unshared network configuration", "");
-    return false;
-  }
-
-  *profile_path = profile->path;
-  return true;
-}
-
 void ConfigureSetProfileSucceeded(
     const std::string& service_path,
     scoped_ptr<base::DictionaryValue> properties_to_set) {
@@ -321,8 +341,8 @@
                       gfx::NativeWindow parent_window) {
   NET_LOG_USER("ConnectToNetwork", service_path);
   const NetworkState* network = GetNetworkState(service_path);
-  if (network && !network->last_error().empty()) {
-    NET_LOG_USER("Configure: " + network->last_error(), service_path);
+  if (network && !network->error().empty() && !network->security().empty()) {
+    NET_LOG_USER("Configure: " + network->error(), service_path);
     // If the network is in an error state, show the configuration UI directly
     // to avoid a spurious notification.
     HandleUnconfiguredNetwork(service_path, parent_window);
@@ -466,17 +486,12 @@
 void CreateConfigurationAndConnect(base::DictionaryValue* properties,
                                    bool shared) {
   NET_LOG_USER("CreateConfigurationAndConnect", "");
-  std::string profile_path;
-  if (!GetNetworkProfilePath(shared, &profile_path)) {
-    ShowErrorNotification(NetworkConnectionHandler::kErrorConfigureFailed, "");
-    return;
-  }
-  properties->SetStringWithoutPathExpansion(
-      shill::kProfileProperty, profile_path);
-  NetworkHandler::Get()->network_configuration_handler()->CreateConfiguration(
-      *properties,
-      base::Bind(&OnConfigureSucceeded),
-      base::Bind(&OnConfigureFailed));
+  CallCreateConfiguration(properties, shared, true /* connect_on_configure */);
+}
+
+void CreateConfiguration(base::DictionaryValue* properties, bool shared) {
+  NET_LOG_USER("CreateConfiguration", "");
+  CallCreateConfiguration(properties, shared, false /* connect_on_configure */);
 }
 
 base::string16 ErrorString(const std::string& error,
diff --git a/ash/system/chromeos/network/network_connect.h b/ash/system/chromeos/network/network_connect.h
index adf939d..2d72938 100644
--- a/ash/system/chromeos/network/network_connect.h
+++ b/ash/system/chromeos/network/network_connect.h
@@ -55,10 +55,16 @@
     bool shared);
 
 // Requests a new network configuration to be created from a dictionary of
-// Shill properties. The profile used is determined by |shared|.
+// Shill properties and sends a connect request if the configuration succeeds.
+// The profile used is determined by |shared|.
 ASH_EXPORT void CreateConfigurationAndConnect(base::DictionaryValue* properties,
                                               bool shared);
 
+// Requests a new network configuration to be created from a dictionary of
+// Shill properties. The profile used is determined by |shared|.
+ASH_EXPORT void CreateConfiguration(base::DictionaryValue* properties,
+                                    bool shared);
+
 // Returns the localized string for shill error string |error|.
 ASH_EXPORT base::string16 ErrorString(const std::string& error,
                                       const std::string& service_path);
diff --git a/ash/system/chromeos/network/network_state_notifier.cc b/ash/system/chromeos/network/network_state_notifier.cc
index b81476d..027b284 100644
--- a/ash/system/chromeos/network/network_state_notifier.cc
+++ b/ash/system/chromeos/network/network_state_notifier.cc
@@ -252,35 +252,41 @@
     std::string shill_error;
     shill_properties.GetStringWithoutPathExpansion(shill::kErrorProperty,
                                                    &shill_error);
-    if (shill_error.empty()) {
-      NET_LOG_DEBUG("Service.Error is empty, trying PreviousError",
-                    service_path);
+    if (!chromeos::NetworkState::ErrorIsValid(shill_error)) {
       shill_properties.GetStringWithoutPathExpansion(
           shill::kPreviousErrorProperty, &shill_error);
+      NET_LOG_DEBUG("Notify Service.PreviousError: " + shill_error,
+                    service_path);
+      if (!chromeos::NetworkState::ErrorIsValid(shill_error))
+        shill_error.clear();
+    } else {
+      NET_LOG_DEBUG("Notify Service.Error: " + shill_error, service_path);
     }
-    std::string last_error;
+
     const NetworkState* network =
         NetworkHandler::Get()->network_state_handler()->GetNetworkState(
             service_path);
-    if (network)
-      last_error = network->last_error();
-    if (!last_error.empty() && last_error != shill_error) {
-      NET_LOG_DEBUG(
-          "last_error:" + last_error + " != Service.Error: " + shill_error,
-          service_path);
-      // Use Shill Error unless empty, since it is more recent.
+    if (network) {
+      // Always log last_error, but only use it if shill_error is empty.
+      // TODO(stevenjb): This shouldn't ever be necessary, but is kept here as a
+      // failsafe since more information is better than less when debugging and
+      // we have encountered some strange edge cases before.
+      NET_LOG_DEBUG("Notify Network.last_error: " + network->last_error(),
+                    service_path);
       if (shill_error.empty())
-        shill_error = last_error;
+        shill_error = network->last_error();
     }
+
     if (ShillErrorIsIgnored(shill_error)) {
-      NET_LOG_DEBUG("Ignoring error: " + error_name, service_path);
+      NET_LOG_DEBUG("Notify Ignoring error: " + error_name, service_path);
       return;
     }
+
     error = network_connect::ErrorString(shill_error, service_path);
     if (error.empty())
       error = l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN);
   }
-  NET_LOG_ERROR("Connect error notification: " + base::UTF16ToUTF8(error),
+  NET_LOG_ERROR("Notify connect error: " + base::UTF16ToUTF8(error),
                 service_path);
 
   std::string network_name =
diff --git a/ash/system/system_notifier.cc b/ash/system/system_notifier.cc
index 16e024a..7669186 100644
--- a/ash/system/system_notifier.cc
+++ b/ash/system/system_notifier.cc
@@ -22,7 +22,6 @@
 };
 
 const char* kAshSystemNotifiers[] = {
-  kNotifierAuthError,
   kNotifierDisplay,
   kNotifierDisplayResolutionChange,
   kNotifierDisplayError,
@@ -55,7 +54,6 @@
 
 }  // namespace
 
-const char kNotifierAuthError[] = "ash.auth.error";
 const char kNotifierBluetooth[] = "ash.bluetooth";
 const char kNotifierDisplay[] = "ash.display";
 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change";
diff --git a/ash/system/system_notifier.h b/ash/system/system_notifier.h
index 00ec2df..0d4b6c7 100644
--- a/ash/system/system_notifier.h
+++ b/ash/system/system_notifier.h
@@ -14,7 +14,6 @@
 namespace system_notifier {
 
 // The list of ash system notifier IDs. Alphabetical order.
-ASH_EXPORT extern const char kNotifierAuthError[];
 ASH_EXPORT extern const char kNotifierBluetooth[];
 ASH_EXPORT extern const char kNotifierDisplay[];
 ASH_EXPORT extern const char kNotifierDisplayResolutionChange[];
diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc
index bc8f017..e78944c 100644
--- a/ash/system/tray/hover_highlight_view.cc
+++ b/ash/system/tray/hover_highlight_view.cc
@@ -142,7 +142,8 @@
 
   if (checkable_) {
     state->role = ui::AX_ROLE_CHECK_BOX;
-    state->state = checked_ ? ui::AX_STATE_CHECKED : 0;
+    if (checked_)
+      state->AddStateFlag(ui::AX_STATE_CHECKED);
   }
 }
 
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc
index 4e94408..073b898 100644
--- a/ash/system/tray_accessibility.cc
+++ b/ash/system/tray_accessibility.cc
@@ -14,8 +14,8 @@
 #include "ash/system/tray/tray_constants.h"
 #include "ash/system/tray/tray_details_view.h"
 #include "ash/system/tray/tray_item_more.h"
-#include "ash/system/tray/tray_notification_view.h"
 #include "ash/system/tray/tray_popup_label_button.h"
+#include "base/strings/utf_string_conversions.h"
 #include "grit/ash_resources.h"
 #include "grit/ash_strings.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -32,13 +32,14 @@
 namespace {
 
 enum AccessibilityState {
-  A11Y_NONE             = 0,
-  A11Y_SPOKEN_FEEDBACK  = 1 << 0,
-  A11Y_HIGH_CONTRAST    = 1 << 1,
+  A11Y_NONE = 0,
+  A11Y_SPOKEN_FEEDBACK = 1 << 0,
+  A11Y_HIGH_CONTRAST = 1 << 1,
   A11Y_SCREEN_MAGNIFIER = 1 << 2,
-  A11Y_LARGE_CURSOR     = 1 << 3,
-  A11Y_AUTOCLICK        = 1 << 4,
+  A11Y_LARGE_CURSOR = 1 << 3,
+  A11Y_AUTOCLICK = 1 << 4,
   A11Y_VIRTUAL_KEYBOARD = 1 << 5,
+  A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6,
 };
 
 uint32 GetAccessibilityState() {
@@ -57,6 +58,8 @@
     state |= A11Y_AUTOCLICK;
   if (delegate->IsVirtualKeyboardEnabled())
     state |= A11Y_VIRTUAL_KEYBOARD;
+  if (delegate->IsBrailleDisplayConnected())
+    state |= A11Y_BRAILLE_DISPLAY_CONNECTED;
   return state;
 }
 
@@ -88,25 +91,35 @@
   DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView);
 };
 
-class AccessibilityPopupView : public TrayNotificationView {
- public:
-  AccessibilityPopupView(SystemTrayItem* owner)
-      : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK) {
-    InitView(GetLabel());
-  }
+////////////////////////////////////////////////////////////////////////////////
+// ash::internal::tray::AccessibilityPopupView
 
- private:
-  views::Label* GetLabel() {
-    views::Label* label = new views::Label(
-        l10n_util::GetStringUTF16(
-            IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_ENABLED_BUBBLE));
-    label->SetMultiLine(true);
-    label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
-    return label;
-  }
+AccessibilityPopupView::AccessibilityPopupView(SystemTrayItem* owner,
+                                               uint32 enabled_state_bits)
+    : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK),
+      label_(CreateLabel(enabled_state_bits)) {
+  InitView(label_);
+}
 
-  DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView);
-};
+views::Label* AccessibilityPopupView::CreateLabel(uint32 enabled_state_bits) {
+  DCHECK((enabled_state_bits &
+          (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED)) != 0);
+  base::string16 text;
+  if (enabled_state_bits & A11Y_BRAILLE_DISPLAY_CONNECTED) {
+    text.append(l10n_util::GetStringUTF16(
+        IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED_BUBBLE));
+  }
+  if (enabled_state_bits & A11Y_SPOKEN_FEEDBACK) {
+    if (!text.empty())
+      text.append(base::ASCIIToUTF16(" "));
+    text.append(l10n_util::GetStringUTF16(
+        IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_ENABLED_BUBBLE));
+  }
+  views::Label* label = new views::Label(text);
+  label->SetMultiLine(true);
+  label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+  return label;
+}
 
 ////////////////////////////////////////////////////////////////////////////////
 // ash::internal::tray::AccessibilityDetailedView
@@ -302,7 +315,7 @@
       default_(NULL),
       detailed_popup_(NULL),
       detailed_menu_(NULL),
-      request_popup_view_(false),
+      request_popup_view_state_(A11Y_NONE),
       tray_icon_visible_(false),
       login_(GetCurrentLoginStatus()),
       previous_accessibility_state_(GetAccessibilityState()),
@@ -359,9 +372,10 @@
   CHECK(detailed_popup_ == NULL);
   CHECK(detailed_menu_ == NULL);
 
-  if (request_popup_view_) {
-    detailed_popup_ = new tray::AccessibilityPopupView(this);
-    request_popup_view_ = false;
+  if (request_popup_view_state_) {
+    detailed_popup_ =
+        new tray::AccessibilityPopupView(this, request_popup_view_state_);
+    request_popup_view_state_ = A11Y_NONE;
     return detailed_popup_;
   } else {
     Shell::GetInstance()->metrics()->RecordUserMetricsAction(
@@ -394,11 +408,21 @@
   SetTrayIconVisible(GetInitialVisibility());
 
   uint32 accessibility_state = GetAccessibilityState();
-  if ((notify == ash::A11Y_NOTIFICATION_SHOW) &&
-      !(previous_accessibility_state_ & A11Y_SPOKEN_FEEDBACK) &&
-      (accessibility_state & A11Y_SPOKEN_FEEDBACK)) {
+  // We'll get an extra notification if a braille display is connected when
+  // spoken feedback wasn't already enabled.  This is because the braille
+  // connection state is already updated when spoken feedback is enabled so
+  // that the notifications can be consolidated into one.  Therefore, we
+  // return early if there's no change in the state that we keep track of.
+  if (accessibility_state == previous_accessibility_state_)
+    return;
+  // Contains bits for spoken feedback and braille display connected currently
+  // being enabled.
+  uint32 being_enabled =
+      (accessibility_state & ~previous_accessibility_state_) &
+      (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED);
+  if ((notify == ash::A11Y_NOTIFICATION_SHOW) && being_enabled != A11Y_NONE) {
     // Shows popup if |notify| is true and the spoken feedback is being enabled.
-    request_popup_view_ = true;
+    request_popup_view_state_ = being_enabled;
     PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
   } else {
     if (detailed_popup_)
diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h
index 1d6e9f8..df0a186 100644
--- a/ash/system/tray_accessibility.h
+++ b/ash/system/tray_accessibility.h
@@ -9,6 +9,7 @@
 #include "ash/shell_observer.h"
 #include "ash/system/tray/tray_details_view.h"
 #include "ash/system/tray/tray_image_item.h"
+#include "ash/system/tray/tray_notification_view.h"
 #include "ash/system/tray/view_click_listener.h"
 #include "base/gtest_prod_util.h"
 #include "ui/gfx/font.h"
@@ -21,6 +22,7 @@
 namespace views {
 class Button;
 class ImageView;
+class Label;
 class View;
 }
 
@@ -43,7 +45,19 @@
 
 namespace tray {
 
-class AccessibilityPopupView;
+class AccessibilityPopupView : public TrayNotificationView {
+ public:
+  AccessibilityPopupView(SystemTrayItem* owner, uint32 enabled_state_bits);
+
+  const views::Label* label_for_test() const { return label_; }
+
+ private:
+  views::Label* CreateLabel(uint32 enabled_state_bits);
+
+  views::Label* label_;
+
+  DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView);
+};
 
 class AccessibilityDetailedView : public TrayDetailsView,
                                   public ViewClickListener,
@@ -119,7 +133,10 @@
   tray::AccessibilityPopupView* detailed_popup_;
   tray::AccessibilityDetailedView* detailed_menu_;
 
-  bool request_popup_view_;
+  // Bitmap of fvalues from AccessibilityState.  Can contain any or
+  // both of A11Y_SPOKEN_FEEDBACK A11Y_BRAILLE_DISPLAY_CONNECTED.
+  uint32 request_popup_view_state_;
+
   bool tray_icon_visible_;
   user::LoginStatus login_;
 
diff --git a/ash/test/test_activation_delegate.h b/ash/test/test_activation_delegate.h
index 02aeb45..b60354e 100644
--- a/ash/test/test_activation_delegate.h
+++ b/ash/test/test_activation_delegate.h
@@ -7,9 +7,9 @@
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
-#include "ui/aura/client/activation_change_observer.h"
-#include "ui/aura/client/activation_delegate.h"
 #include "ui/events/event_handler.h"
+#include "ui/wm/public/activation_change_observer.h"
+#include "ui/wm/public/activation_delegate.h"
 
 namespace aura {
 class Window;
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
index 722981f..491408e 100644
--- a/ash/test/test_session_state_delegate.cc
+++ b/ash/test/test_session_state_delegate.cc
@@ -46,6 +46,12 @@
   return NULL;
 }
 
+content::BrowserContext*
+TestSessionStateDelegate::GetBrowserContextForWindow(
+    aura::Window* window) {
+  return NULL;
+}
+
 int TestSessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const {
   return 3;
 }
@@ -118,6 +124,11 @@
   user_adding_screen_running_ = user_adding_screen_running;
 }
 
+void TestSessionStateDelegate::SetUserImage(
+    const gfx::ImageSkia& user_image) {
+  user_image_ = user_image;
+}
+
 const base::string16 TestSessionStateDelegate::GetUserDisplayName(
     MultiProfileIndex index) const {
   return base::UTF8ToUTF16("Über tray Über tray Über tray Über tray");
@@ -140,11 +151,11 @@
 
 const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage(
     content::BrowserContext* context) const {
-  return null_image_;
+  return user_image_;
 }
 
 bool TestSessionStateDelegate::ShouldShowAvatar(aura::Window* window) {
-  return false;
+  return !user_image_.isNull();
 }
 
 void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) {
diff --git a/ash/test/test_session_state_delegate.h b/ash/test/test_session_state_delegate.h
index 21c34f6..2cc95e5 100644
--- a/ash/test/test_session_state_delegate.h
+++ b/ash/test/test_session_state_delegate.h
@@ -24,6 +24,8 @@
   // SessionStateDelegate:
   virtual content::BrowserContext* GetBrowserContextByIndex(
       MultiProfileIndex index) OVERRIDE;
+  virtual content::BrowserContext* GetBrowserContextForWindow(
+      aura::Window* window) OVERRIDE;
   virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE;
   virtual int NumberOfLoggedInUsers() const OVERRIDE;
   virtual bool IsActiveUserSessionStarted() const OVERRIDE;
@@ -75,6 +77,9 @@
   // running now.
   void SetUserAddingScreenRunning(bool user_adding_screen_running);
 
+  // Setting non NULL image enables avatar icon.
+  void SetUserImage(const gfx::ImageSkia& user_image);
+
  private:
   // Whether a session is in progress and there is an active user.
   bool has_active_user_;
@@ -104,7 +109,7 @@
   std::string activated_user_;
 
   // A test user image.
-  gfx::ImageSkia null_image_;
+  gfx::ImageSkia user_image_;
 
   DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate);
 };
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 57c76cc..fe981d7 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -80,7 +80,7 @@
 void TestShellDelegate::PreInit() {
 }
 
-void TestShellDelegate::Shutdown() {
+void TestShellDelegate::PreShutdown() {
 }
 
 void TestShellDelegate::Exit() {
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index a41d1bb..9e610b6 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -35,7 +35,7 @@
   virtual bool IsMultiProfilesEnabled() const OVERRIDE;
   virtual bool IsRunningInForcedAppMode() const OVERRIDE;
   virtual void PreInit() OVERRIDE;
-  virtual void Shutdown() OVERRIDE;
+  virtual void PreShutdown() OVERRIDE;
   virtual void Exit() OVERRIDE;
   virtual keyboard::KeyboardControllerProxy*
       CreateKeyboardControllerProxy() OVERRIDE;
diff --git a/ash/tooltips/tooltip_controller_unittest.cc b/ash/tooltips/tooltip_controller_unittest.cc
index 64e69dd..b41a99c 100644
--- a/ash/tooltips/tooltip_controller_unittest.cc
+++ b/ash/tooltips/tooltip_controller_unittest.cc
@@ -5,7 +5,6 @@
 #include "ash/shell.h"
 #include "ash/test/ash_test_base.h"
 #include "base/strings/utf_string_conversions.h"
-#include "ui/aura/client/tooltip_client.h"
 #include "ui/aura/env.h"
 #include "ui/aura/test/event_generator.h"
 #include "ui/aura/window.h"
@@ -17,6 +16,7 @@
 #include "ui/views/corewm/tooltip_controller_test_helper.h"
 #include "ui/views/view.h"
 #include "ui/views/widget/widget.h"
+#include "ui/wm/public/tooltip_client.h"
 
 using views::corewm::TooltipController;
 using views::corewm::test::TooltipTestView;
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc
index 4911483..354e99e 100644
--- a/ash/wm/default_state.cc
+++ b/ash/wm/default_state.cc
@@ -31,7 +31,7 @@
 
 bool IsPanel(aura::Window* window) {
   return window->parent() &&
-      window->parent()->id() == internal::kShellWindowId_DockedContainer;
+      window->parent()->id() == internal::kShellWindowId_PanelContainer;
 }
 
 void MoveToDisplayForRestore(WindowState* window_state) {
@@ -128,87 +128,30 @@
     return;
   }
 
-  if (current != next_state_type) {
-    state_type_ = next_state_type;
-    window_state->UpdateWindowShowStateFromStateType();
-    window_state->NotifyPreStateTypeChange(current);
-    // TODO(oshima): Make docked window a state.
-    if (window_state->IsSnapped() ||
-        (!window_state->IsDocked() && !IsPanel(window_state->window()))) {
-      UpdateBounds(window_state, current);
-    }
-    window_state->NotifyPostStateTypeChange(current);
-  }
+  EnterToNextState(window_state, next_state_type);
 }
 
 WindowStateType DefaultState::GetType() const {
   return state_type_;
 }
 
-void DefaultState::AttachState(WindowState* window_state,
-                               WindowState::State* previous_state) {
+void DefaultState::AttachState(
+    WindowState* window_state,
+    WindowState::State* state_in_previous_mode) {
   DCHECK_EQ(stored_window_state_, window_state);
-  WindowStateType old_state_type = state_type_;
-  state_type_ = previous_state->GetType();
 
-  // Forget our restore sizes when the workspace size has changed.
-  bool workspace_unchanged = stored_workspace_size_ ==
-      window_state->window()->parent()->bounds().size();
+  ReenterToCurrentState(window_state, state_in_previous_mode);
 
-  // Set the restore bounds to be the previous bounds - this might be required
-  // for some state transitions like restore, so that the animations are sound.
-  if (!stored_bounds_.IsEmpty() && workspace_unchanged)
-    window_state->SetRestoreBoundsInParent(stored_bounds_);
-  else
-    window_state->ClearRestoreBounds();
-
-  if (old_state_type != state_type_) {
-    wm::WMEventType type = wm::WM_EVENT_NORMAL;
-    switch (old_state_type) {
-      case wm::WINDOW_STATE_TYPE_DEFAULT:
-      case wm::WINDOW_STATE_TYPE_AUTO_POSITIONED:
-      case wm::WINDOW_STATE_TYPE_NORMAL:
-      case wm::WINDOW_STATE_TYPE_DETACHED:
-      case wm::WINDOW_STATE_TYPE_END:
-        break;
-      case wm::WINDOW_STATE_TYPE_MINIMIZED:
-        type = wm::WM_EVENT_MINIMIZE;
-        break;
-      case wm::WINDOW_STATE_TYPE_MAXIMIZED:
-        type = wm::WM_EVENT_MAXIMIZE;
-        break;
-      case wm::WINDOW_STATE_TYPE_INACTIVE:
-        type = wm::WM_EVENT_SHOW_INACTIVE;
-        break;
-      case wm::WINDOW_STATE_TYPE_FULLSCREEN:
-        type = wm::WM_EVENT_TOGGLE_FULLSCREEN;
-        break;
-      case wm::WINDOW_STATE_TYPE_LEFT_SNAPPED:
-        type = wm::WM_EVENT_SNAP_LEFT;
-        break;
-      case wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED:
-        type = wm::WM_EVENT_SNAP_RIGHT;
-        break;
-    }
-    wm::WMEvent event(type);
+  // If the display has changed while in the another mode,
+  // we need to let windows know the change.
+  gfx::Display current_display = Shell::GetScreen()->
+      GetDisplayNearestWindow(window_state->window());
+  if (stored_display_state_.bounds() != current_display.bounds()) {
+    const WMEvent event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED);
     window_state->OnWMEvent(&event);
-  }
-
-  if (workspace_unchanged) {
-    // If the bounds are not yet set and valid we restore them.
-    if (!stored_bounds_.IsEmpty() &&
-        stored_bounds_ != window_state->window()->bounds()) {
-      if (state_type_ == wm::WINDOW_STATE_TYPE_MINIMIZED)
-        window_state->SetBoundsDirect(stored_bounds_);
-      else
-        window_state->SetBoundsDirectAnimated(stored_bounds_);
-    }
-
-    // Then restore the restore bounds to their previous value.
-    if (!stored_restore_bounds_.IsEmpty())
-      window_state->SetRestoreBoundsInParent(stored_restore_bounds_);
-    else
-      window_state->ClearRestoreBounds();
+  } else if (stored_display_state_.work_area() != current_display.work_area()) {
+    const WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
+    window_state->OnWMEvent(&event);
   }
 }
 
@@ -218,10 +161,12 @@
   stored_bounds_ = window->bounds();
   stored_restore_bounds_ = window_state->HasRestoreBounds() ?
       window_state->GetRestoreBoundsInParent() : gfx::Rect();
-  // If the container size for this window has changed we need to restore the
-  // proper location of the window within the container. Note that this might
-  // not be the same as the screen resolution.
-  stored_workspace_size_ = window_state->window()->parent()->bounds().size();
+  // Remember the display state so that in case of the display change
+  // while in the other mode, we can perform necessary action to
+  // restore the window state to the proper state for the current
+  // display.
+  stored_display_state_ = Shell::GetScreen()->
+      GetDisplayNearestWindow(window_state->window());
 }
 
 // static
@@ -439,44 +384,125 @@
 }
 
 // static
-void DefaultState::UpdateBounds(WindowState* window_state,
-                                WindowStateType old_state_type) {
-  aura::Window* window = window_state->window();
-  // Do nothing If this is not yet added to the container.
-  if (!window->parent())
+bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) {
+  DCHECK(!window_state->is_dragged());
+  if (window_state->IsMaximized()) {
+    window_state->SetBoundsDirect(
+        ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->window()));
+    return true;
+  }
+  if (window_state->IsFullscreen()) {
+    window_state->SetBoundsDirect(
+        ScreenUtil::GetDisplayBoundsInParent(window_state->window()));
+    return true;
+  }
+  return false;
+}
+
+// static
+void DefaultState::SetBounds(WindowState* window_state,
+                             const SetBoundsEvent* event) {
+  if (window_state->is_dragged()) {
+    window_state->SetBoundsDirect(event->requested_bounds());
+  } else if (window_state->IsSnapped()) {
+    gfx::Rect work_area_in_parent =
+        ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
+    gfx::Rect child_bounds(event->requested_bounds());
+    AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds);
+    window_state->AdjustSnappedBounds(&child_bounds);
+    window_state->SetBoundsDirect(child_bounds);
+  } else if (!SetMaximizedOrFullscreenBounds(window_state)) {
+    window_state->SetBoundsConstrained(event->requested_bounds());
+  }
+}
+
+void DefaultState::EnterToNextState(WindowState* window_state,
+                                    WindowStateType next_state_type) {
+  // Do nothing if  we're already in the same state.
+  if (state_type_ == next_state_type)
     return;
 
-  if (!window_state->HasRestoreBounds() &&
-      (old_state_type == WINDOW_STATE_TYPE_DEFAULT ||
-       old_state_type == WINDOW_STATE_TYPE_NORMAL) &&
-      !window_state->IsMinimized() &&
-      !window_state->IsNormalStateType()) {
-    window_state->SaveCurrentBoundsForRestore();
+  WindowStateType previous_state_type = state_type_;
+  state_type_ = next_state_type;
+
+  window_state->UpdateWindowShowStateFromStateType();
+  window_state->NotifyPreStateTypeChange(previous_state_type);
+
+  // This Docked/Snapped hack is due to the issue that IsDocked returns
+  // true for dragging window.  TODO(oshima): Make docked window a state
+  // and remove this hack.
+  if (window_state->window()->parent() &&
+      (window_state->IsSnapped() ||
+       (!window_state->IsDocked() && !IsPanel(window_state->window())))) {
+    if (!window_state->HasRestoreBounds() &&
+        (previous_state_type == WINDOW_STATE_TYPE_DEFAULT ||
+         previous_state_type == WINDOW_STATE_TYPE_NORMAL) &&
+        !window_state->IsMinimized() &&
+        !window_state->IsNormalStateType()) {
+      window_state->SaveCurrentBoundsForRestore();
+    }
+
+    // When restoring from a minimized state, we want to restore to the previous
+    // bounds. However, we want to maintain the restore bounds. (The restore
+    // bounds are set if a user maximized the window in one axis by double
+    // clicking the window border for example).
+    gfx::Rect restore_bounds_in_screen;
+    if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED &&
+        window_state->IsNormalStateType() &&
+        window_state->HasRestoreBounds() &&
+        !window_state->unminimize_to_restore_bounds()) {
+      restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen();
+      window_state->SaveCurrentBoundsForRestore();
+    }
+
+    if (window_state->IsMaximizedOrFullscreen())
+      MoveToDisplayForRestore(window_state);
+
+    UpdateBoundsFromState(window_state, previous_state_type);
+
+    // Normal state should have no restore bounds unless it's
+    // unminimzied.
+    if (!restore_bounds_in_screen.IsEmpty())
+      window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
+    else if (window_state->IsNormalStateType())
+      window_state->ClearRestoreBounds();
+  }
+  window_state->NotifyPostStateTypeChange(previous_state_type);
+}
+
+void DefaultState::ReenterToCurrentState(
+    WindowState* window_state,
+    WindowState::State* state_in_previous_mode) {
+  WindowStateType previous_state_type = state_in_previous_mode->GetType();
+  window_state->UpdateWindowShowStateFromStateType();
+  window_state->NotifyPreStateTypeChange(previous_state_type);
+
+  if (state_type_ == wm::WINDOW_STATE_TYPE_NORMAL ||
+      state_type_ == wm::WINDOW_STATE_TYPE_DEFAULT) {
+    // Use the restore mechanism to set the bounds for
+    // the window in normal state. This also covers unminimize case.
+    window_state->SetRestoreBoundsInParent(stored_bounds_);
   }
 
-  // When restoring from a minimized state, we want to restore to the previous
-  // bounds. However, we want to maintain the restore bounds. (The restore
-  // bounds are set if a user maximized the window in one axis by double
-  // clicking the window border for example).
-  gfx::Rect restore_bounds_in_screen;
-  if (old_state_type == WINDOW_STATE_TYPE_MINIMIZED &&
-      window_state->IsNormalStateType() &&
-      window_state->HasRestoreBounds() &&
-      !window_state->unminimize_to_restore_bounds()) {
-    restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen();
-    window_state->SaveCurrentBoundsForRestore();
-  }
+  UpdateBoundsFromState(window_state, state_in_previous_mode->GetType());
 
-  if (window_state->IsMaximizedOrFullscreen())
-    MoveToDisplayForRestore(window_state);
+  // Then restore the restore bounds to their previous value.
+  if (!stored_restore_bounds_.IsEmpty())
+    window_state->SetRestoreBoundsInParent(stored_restore_bounds_);
+  else
+    window_state->ClearRestoreBounds();
 
-  WindowStateType state_type = window_state->GetStateType();
+  window_state->NotifyPostStateTypeChange(previous_state_type);
+}
+
+void DefaultState::UpdateBoundsFromState(WindowState* window_state,
+                                         WindowStateType previous_state_type) {
+  aura::Window* window = window_state->window();
   gfx::Rect bounds_in_parent;
-
-  switch (state_type) {
+  switch (state_type_) {
     case WINDOW_STATE_TYPE_LEFT_SNAPPED:
     case WINDOW_STATE_TYPE_RIGHT_SNAPPED:
-      bounds_in_parent = state_type == WINDOW_STATE_TYPE_LEFT_SNAPPED ?
+      bounds_in_parent = state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED ?
           GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
           GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
       break;
@@ -510,12 +536,12 @@
       return;
   }
 
-  if (state_type != WINDOW_STATE_TYPE_MINIMIZED) {
-    if (old_state_type == WINDOW_STATE_TYPE_MINIMIZED ||
+  if (state_type_ != WINDOW_STATE_TYPE_MINIMIZED) {
+    if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED ||
         window_state->IsFullscreen()) {
       window_state->SetBoundsDirect(bounds_in_parent);
     } else if (window_state->IsMaximized() ||
-               IsMaximizedOrFullscreenWindowStateType(old_state_type)) {
+               IsMaximizedOrFullscreenWindowStateType(previous_state_type)) {
       window_state->SetBoundsDirectCrossFade(bounds_in_parent);
     } else if (window_state->is_dragged()) {
       // SetBoundsDirectAnimated does not work when the window gets reparented.
@@ -529,7 +555,7 @@
   if (window_state->IsMinimized()) {
     // Save the previous show state so that we can correctly restore it.
     window_state->window()->SetProperty(aura::client::kRestoreShowStateKey,
-                                        ToWindowShowState(old_state_type));
+                                        ToWindowShowState(previous_state_type));
     ::wm::SetWindowVisibilityAnimationType(
         window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
 
@@ -539,57 +565,16 @@
     if (window_state->IsActive())
       window_state->Deactivate();
   } else if ((window_state->window()->TargetVisibility() ||
-              old_state_type == WINDOW_STATE_TYPE_MINIMIZED) &&
+              previous_state_type == WINDOW_STATE_TYPE_MINIMIZED) &&
              !window_state->window()->layer()->visible()) {
     // The layer may be hidden if the window was previously minimized. Make
     // sure it's visible.
     window_state->window()->Show();
-    if (old_state_type == WINDOW_STATE_TYPE_MINIMIZED &&
+    if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED &&
         !window_state->IsMaximizedOrFullscreen()) {
       window_state->set_unminimize_to_restore_bounds(false);
     }
   }
-
-  if (window_state->IsNormalStateType())
-    window_state->ClearRestoreBounds();
-
-  // Set the restore rectangle to the previously set restore rectangle.
-  if (!restore_bounds_in_screen.IsEmpty())
-    window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
-}
-
-// static
-bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) {
-  DCHECK(!window_state->is_dragged());
-  if (window_state->IsMaximized()) {
-    window_state->SetBoundsDirect(
-        ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->window()));
-    return true;
-  }
-  if (window_state->IsFullscreen()) {
-    window_state->SetBoundsDirect(
-        ScreenUtil::GetDisplayBoundsInParent(window_state->window()));
-    return true;
-  }
-  return false;
-}
-
-// static
-void DefaultState::SetBounds(WindowState* window_state,
-                             const SetBoundsEvent* event) {
-
-  if (window_state->is_dragged()) {
-    window_state->SetBoundsDirect(event->requested_bounds());
-  } else if (window_state->IsSnapped()) {
-    gfx::Rect work_area_in_parent =
-        ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
-    gfx::Rect child_bounds(event->requested_bounds());
-    AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds);
-    window_state->AdjustSnappedBounds(&child_bounds);
-    window_state->SetBoundsDirect(child_bounds);
-  } else if (!SetMaximizedOrFullscreenBounds(window_state)) {
-    window_state->SetBoundsConstrained(event->requested_bounds());
-  }
 }
 
 // static
@@ -612,6 +597,8 @@
     center_in_parent.ClampToCenteredSize(window->bounds().size());
     window_state->SetBoundsDirectAnimated(center_in_parent);
   }
+  // Centering window is treated as if a user moved and resized the window.
+  window_state->set_bounds_changed_by_user(true);
 }
 
 }  // namespace wm
diff --git a/ash/wm/default_state.h b/ash/wm/default_state.h
index cfab381..ccee0f8 100644
--- a/ash/wm/default_state.h
+++ b/ash/wm/default_state.h
@@ -6,6 +6,7 @@
 #define ASH_WM_DEFAULT_STATE_H_
 
 #include "ash/wm/window_state.h"
+#include "ui/gfx/display.h"
 
 namespace ash {
 namespace wm {
@@ -35,10 +36,6 @@
   static bool ProcessWorkspaceEvents(WindowState* window_state,
                                      const WMEvent* event);
 
-  // Animates to new window bounds based on the current and previous state type.
-  static void UpdateBounds(wm::WindowState* window_state,
-                           wm::WindowStateType old_state_type);
-
   // Set the fullscreen/maximized bounds without animation.
   static bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state);
 
@@ -47,6 +44,21 @@
 
   static void CenterWindow(WindowState* window_state);
 
+  // Enters next state. This is used when the state moves from one to another
+  // within the same desktop mode.
+  void EnterToNextState(wm::WindowState* window_state,
+                        wm::WindowStateType next_state_type);
+
+  // Reenters the current state. This is called when migrating from
+  // previous desktop mode, and the window's state needs to re-construct the
+  // state/bounds for this state.
+  void ReenterToCurrentState(wm::WindowState* window_state,
+                             wm::WindowState::State* state_in_previous_mode);
+
+  // Animates to new window bounds based on the current and previous state type.
+  void UpdateBoundsFromState(wm::WindowState* window_state,
+                             wm::WindowStateType old_state_type);
+
   // The current type of the window.
   WindowStateType state_type_;
 
@@ -54,9 +66,8 @@
   gfx::Rect stored_bounds_;
   gfx::Rect stored_restore_bounds_;
 
-  // The size of the workspace when the mode got started. If it differs from
-  // the current values the bounds will get ignored.
-  gfx::Size stored_workspace_size_;
+  // The display state in which the mode got started.
+  gfx::Display stored_display_state_;
 
   // The window state only gets remembered for DCHECK reasons.
   WindowState* stored_window_state_;
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index 63ad210..04273e1 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -26,7 +26,6 @@
 #include "grit/ash_resources.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "third_party/skia/include/core/SkPaint.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/client/window_tree_client.h"
 #include "ui/aura/window.h"
@@ -39,6 +38,7 @@
 #include "ui/gfx/rect.h"
 #include "ui/views/background.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace internal {
diff --git a/ash/wm/dock/docked_window_layout_manager.h b/ash/wm/dock/docked_window_layout_manager.h
index 974be11..18569d8 100644
--- a/ash/wm/dock/docked_window_layout_manager.h
+++ b/ash/wm/dock/docked_window_layout_manager.h
@@ -18,12 +18,12 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
 #include "base/time/time.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/layout_manager.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_observer.h"
 #include "ui/gfx/rect.h"
 #include "ui/keyboard/keyboard_controller_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 class Window;
diff --git a/ash/wm/drag_details.h b/ash/wm/drag_details.h
index 2d3bed4..d8f7d6e 100644
--- a/ash/wm/drag_details.h
+++ b/ash/wm/drag_details.h
@@ -9,8 +9,8 @@
 #include "ash/wm/wm_types.h"
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/window_move_client.h"
 #include "ui/gfx/rect.h"
+#include "ui/wm/public/window_move_client.h"
 
 namespace aura {
 class Window;
diff --git a/ash/wm/immersive_fullscreen_controller.cc b/ash/wm/immersive_fullscreen_controller.cc
index 976eaae..b8c721c 100644
--- a/ash/wm/immersive_fullscreen_controller.cc
+++ b/ash/wm/immersive_fullscreen_controller.cc
@@ -11,7 +11,6 @@
 #include "ash/wm/resize_handle_window_targeter.h"
 #include "ash/wm/window_state.h"
 #include "base/metrics/histogram.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/aura_constants.h"
 #include "ui/aura/client/capture_client.h"
 #include "ui/aura/client/cursor_client.h"
@@ -29,6 +28,7 @@
 #include "ui/views/widget/widget.h"
 #include "ui/wm/core/transient_window_manager.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
 
 using views::View;
 
@@ -62,6 +62,13 @@
 // See ShouldIgnoreMouseEventAtLocation() for more details.
 const int kHeightOfDeadRegionAboveTopContainer = 10;
 
+// The height in pixels of the region below the top edge of the display in which
+// the mouse can trigger revealing the top-of-window views. The height must be
+// greater than 1px because the top pixel is used to trigger moving the cursor
+// between displays if the user has a vertical display layout (primary display
+// above/below secondary display).
+const int kMouseRevealBoundsHeight = 3;
+
 // Returns the BubbleDelegateView corresponding to |maybe_bubble| if
 // |maybe_bubble| is a bubble.
 views::BubbleDelegateView* AsBubbleDelegate(aura::Window* maybe_bubble) {
@@ -104,20 +111,6 @@
 
 }  // namespace
 
-// The height in pixels of the region below the top edge of the display in which
-// the mouse can trigger revealing the top-of-window views.
-#if defined(OS_WIN)
-// Windows 8 reserves some pixels at the top of the screen for the hand icon
-// that allows you to drag a metro app off the screen, so a few additional
-// pixels of space must be reserved for the mouse reveal.
-const int ImmersiveFullscreenController::kMouseRevealBoundsHeight = 9;
-#else
-// The height must be greater than 1px because the top pixel is used to trigger
-// moving the cursor between displays if the user has a vertical display layout
-// (primary display above/below secondary display).
-const int ImmersiveFullscreenController::kMouseRevealBoundsHeight = 3;
-#endif
-
 ////////////////////////////////////////////////////////////////////////////////
 
 // Class which keeps the top-of-window views revealed as long as one of the
@@ -404,12 +397,6 @@
     return;
 
   switch (event->type()) {
-#if defined(OS_WIN)
-    case ui::ET_GESTURE_WIN8_EDGE_SWIPE:
-      UpdateRevealedLocksForSwipe(GetSwipeType(event));
-      event->SetHandled();
-      break;
-#endif
     case ui::ET_GESTURE_SCROLL_BEGIN:
       if (ShouldHandleGestureEvent(GetEventLocationInScreen(*event))) {
         gesture_begun_ = true;
@@ -863,10 +850,6 @@
 
 ImmersiveFullscreenController::SwipeType
 ImmersiveFullscreenController::GetSwipeType(ui::GestureEvent* event) const {
-#if defined(OS_WIN)
-  if (event->type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE)
-    return SWIPE_OPEN;
-#endif
   if (event->type() != ui::ET_GESTURE_SCROLL_UPDATE)
     return SWIPE_NONE;
   // Make sure that it is a clear vertical gesture.
diff --git a/ash/wm/immersive_fullscreen_controller.h b/ash/wm/immersive_fullscreen_controller.h
index 4f0b20b..b98b32f 100644
--- a/ash/wm/immersive_fullscreen_controller.h
+++ b/ash/wm/immersive_fullscreen_controller.h
@@ -46,8 +46,6 @@
       public views::WidgetObserver,
       public ImmersiveRevealedLock::Delegate {
  public:
-  static const int kMouseRevealBoundsHeight;
-
   // The enum is used for an enumerated histogram. New items should be only
   // added to the end.
   enum WindowType {
diff --git a/ash/wm/immersive_fullscreen_controller_unittest.cc b/ash/wm/immersive_fullscreen_controller_unittest.cc
index ca21e23..4693ef5 100644
--- a/ash/wm/immersive_fullscreen_controller_unittest.cc
+++ b/ash/wm/immersive_fullscreen_controller_unittest.cc
@@ -25,6 +25,9 @@
 #include "ui/views/view.h"
 #include "ui/views/widget/widget.h"
 
+// For now, immersive fullscreen is Chrome OS only.
+#if defined(OS_CHROMEOS)
+
 namespace ash {
 
 namespace {
@@ -343,6 +346,12 @@
 // Test mouse event processing for top-of-screen reveal triggering.
 TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) {
   // Set up initial state.
+  UpdateDisplay("800x600,800x600");
+  ash::DisplayLayout display_layout(ash::DisplayLayout::RIGHT, 0);
+  ash::Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
+      display_layout);
+
+  // Set up initial state.
   SetEnabled(true);
   ASSERT_TRUE(controller()->IsEnabled());
   ASSERT_FALSE(controller()->IsRevealed());
@@ -369,8 +378,7 @@
 
   // Moving |ImmersiveFullscreenControllerTest::kMouseRevealBoundsHeight| down
   // from the top edge stops it.
-  event_generator.MoveMouseBy(0,
-      ImmersiveFullscreenController::kMouseRevealBoundsHeight);
+  event_generator.MoveMouseBy(0, 3);
   EXPECT_FALSE(top_edge_hover_timer_running());
 
   // Moving back to the top starts the timer again.
@@ -671,16 +679,7 @@
 }
 
 // Test when the SWIPE_CLOSE edge gesture closes the top-of-window views.
-#if defined(OS_WIN)
-// On Windows, touch events do not result in mouse events being disabled.  As
-// a result, the last part of this test which ends the reveal via a gesture will
-// not work correctly.  See crbug.com/332430, and the function
-// ShouldHideCursorOnTouch() in compound_event_filter.cc.
-#define MAYBE_EndRevealViaGesture DISABLED_EndRevealViaGesture
-#else
-#define MAYBE_EndRevealViaGesture EndRevealViaGesture
-#endif
-TEST_F(ImmersiveFullscreenControllerTest, MAYBE_EndRevealViaGesture) {
+TEST_F(ImmersiveFullscreenControllerTest, EndRevealViaGesture) {
   SetEnabled(true);
   EXPECT_TRUE(controller()->IsEnabled());
   EXPECT_FALSE(controller()->IsRevealed());
@@ -1055,3 +1054,5 @@
 }
 
 }  // namespase ash
+
+#endif  // defined(OS_CHROMEOS)
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc
index fd49ef1..b950fe1 100644
--- a/ash/wm/lock_state_controller_unittest.cc
+++ b/ash/wm/lock_state_controller_unittest.cc
@@ -25,7 +25,7 @@
 #include "ui/gfx/rect.h"
 #include "ui/gfx/size.h"
 
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
 #include "ui/display/chromeos/output_configurator.h"
 #include "ui/display/chromeos/test/test_display_snapshot.h"
 #include "ui/display/display_constants.h"
diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
index f2ee161..82b07d7 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
@@ -65,11 +65,10 @@
 
   // Resize our desktop.
   void ResizeDesktop(int width_delta) {
-    aura::Window* container = Shell::GetContainer(
-        Shell::GetPrimaryRootWindow(), kSwitchableWindowContainerIds[0]);
-    gfx::Rect bounds = container->bounds();
-    bounds.set_width(bounds.width() - width_delta);
-    container->SetBounds(bounds);
+    gfx::Size size = Shell::GetScreen()->GetDisplayNearestWindow(
+        Shell::GetPrimaryRootWindow()).size();
+    size.Enlarge(0, width_delta);
+    UpdateDisplay(size.ToString());
   }
 
  private:
@@ -356,31 +355,39 @@
 // Check that resizing the desktop does reposition unmaximizable & managed
 // windows.
 TEST_F(MaximizeModeWindowManagerTest, DesktopSizeChangeMovesUnmaximizable) {
-  gfx::Rect rect(20, 140, 100, 100);
-  scoped_ptr<aura::Window> window(
+  UpdateDisplay("400x400");
+  // This window will move because it does not fit the new bounds.
+  gfx::Rect rect(20, 300, 100, 100);
+  scoped_ptr<aura::Window> window1(
       CreateNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
-  EXPECT_EQ(rect.ToString(), window->bounds().ToString());
+  EXPECT_EQ(rect.ToString(), window1->bounds().ToString());
+
+  // This window will not move because it does fit the new bounds.
+  gfx::Rect rect2(20, 140, 100, 100);
+  scoped_ptr<aura::Window> window2(
+      CreateNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect2));
 
   // Turning on the manager will reposition (but not resize) the window.
   ash::internal::MaximizeModeWindowManager* manager =
       CreateMaximizeModeWindowManager();
   ASSERT_TRUE(manager);
-  EXPECT_EQ(1, manager->GetNumberOfManagedWindows());
-  gfx::Rect moved_bounds(window->bounds());
+  EXPECT_EQ(2, manager->GetNumberOfManagedWindows());
+  gfx::Rect moved_bounds(window1->bounds());
   EXPECT_NE(rect.origin().ToString(), moved_bounds.origin().ToString());
   EXPECT_EQ(rect.size().ToString(), moved_bounds.size().ToString());
 
   // Simulating a desktop resize should move the window again.
-  ResizeDesktop(-10);
-  gfx::Rect new_moved_bounds(window->bounds());
+  UpdateDisplay("300x300");
+  gfx::Rect new_moved_bounds(window1->bounds());
   EXPECT_NE(rect.origin().ToString(), new_moved_bounds.origin().ToString());
   EXPECT_EQ(rect.size().ToString(), new_moved_bounds.size().ToString());
   EXPECT_NE(moved_bounds.origin().ToString(), new_moved_bounds.ToString());
 
   // Turning off the mode should not restore to the initial coordinates since
-  // the new resolution is different.
+  // the new resolution is smaller and the window was on the edge.
   DestroyMaximizeModeWindowManager();
-  EXPECT_NE(rect.ToString(), window->bounds().ToString());
+  EXPECT_NE(rect.ToString(), window1->bounds().ToString());
+  EXPECT_EQ(rect2.ToString(), window2->bounds().ToString());
 }
 
 // Check that windows return to original location if desktop size changes to
diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc
index 8e211b3..419fed5 100644
--- a/ash/wm/mru_window_tracker.cc
+++ b/ash/wm/mru_window_tracker.cc
@@ -13,10 +13,10 @@
 #include "ash/wm/window_state.h"
 #include "ash/wm/window_util.h"
 #include "ash/wm/workspace_controller.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/events/event.h"
 #include "ui/events/event_handler.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 
diff --git a/ash/wm/mru_window_tracker.h b/ash/wm/mru_window_tracker.h
index 2c2a5ea..78a42c3 100644
--- a/ash/wm/mru_window_tracker.h
+++ b/ash/wm/mru_window_tracker.h
@@ -11,8 +11,8 @@
 #include "ash/ash_export.h"
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/window_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 class RootWindow;
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index c36be04..15bdf3f 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -19,7 +19,6 @@
 #include "base/command_line.h"
 #include "base/metrics/histogram.h"
 #include "base/strings/string_number_conversions.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
@@ -27,6 +26,7 @@
 #include "ui/events/event.h"
 #include "ui/events/event_handler.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 
diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h
index d54e7ee..d34c901 100644
--- a/ash/wm/overview/window_selector.h
+++ b/ash/wm/overview/window_selector.h
@@ -13,8 +13,8 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/time/time.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/window_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 class RootWindow;
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index d3edb7a..f78bcbf 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -24,7 +24,6 @@
 #include "base/memory/scoped_vector.h"
 #include "base/run_loop.h"
 #include "base/strings/utf_string_conversions.h"
-#include "ui/aura/client/activation_delegate.h"
 #include "ui/aura/client/aura_constants.h"
 #include "ui/aura/client/cursor_client.h"
 #include "ui/aura/client/focus_client.h"
@@ -37,6 +36,7 @@
 #include "ui/gfx/rect_conversions.h"
 #include "ui/gfx/transform.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_delegate.h"
 
 namespace ash {
 namespace internal {
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index 64b04c0..95db257 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -23,7 +23,6 @@
 #include "third_party/skia/include/core/SkColor.h"
 #include "third_party/skia/include/core/SkPaint.h"
 #include "third_party/skia/include/core/SkPath.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/client/window_tree_client.h"
 #include "ui/aura/window.h"
@@ -35,6 +34,7 @@
 #include "ui/gfx/vector2d.h"
 #include "ui/views/background.h"
 #include "ui/views/widget/widget.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace internal {
@@ -371,7 +371,6 @@
     panel_info.slide_in = true;
   }
   panel_windows_.push_back(panel_info);
-  child->AddObserver(this);
   wm::GetWindowState(child)->AddObserver(this);
   Relayout();
 }
@@ -388,7 +387,6 @@
     delete found->callout_widget;
     panel_windows_.erase(found);
   }
-  child->RemoveObserver(this);
   wm::GetWindowState(child)->RemoveObserver(this);
 
   if (dragged_panel_ == child)
@@ -402,6 +400,8 @@
 
 void PanelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
                                                         bool visible) {
+  if (visible)
+    wm::GetWindowState(child)->Restore();
   Relayout();
 }
 
@@ -481,12 +481,6 @@
     RestorePanel(window_state->window());
 }
 
-void PanelLayoutManager::OnWindowVisibilityChanged(
-    aura::Window* window, bool visible) {
-  if (visible)
-    wm::GetWindowState(window)->Restore();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // PanelLayoutManager, aura::client::ActivationChangeObserver implementation:
 
diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h
index aff6d58..2d17b2d 100644
--- a/ash/wm/panels/panel_layout_manager.h
+++ b/ash/wm/panels/panel_layout_manager.h
@@ -17,11 +17,10 @@
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/layout_manager.h"
-#include "ui/aura/window_observer.h"
 #include "ui/keyboard/keyboard_controller.h"
 #include "ui/keyboard/keyboard_controller_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 class Window;
@@ -56,7 +55,6 @@
     : public aura::LayoutManager,
       public ShelfIconObserver,
       public ShellObserver,
-      public aura::WindowObserver,
       public aura::client::ActivationChangeObserver,
       public keyboard::KeyboardControllerObserver,
       public DisplayController::Observer,
@@ -101,10 +99,6 @@
       wm::WindowState* window_state,
       wm::WindowStateType old_type) OVERRIDE;
 
-  // Overridden from aura::WindowObserver
-  virtual void OnWindowVisibilityChanged(aura::Window* window,
-                                         bool visible) OVERRIDE;
-
   // Overridden from aura::client::ActivationChangeObserver
   virtual void OnWindowActivated(aura::Window* gained_active,
                                  aura::Window* lost_active) OVERRIDE;
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc
index c2d63f9..a380392 100644
--- a/ash/wm/power_button_controller.cc
+++ b/ash/wm/power_button_controller.cc
@@ -27,13 +27,13 @@
           CommandLine::ForCurrentProcess()->HasSwitch(
               switches::kAuraLegacyPowerButton)),
       controller_(controller) {
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   Shell::GetInstance()->output_configurator()->AddObserver(this);
 #endif
 }
 
 PowerButtonController::~PowerButtonController() {
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   Shell::GetInstance()->output_configurator()->RemoveObserver(this);
 #endif
 }
@@ -116,7 +116,7 @@
     controller_->CancelLockAnimation();
 }
 
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
 void PowerButtonController::OnDisplayModeChanged(
     const ui::OutputConfigurator::DisplayStateList& outputs) {
   bool internal_display_off = false;
diff --git a/ash/wm/power_button_controller.h b/ash/wm/power_button_controller.h
index f2ab809..d32b3ab 100644
--- a/ash/wm/power_button_controller.h
+++ b/ash/wm/power_button_controller.h
@@ -9,7 +9,7 @@
 #include "ash/wm/session_state_animator.h"
 #include "base/basictypes.h"
 
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
 #include "ui/display/chromeos/output_configurator.h"
 #endif
 
@@ -35,7 +35,7 @@
 class ASH_EXPORT PowerButtonController
 // TODO(derat): Remove these ifdefs after OutputConfigurator becomes
 // cross-platform.
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
     : public ui::OutputConfigurator::Observer
 #endif
       {
@@ -54,7 +54,7 @@
   void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp);
   void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp);
 
-#if defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
   // Overriden from ui::OutputConfigurator::Observer:
   virtual void OnDisplayModeChanged(
       const ui::OutputConfigurator::DisplayStateList& outputs) OVERRIDE;
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc
index 2499726..1c31832 100644
--- a/ash/wm/system_gesture_event_filter.cc
+++ b/ash/wm/system_gesture_event_filter.cc
@@ -65,9 +65,7 @@
 
   if (event->type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE &&
       shelf_gesture_handler_->ProcessGestureEvent(*event)) {
-    // Do not stop propagation, since the immersive fullscreen controller may
-    // need to handle this event.
-    return;
+    event->StopPropagation();
   }
 }
 
diff --git a/ash/wm/toplevel_window_event_handler.h b/ash/wm/toplevel_window_event_handler.h
index 4998f4b..5d9caf8 100644
--- a/ash/wm/toplevel_window_event_handler.h
+++ b/ash/wm/toplevel_window_event_handler.h
@@ -13,10 +13,10 @@
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/window_move_client.h"
 #include "ui/events/event_handler.h"
 #include "ui/gfx/point.h"
 #include "ui/gfx/rect.h"
+#include "ui/wm/public/window_move_client.h"
 
 namespace aura {
 class Window;
diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc
index 437a519..a387067 100644
--- a/ash/wm/toplevel_window_event_handler_unittest.cc
+++ b/ash/wm/toplevel_window_event_handler_unittest.cc
@@ -18,7 +18,6 @@
 #include "base/compiler_specific.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/aura/client/aura_constants.h"
-#include "ui/aura/client/window_move_client.h"
 #include "ui/aura/test/aura_test_base.h"
 #include "ui/aura/test/event_generator.h"
 #include "ui/aura/test/test_window_delegate.h"
@@ -27,6 +26,7 @@
 #include "ui/events/event.h"
 #include "ui/gfx/screen.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/window_move_client.h"
 
 #if defined(OS_WIN)
 // Windows headers define macros for these function names which screw with us.
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index e69b94b..109aa1b 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -304,7 +304,8 @@
     // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
     layer_owner_->root()->GetAnimator()->StopAnimating();
   }
-  virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE {
+  virtual void OnWindowRemovingFromRootWindow(aura::Window* window,
+                                              aura::Window* new_root) OVERRIDE {
     layer_owner_->root()->GetAnimator()->StopAnimating();
   }
 
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index b940474..92d2fdf 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -8,8 +8,6 @@
 #include "ash/test/shell_test_api.h"
 #include "ash/test/test_activation_delegate.h"
 #include "ash/wm/window_util.h"
-#include "ui/aura/client/activation_client.h"
-#include "ui/aura/client/activation_delegate.h"
 #include "ui/aura/client/cursor_client_observer.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/env.h"
@@ -26,6 +24,8 @@
 #include "ui/gfx/screen.h"
 #include "ui/wm/core/compound_event_filter.h"
 #include "ui/wm/core/input_method_event_filter.h"
+#include "ui/wm/public/activation_client.h"
+#include "ui/wm/public/activation_delegate.h"
 
 namespace {
 
diff --git a/ash/wm/window_resizer.h b/ash/wm/window_resizer.h
index 278d199..21cfd52 100644
--- a/ash/wm/window_resizer.h
+++ b/ash/wm/window_resizer.h
@@ -10,8 +10,8 @@
 #include "ash/wm/window_state.h"
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/window_move_client.h"
 #include "ui/gfx/rect.h"
+#include "ui/wm/public/window_move_client.h"
 
 namespace aura {
 class Window;
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index e3263a0..906c885 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -12,7 +12,6 @@
 #include "ash/wm/window_properties.h"
 #include "ash/wm/window_state.h"
 #include "ash/wm/wm_event.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/aura_constants.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_delegate.h"
@@ -24,6 +23,7 @@
 #include "ui/views/view.h"
 #include "ui/views/widget/widget.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace wm {
diff --git a/ash/wm/window_util_unittest.cc b/ash/wm/window_util_unittest.cc
index 5445793..9c10cf1 100644
--- a/ash/wm/window_util_unittest.cc
+++ b/ash/wm/window_util_unittest.cc
@@ -6,6 +6,7 @@
 
 #include "ash/screen_util.h"
 #include "ash/test/ash_test_base.h"
+#include "ash/wm/window_state.h"
 #include "ui/aura/window.h"
 
 namespace ash {
@@ -29,7 +30,13 @@
   UpdateDisplay("500x400, 600x400");
   scoped_ptr<aura::Window> window(
       CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100)));
+
+  wm::WindowState* window_state = wm::GetWindowState(window.get());
+  EXPECT_FALSE(window_state->bounds_changed_by_user());
+
   wm::CenterWindow(window.get());
+  // Centring window is considered as a user's action.
+  EXPECT_TRUE(window_state->bounds_changed_by_user());
   EXPECT_EQ("200,126 100x100", window->bounds().ToString());
   EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString());
   window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100),
diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc
index de17d09..f02830a 100644
--- a/ash/wm/workspace/workspace_event_handler_unittest.cc
+++ b/ash/wm/workspace/workspace_event_handler_unittest.cc
@@ -13,7 +13,6 @@
 #include "ash/wm/workspace_controller.h"
 #include "ash/wm/workspace_controller_test_helper.h"
 #include "ui/aura/client/aura_constants.h"
-#include "ui/aura/client/window_move_client.h"
 #include "ui/aura/test/event_generator.h"
 #include "ui/aura/test/test_window_delegate.h"
 #include "ui/aura/window.h"
@@ -22,6 +21,7 @@
 #include "ui/events/event_processor.h"
 #include "ui/gfx/screen.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/window_move_client.h"
 
 #if defined(OS_WIN)
 #include "base/win/windows_version.h"
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index d812be6..1b4b4af 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -18,7 +18,6 @@
 #include "ash/wm/window_util.h"
 #include "ash/wm/wm_event.h"
 #include "ash/wm/workspace/workspace_layout_manager_delegate.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/aura_constants.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_observer.h"
@@ -27,6 +26,7 @@
 #include "ui/events/event.h"
 #include "ui/gfx/screen.h"
 #include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
 
 using aura::Window;
 
diff --git a/ash/wm/workspace/workspace_layout_manager.h b/ash/wm/workspace/workspace_layout_manager.h
index ff15728..970f5e4 100644
--- a/ash/wm/workspace/workspace_layout_manager.h
+++ b/ash/wm/workspace/workspace_layout_manager.h
@@ -14,10 +14,10 @@
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
 #include "ui/aura/layout_manager.h"
 #include "ui/aura/window_observer.h"
 #include "ui/gfx/rect.h"
+#include "ui/wm/public/activation_change_observer.h"
 
 namespace aura {
 class RootWindow;
diff --git a/ash/wm/workspace_controller.cc b/ash/wm/workspace_controller.cc
index d7cb7aa..96735be 100644
--- a/ash/wm/workspace_controller.cc
+++ b/ash/wm/workspace_controller.cc
@@ -14,7 +14,6 @@
 #include "ash/wm/workspace/workspace_event_handler.h"
 #include "ash/wm/workspace/workspace_layout_manager.h"
 #include "ash/wm/workspace/workspace_layout_manager_delegate.h"
-#include "ui/aura/client/activation_client.h"
 #include "ui/aura/client/aura_constants.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
@@ -22,6 +21,7 @@
 #include "ui/compositor/scoped_layer_animation_settings.h"
 #include "ui/wm/core/visibility_controller.h"
 #include "ui/wm/core/window_animations.h"
+#include "ui/wm/public/activation_client.h"
 
 namespace ash {
 namespace internal {