Commit f289680e authored by Scott Little's avatar Scott Little Committed by Commit Bot

Revert "reland: shelf: Add a back button to the shelf."

This reverts commit c8bf13e0.

Reason for revert: It broke compile on a bunch of ChromiumOS bots, e.g. https://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Full

Original change's description:
> reland: shelf: Add a back button to the shelf.
> 
> This is in preparation for removing title bars work. See mocks in the bug and screenshots for more details.
> This approach of adding a back button expands the current app list button to be modal and have two functionalities
> depending on which side is pressed. The alternative (seperate back button) is IMO very difficult to achieve what
> is shown in the mocks (namely the color in between and animation (not in this CL) of said color in between). The
> exact functionality of the back button is not 100% defined yet, this CL just sends a VKEY_BROWSER_BACK event in the
> meantime.
> 
> Screenshots:
> https://screenshot.googleplex.com/ZVNP0aq0cc3
> https://screenshot.googleplex.com/fDcGTuoyZg5
> https://screenshot.googleplex.com/ZFBzk72LLVt
> 
> Test: ash_unittests --gtest_filter="AppListButtonInkDropTest.*"
> Bug: 721940
> Change-Id: I691c9fc15294d48a7a0da88ba78550e013d9b869
> Reviewed-on: https://chromium-review.googlesource.com/572434
> Commit-Queue: Sammie Quon <sammiequon@chromium.org>
> Reviewed-by: Michael Wasserman <msw@chromium.org>
> Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
> Cr-Original-Commit-Position: refs/heads/master@{#487491}
> Reviewed-on: https://chromium-review.googlesource.com/576656
> Cr-Commit-Position: refs/heads/master@{#488025}

TBR=msw@chromium.org,oshima@chromium.org,sammiequon@chromium.org

Change-Id: Ia137671938e7b2110c5cef0bd04fee4ecd46e232
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 721940
Reviewed-on: https://chromium-review.googlesource.com/578611Reviewed-by: default avatarScott Little <sclittle@chromium.org>
Commit-Queue: Scott Little <sclittle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488032}
parent 28b06e6b
...@@ -88,8 +88,6 @@ aggregate_vector_icons("ash_vector_icons") { ...@@ -88,8 +88,6 @@ aggregate_vector_icons("ash_vector_icons") {
"palette_tray_icon_magnify.icon", "palette_tray_icon_magnify.icon",
"palette_tray_icon_metalayer.1x.icon", "palette_tray_icon_metalayer.1x.icon",
"palette_tray_icon_metalayer.icon", "palette_tray_icon_metalayer.icon",
"shelf_back.1x.icon",
"shelf_back.icon",
"shelf_keyboard.1x.icon", "shelf_keyboard.1x.icon",
"shelf_keyboard.icon", "shelf_keyboard.icon",
"shelf_logout.1x.icon", "shelf_logout.1x.icon",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 16,
MOVE_TO, 0, 0,
R_H_LINE_TO, 16,
R_V_LINE_TO, 16,
H_LINE_TO, 0,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF,
MOVE_TO, 5.2f, 7,
H_LINE_TO, 15,
R_V_LINE_TO, 2,
H_LINE_TO, 5.2f,
R_LINE_TO, 4.8f, 4.8f,
LINE_TO, 8.9f, 15,
LINE_TO, 2, 8,
R_LINE_TO, 6.9f, -7,
LINE_TO, 10, 2.2f,
LINE_TO, 5.2f, 7,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 32,
MOVE_TO, 0, 0,
R_H_LINE_TO, 32,
R_V_LINE_TO, 32,
H_LINE_TO, 0,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF,
MOVE_TO, 8.56f, 17.99f,
R_LINE_TO, 9.65f, 9.98f,
LINE_TO, 16.18f, 30,
LINE_TO, 3, 16.49f,
LINE_TO, 16.18f, 3,
R_LINE_TO, 2.03f, 2,
R_LINE_TO, -9.86f, 9.99f,
H_LINE_TO, 29,
R_V_LINE_TO, 3,
CLOSE,
END
This diff is collapsed.
...@@ -40,19 +40,15 @@ class ASH_EXPORT AppListButton : public views::ImageButton, ...@@ -40,19 +40,15 @@ class ASH_EXPORT AppListButton : public views::ImageButton,
// Updates background and schedules a paint. // Updates background and schedules a paint.
void UpdateShelfItemBackground(SkColor color); void UpdateShelfItemBackground(SkColor color);
// views::ImageButton: // views::ImageButton overrides:
void OnGestureEvent(ui::GestureEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override;
// Get the center point of the app list button circle used to draw its // Get the center point of the app list button used to draw its background and
// background and ink drops. // ink drops.
gfx::Point GetAppListButtonCenterPoint() const; gfx::Point GetCenterPoint() const;
// Get the center point of the app list button back arrow. Returns an empty
// gfx::Point if the back arrow is not shown.
gfx::Point GetBackButtonCenterPoint() const;
protected: protected:
// views::ImageButton: // views::ImageButton overrides:
bool OnMousePressed(const ui::MouseEvent& event) override; bool OnMousePressed(const ui::MouseEvent& event) override;
void OnMouseReleased(const ui::MouseEvent& event) override; void OnMouseReleased(const ui::MouseEvent& event) override;
void OnMouseCaptureLost() override; void OnMouseCaptureLost() override;
...@@ -66,22 +62,13 @@ class ASH_EXPORT AppListButton : public views::ImageButton, ...@@ -66,22 +62,13 @@ class ASH_EXPORT AppListButton : public views::ImageButton,
void PaintButtonContents(gfx::Canvas* canvas) override; void PaintButtonContents(gfx::Canvas* canvas) override;
private: private:
// ShellObserver: // ShellObserver overrides:
void OnAppListVisibilityChanged(bool shown, void OnAppListVisibilityChanged(bool shown,
aura::Window* root_window) override; aura::Window* root_window) override;
void OnVoiceInteractionStatusChanged(bool running) override; void OnVoiceInteractionStatusChanged(bool running) override;
void StartVoiceInteractionAnimation(); void StartVoiceInteractionAnimation();
// Helper function to determine whether and event at |location| should be
// handled by the back button or the app list circle. Returns false if we are
// not in maximized mode (there is no back button).
bool IsBackEvent(const gfx::Point& location);
// Generate and send a VKEY_BROWSER_BACK key event when the back button
// portion is clicked or tapped.
void GenerateAndSendBackEvent(const ui::LocatedEvent& original_event);
// True if the app list is currently showing for this display. // True if the app list is currently showing for this display.
// This is useful because other IsApplistVisible functions aren't per-display. // This is useful because other IsApplistVisible functions aren't per-display.
bool is_showing_app_list_; bool is_showing_app_list_;
...@@ -100,10 +87,6 @@ class ASH_EXPORT AppListButton : public views::ImageButton, ...@@ -100,10 +87,6 @@ class ASH_EXPORT AppListButton : public views::ImageButton,
bool voice_interaction_running_ = false; bool voice_interaction_running_ = false;
// Flag that gets set each time we receive a mouse or gesture event. It is
// then used to render the ink drop in the right location.
bool last_event_is_back_event_ = false;
DISALLOW_COPY_AND_ASSIGN(AppListButton); DISALLOW_COPY_AND_ASSIGN(AppListButton);
}; };
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "ash/shell_port.h" #include "ash/shell_port.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/root_window_finder.h" #include "ash/wm/root_window_finder.h"
#include "base/auto_reset.h" #include "base/auto_reset.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
...@@ -756,31 +755,15 @@ void ShelfView::CalculateIdealBounds(gfx::Rect* overflow_bounds) const { ...@@ -756,31 +755,15 @@ void ShelfView::CalculateIdealBounds(gfx::Rect* overflow_bounds) const {
int w = shelf_->PrimaryAxisValue(kShelfButtonSize, width()); int w = shelf_->PrimaryAxisValue(kShelfButtonSize, width());
int h = shelf_->PrimaryAxisValue(height(), kShelfButtonSize); int h = shelf_->PrimaryAxisValue(height(), kShelfButtonSize);
const bool is_maximize_mode = Shell::Get()->maximize_mode_controller()
? Shell::Get()
->maximize_mode_controller()
->IsMaximizeModeWindowManagerEnabled()
: false;
for (int i = 0; i < view_model_->view_size(); ++i) { for (int i = 0; i < view_model_->view_size(); ++i) {
if (i < first_visible_index_) { if (i < first_visible_index_) {
view_model_->set_ideal_bounds(i, gfx::Rect(x, y, 0, 0)); view_model_->set_ideal_bounds(i, gfx::Rect(x, y, 0, 0));
continue; continue;
} }
int width = w; view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h));
int height = h; x = shelf_->PrimaryAxisValue(x + w + kShelfButtonSpacing, x);
// If this is the app list button and we are in maximize/tablet mode, make y = shelf_->PrimaryAxisValue(y, y + h + kShelfButtonSpacing);
// space for the back button (which is part of the app list button).
if (i == 0 && is_maximize_mode) {
width = shelf_->PrimaryAxisValue(2 * w + kShelfButtonSpacing, w);
height = shelf_->PrimaryAxisValue(h, 2 * h + kShelfButtonSpacing);
}
view_model_->set_ideal_bounds(i, gfx::Rect(x, y, width, height));
x = shelf_->PrimaryAxisValue(x + width + kShelfButtonSpacing, x);
y = shelf_->PrimaryAxisValue(y, y + height + kShelfButtonSpacing);
} }
if (is_overflow_mode()) { if (is_overflow_mode()) {
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "ash/test_shell_delegate.h" #include "ash/test_shell_delegate.h"
#include "ash/wallpaper/wallpaper_controller.h" #include "ash/wallpaper/wallpaper_controller.h"
#include "ash/wallpaper/wallpaper_controller_test_api.h" #include "ash/wallpaper/wallpaper_controller_test_api.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
...@@ -2568,129 +2567,6 @@ TEST_F(ShelfViewInkDropTest, ShelfButtonWithMenuPressRelease) { ...@@ -2568,129 +2567,6 @@ TEST_F(ShelfViewInkDropTest, ShelfButtonWithMenuPressRelease) {
namespace { namespace {
// Test fixture to run app list button ink drop tests for both mouse and touch
// events.
class AppListButtonInkDropTest
: public ShelfViewInkDropTest,
public testing::WithParamInterface<ui::EventPointerType> {
public:
AppListButtonInkDropTest() : pointer_type_(GetParam()) {}
~AppListButtonInkDropTest() override {}
void MovePointerTo(const gfx::Point& point) {
if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_MOUSE)
GetEventGenerator().MoveMouseTo(point);
else if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH)
GetEventGenerator().MoveTouch(point);
}
void PressPointer() {
if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_MOUSE)
GetEventGenerator().PressLeftButton();
else if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH)
GetEventGenerator().PressTouch();
}
void ReleasePointer() {
if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_MOUSE)
GetEventGenerator().ReleaseLeftButton();
else if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH)
GetEventGenerator().ReleaseTouch();
}
private:
ui::EventPointerType pointer_type_;
DISALLOW_COPY_AND_ASSIGN(AppListButtonInkDropTest);
};
const ui::EventPointerType kPointerTypes[] = {
ui::EventPointerType::POINTER_TYPE_MOUSE,
ui::EventPointerType::POINTER_TYPE_TOUCH};
} // namespace
// Tests that clicking/tapping on the app list button in maximized mode (when
// it has two functionalities), transitions the ink drop state correctly.
TEST_P(AppListButtonInkDropTest, AppListButtonInMaximizedMode) {
// TODO: investigate failure in mash, http://crbug.com/695751.
if (Shell::GetAshConfig() == Config::MASH)
return;
InitAppListButtonInkDrop();
// Verify the app list button bounds change when we enter maximized mode.
const gfx::Rect old_bounds = app_list_button_->GetBoundsInScreen();
Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
true);
gfx::Rect new_bounds = app_list_button_->GetBoundsInScreen();
EXPECT_EQ(new_bounds.height(), old_bounds.height());
EXPECT_GT(new_bounds.width(), old_bounds.width());
gfx::Point point_on_circle = app_list_button_->GetAppListButtonCenterPoint();
views::View::ConvertPointToScreen(app_list_button_, &point_on_circle);
gfx::Point point_on_back_button =
app_list_button_->GetBackButtonCenterPoint();
views::View::ConvertPointToScreen(app_list_button_, &point_on_back_button);
// Verify the ink drop state transitions as expected when we press and
// release on the app list circle part of the app list button. Taps on the
// app list circle, which shows the app list, should end up in the activated
// state.
MovePointerTo(point_on_circle);
PressPointer();
EXPECT_EQ(views::InkDropState::ACTION_PENDING,
app_list_button_ink_drop_->GetTargetInkDropState());
EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
ElementsAre(views::InkDropState::ACTION_PENDING));
ReleasePointer();
// Trigger a mock button notification that the app list was shown.
app_list_button_->OnAppListShown();
FinishAppListVisibilityChange();
EXPECT_EQ(views::InkDropState::ACTIVATED,
app_list_button_ink_drop_->GetTargetInkDropState());
EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
ElementsAre(views::InkDropState::ACTIVATED));
// Trigger a mock button notification that the app list was dismissed.
app_list_button_->OnAppListDismissed();
FinishAppListVisibilityChange();
EXPECT_EQ(views::InkDropState::HIDDEN,
app_list_button_ink_drop_->GetTargetInkDropState());
EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
ElementsAre(views::InkDropState::DEACTIVATED));
// Verify the ink drop state transitions as expected when we tap on the back
// button part of the app list button.
MovePointerTo(point_on_back_button);
PressPointer();
EXPECT_EQ(views::InkDropState::ACTION_PENDING,
app_list_button_ink_drop_->GetTargetInkDropState());
EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
ElementsAre(views::InkDropState::ACTION_PENDING));
ReleasePointer();
EXPECT_EQ(views::InkDropState::HIDDEN,
app_list_button_ink_drop_->GetTargetInkDropState());
EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
ElementsAre(views::InkDropState::ACTION_TRIGGERED));
// Verify when we leave maximized mode, the bounds should return to be the
// same as they were before we entered maximized mode.
Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
false);
new_bounds = app_list_button_->GetBoundsInScreen();
EXPECT_EQ(new_bounds, old_bounds);
}
INSTANTIATE_TEST_CASE_P(
/* prefix intentionally left blank due to only one parameterization */,
AppListButtonInkDropTest,
::testing::ValuesIn(kPointerTypes));
namespace {
// An empty menu model for shell context menu just to have a menu. // An empty menu model for shell context menu just to have a menu.
class TestShellMenuModel : public ui::SimpleMenuModel, class TestShellMenuModel : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate { public ui::SimpleMenuModel::Delegate {
......
...@@ -470,7 +470,7 @@ void VoiceInteractionOverlay::StartAnimation(bool show_icon) { ...@@ -470,7 +470,7 @@ void VoiceInteractionOverlay::StartAnimation(bool show_icon) {
kRippleCircleStartRadiusDip / kRippleCircleInitRadiusDip; kRippleCircleStartRadiusDip / kRippleCircleInitRadiusDip;
gfx::Transform transform; gfx::Transform transform;
const gfx::Point center = host_view_->GetAppListButtonCenterPoint(); const gfx::Point center = host_view_->GetCenterPoint();
transform.Translate(center.x() - kRippleCircleStartRadiusDip, transform.Translate(center.x() - kRippleCircleStartRadiusDip,
center.y() - kRippleCircleStartRadiusDip); center.y() - kRippleCircleStartRadiusDip);
transform.Scale(scale_factor, scale_factor); transform.Scale(scale_factor, scale_factor);
...@@ -568,7 +568,7 @@ void VoiceInteractionOverlay::BurstAnimation() { ...@@ -568,7 +568,7 @@ void VoiceInteractionOverlay::BurstAnimation() {
is_bursting_ = true; is_bursting_ = true;
should_hide_animation_ = false; should_hide_animation_ = false;
gfx::Point center = host_view_->GetAppListButtonCenterPoint(); gfx::Point center = host_view_->GetCenterPoint();
gfx::Transform transform; gfx::Transform transform;
// Setup ripple animations. // Setup ripple animations.
...@@ -646,7 +646,7 @@ void VoiceInteractionOverlay::EndAnimation() { ...@@ -646,7 +646,7 @@ void VoiceInteractionOverlay::EndAnimation() {
kRippleCircleStartRadiusDip / kRippleCircleInitRadiusDip; kRippleCircleStartRadiusDip / kRippleCircleInitRadiusDip;
gfx::Transform transform; gfx::Transform transform;
const gfx::Point center = host_view_->GetAppListButtonCenterPoint(); const gfx::Point center = host_view_->GetCenterPoint();
transform.Translate(center.x() - kRippleCircleStartRadiusDip, transform.Translate(center.x() - kRippleCircleStartRadiusDip,
center.y() - kRippleCircleStartRadiusDip); center.y() - kRippleCircleStartRadiusDip);
transform.Scale(scale_factor, scale_factor); transform.Scale(scale_factor, scale_factor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment