Commit 835d5509 authored by estade's avatar estade Committed by Commit bot

Apply new WM shadows to app list.

Also clean up/streamline AppListView.
1. Remove code that supported arrows + view anchoring
2. Remove code that supported !CrOS
3. Remove dead code for making bubble borders accept events
4. Remove AppListViewObserver which is dead and who knows what it was used for.
5. Stop building //ui/app_list on all aura (just build on CrOS)

BUG=608852
TBR=derat@chromium.org

Review-Url: https://codereview.chromium.org/2588103004
Cr-Commit-Position: refs/heads/master@{#441394}
parent 0ef27f64
...@@ -361,8 +361,6 @@ group("both_gn_and_gyp") { ...@@ -361,8 +361,6 @@ group("both_gn_and_gyp") {
if (use_aura) { if (use_aura) {
deps += [ deps += [
"//ui/app_list:app_list_unittests",
"//ui/app_list/presenter:app_list_presenter_unittests",
"//ui/aura:aura_unittests", "//ui/aura:aura_unittests",
"//ui/aura:demo", "//ui/aura:demo",
"//ui/wm:wm_unittests", "//ui/wm:wm_unittests",
...@@ -483,6 +481,8 @@ group("both_gn_and_gyp") { ...@@ -483,6 +481,8 @@ group("both_gn_and_gyp") {
"//chromeos:chromeos_unittests", "//chromeos:chromeos_unittests",
"//chromeos/components:chromeos_components_unittests", "//chromeos/components:chromeos_components_unittests",
"//components/session_manager/core", "//components/session_manager/core",
"//ui/app_list:app_list_unittests",
"//ui/app_list/presenter:app_list_presenter_unittests",
"//ui/arc:ui_arc_unittests", "//ui/arc:ui_arc_unittests",
"//ui/chromeos:ui_chromeos_unittests", "//ui/chromeos:ui_chromeos_unittests",
] ]
......
...@@ -122,11 +122,7 @@ void AppListPresenterDelegate::Init(app_list::AppListView* view, ...@@ -122,11 +122,7 @@ void AppListPresenterDelegate::Init(app_list::AppListView* view,
container, current_apps_page, container, current_apps_page,
ScreenUtil::GetDisplayWorkAreaBoundsInParent(container)); ScreenUtil::GetDisplayWorkAreaBoundsInParent(container));
} else { } else {
// Note: We can't center the app list until we have its dimensions, so we view->InitAsBubble(container, current_apps_page);
// init at (0, 0) and then reset its anchor point.
view->InitAsBubbleAtFixedLocation(container, current_apps_page,
gfx::Point(), views::BubbleBorder::FLOAT,
true /* border_accepts_events */);
// The app list is centered over the display of the app list button that was // The app list is centered over the display of the app list button that was
// pressed (if triggered via keyboard, this is the display with the // pressed (if triggered via keyboard, this is the display with the
// currently focused window). // currently focused window).
......
...@@ -60,16 +60,11 @@ void AppListPresenterDelegateMus::Init(app_list::AppListView* view, ...@@ -60,16 +60,11 @@ void AppListPresenterDelegateMus::Init(app_list::AppListView* view,
// Note: This would place the app list into the USER_WINDOWS container, unlike // Note: This would place the app list into the USER_WINDOWS container, unlike
// in classic ash, where it has it's own container. // in classic ash, where it has it's own container.
// Note: We can't center the app list until we have its dimensions, so we
// init at (0, 0) and then reset its anchor point.
// TODO(mfomitchev): We are currently passing NULL for |parent|. It seems like // TODO(mfomitchev): We are currently passing NULL for |parent|. It seems like
// the only thing this is used for is choosing the right scale factor in // the only thing this is used for is choosing the right scale factor in
// AppListMainView::PreloadIcons(), so we take care of that - perhaps by // AppListMainView::PreloadIcons(), so we take care of that - perhaps by
// passing the display_id or the scale factor directly // passing the display_id or the scale factor directly
view->InitAsBubbleAtFixedLocation(nullptr /* parent */, current_apps_page, view->InitAsBubble(nullptr /* parent */, current_apps_page);
gfx::Point(), views::BubbleBorder::FLOAT,
true /* border_accepts_events */);
view->SetAnchorPoint( view->SetAnchorPoint(
GetCenterOfDisplay(display_id, GetMinimumBoundsHeightForAppList(view))); GetCenterOfDisplay(display_id, GetMinimumBoundsHeightForAppList(view)));
......
...@@ -13664,12 +13664,6 @@ ...@@ -13664,12 +13664,6 @@
}, },
"test": "angle_unittests" "test": "angle_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_presenter_unittests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
......
...@@ -7,18 +7,6 @@ ...@@ -7,18 +7,6 @@
}, },
"test": "accessibility_unittests" "test": "accessibility_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_presenter_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_unittests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
...@@ -513,18 +501,6 @@ ...@@ -513,18 +501,6 @@
}, },
"test": "accessibility_unittests" "test": "accessibility_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_presenter_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_unittests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
...@@ -967,18 +943,6 @@ ...@@ -967,18 +943,6 @@
}, },
"test": "accessibility_unittests" "test": "accessibility_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_presenter_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "app_list_unittests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
......
...@@ -99,8 +99,6 @@ component("app_list") { ...@@ -99,8 +99,6 @@ component("app_list") {
sources += [ sources += [
"views/all_apps_tile_item_view.cc", "views/all_apps_tile_item_view.cc",
"views/all_apps_tile_item_view.h", "views/all_apps_tile_item_view.h",
"views/app_list_background.cc",
"views/app_list_background.h",
"views/app_list_drag_and_drop_host.h", "views/app_list_drag_and_drop_host.h",
"views/app_list_folder_view.cc", "views/app_list_folder_view.cc",
"views/app_list_folder_view.h", "views/app_list_folder_view.h",
...@@ -112,7 +110,6 @@ component("app_list") { ...@@ -112,7 +110,6 @@ component("app_list") {
"views/app_list_page.h", "views/app_list_page.h",
"views/app_list_view.cc", "views/app_list_view.cc",
"views/app_list_view.h", "views/app_list_view.h",
"views/app_list_view_observer.h",
"views/apps_container_view.cc", "views/apps_container_view.cc",
"views/apps_container_view.h", "views/apps_container_view.h",
"views/apps_grid_view.cc", "views/apps_grid_view.cc",
...@@ -218,15 +215,6 @@ if (toolkit_views) { ...@@ -218,15 +215,6 @@ if (toolkit_views) {
"//ui/views_content_client", "//ui/views_content_client",
"//url", "//url",
] ]
if (is_win) {
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
deps += [
"//content:sandbox_helper_win",
"//sandbox",
]
}
} }
} }
......
...@@ -22,11 +22,6 @@ ...@@ -22,11 +22,6 @@
#include "ui/views/controls/webview/webview.h" #include "ui/views/controls/webview/webview.h"
#include "ui/views_content_client/views_content_client.h" #include "ui/views_content_client/views_content_client.h"
#if defined(OS_WIN)
#include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#endif
namespace { namespace {
class AppListDemoService; class AppListDemoService;
...@@ -59,20 +54,14 @@ class DemoAppListViewDelegate : public app_list::test::AppListTestViewDelegate { ...@@ -59,20 +54,14 @@ class DemoAppListViewDelegate : public app_list::test::AppListTestViewDelegate {
app_list::AppListView* DemoAppListViewDelegate::InitView( app_list::AppListView* DemoAppListViewDelegate::InitView(
gfx::NativeWindow window_context) { gfx::NativeWindow window_context) {
gfx::NativeView container = NULL;
// On Ash, the app list is placed into an aura::Window container. For the demo // On Ash, the app list is placed into an aura::Window container. For the demo
// use the root window context as the parent. This only works on Aura since an // use the root window context as the parent. This only works on Aura since an
// aura::Window is also a NativeView. // aura::Window is also a NativeView.
#if defined(USE_AURA) gfx::NativeView container = window_context;
container = window_context;
#endif
view_ = new app_list::AppListView(this); view_ = new app_list::AppListView(this);
view_->InitAsBubbleAtFixedLocation(container, view_->InitAsBubble(container, 0);
0, view_->SetAnchorPoint(gfx::Point(300, 300));
gfx::Point(300, 300),
views::BubbleBorder::FLOAT,
false /* border_accepts_events */);
// Populate some apps. // Populate some apps.
GetTestModel()->PopulateApps(kInitialItems); GetTestModel()->PopulateApps(kInitialItems);
...@@ -123,15 +112,8 @@ void ShowAppList(content::BrowserContext* browser_context, ...@@ -123,15 +112,8 @@ void ShowAppList(content::BrowserContext* browser_context,
} // namespace } // namespace
#if defined(OS_WIN)
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
ui::ViewsContentClient views_content_client(instance, &sandbox_info);
#else
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
ui::ViewsContentClient views_content_client(argc, argv); ui::ViewsContentClient views_content_client(argc, argv);
#endif
views_content_client.set_task(base::Bind(&ShowAppList)); views_content_client.set_task(base::Bind(&ShowAppList));
return views_content_client.RunMain(); return views_content_client.RunMain();
......
// Copyright (c) 2012 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.
#include "ui/app_list/views/app_list_background.h"
#include "base/command_line.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/views/contents_view.h"
#include "ui/app_list/views/search_box_view.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/view.h"
namespace app_list {
AppListBackground::AppListBackground(int corner_radius)
: corner_radius_(corner_radius) {
}
AppListBackground::~AppListBackground() {
}
void AppListBackground::Paint(gfx::Canvas* canvas,
views::View* view) const {
gfx::Rect bounds = view->GetContentsBounds();
if (corner_radius_ > 0) {
canvas->Save();
SkPath path;
// Contents corner radius is 1px smaller than border corner radius.
SkScalar radius = SkIntToScalar(corner_radius_ - 1);
path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
canvas->ClipPath(path, false);
}
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
int contents_top = bounds.y();
gfx::Rect contents_rect(bounds.x(),
contents_top,
bounds.width(),
bounds.bottom() - contents_top);
paint.setColor(kContentsBackgroundColor);
canvas->DrawRect(contents_rect, paint);
if (corner_radius_ > 0)
canvas->Restore();
}
} // namespace app_list
// Copyright (c) 2012 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.
#ifndef UI_APP_LIST_VIEWS_APP_LIST_BACKGROUND_H_
#define UI_APP_LIST_VIEWS_APP_LIST_BACKGROUND_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/views/background.h"
namespace views {
class View;
}
namespace app_list {
// A class to paint bubble background.
class AppListBackground : public views::Background {
public:
explicit AppListBackground(int corner_radius);
~AppListBackground() override;
private:
// views::Background overrides:
void Paint(gfx::Canvas* canvas, views::View* view) const override;
const int corner_radius_;
DISALLOW_COPY_AND_ASSIGN(AppListBackground);
};
} // namespace app_list
#endif // UI_APP_LIST_VIEWS_APP_LIST_BACKGROUND_H_
This diff is collapsed.
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "ui/app_list/app_list_export.h" #include "ui/app_list/app_list_export.h"
#include "ui/app_list/speech_ui_model_observer.h" #include "ui/app_list/speech_ui_model_observer.h"
...@@ -25,7 +24,6 @@ class ApplicationDragAndDropHost; ...@@ -25,7 +24,6 @@ class ApplicationDragAndDropHost;
class AppListMainView; class AppListMainView;
class AppListModel; class AppListModel;
class AppListViewDelegate; class AppListViewDelegate;
class AppListViewObserver;
class HideViewAnimationObserver; class HideViewAnimationObserver;
class PaginationModel; class PaginationModel;
class SearchBoxView; class SearchBoxView;
...@@ -44,13 +42,8 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -44,13 +42,8 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
explicit AppListView(AppListViewDelegate* delegate); explicit AppListView(AppListViewDelegate* delegate);
~AppListView() override; ~AppListView() override;
// Initializes the widget and use a fixed |anchor_point_in_screen| for // Initializes the widget.
// positioning. void InitAsBubble(gfx::NativeView parent, int initial_apps_page);
void InitAsBubbleAtFixedLocation(gfx::NativeView parent,
int initial_apps_page,
const gfx::Point& anchor_point_in_screen,
views::BubbleBorder::Arrow arrow,
bool border_accepts_events);
// Initializes the widget as a frameless window, not a bubble. // Initializes the widget as a frameless window, not a bubble.
void InitAsFramelessWindow(gfx::NativeView parent, void InitAsFramelessWindow(gfx::NativeView parent,
...@@ -94,9 +87,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -94,9 +87,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
void SetProfileByPath(const base::FilePath& profile_path); void SetProfileByPath(const base::FilePath& profile_path);
void AddObserver(AppListViewObserver* observer);
void RemoveObserver(AppListViewObserver* observer);
AppListMainView* app_list_main_view() { return app_list_main_view_; } AppListMainView* app_list_main_view() { return app_list_main_view_; }
// Gets the PaginationModel owned by this view's apps grid. // Gets the PaginationModel owned by this view's apps grid.
...@@ -114,12 +104,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -114,12 +104,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
void InitChildWidgets(); void InitChildWidgets();
void InitAsBubbleInternal(gfx::NativeView parent,
int initial_apps_page,
views::BubbleBorder::Arrow arrow,
bool border_accepts_events,
const gfx::Vector2d& anchor_offset);
// Overridden from views::BubbleDialogDelegateView: // Overridden from views::BubbleDialogDelegateView:
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override; views::Widget* widget) const override;
...@@ -133,7 +117,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -133,7 +117,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// Overridden from views::WidgetObserver: // Overridden from views::WidgetObserver:
void OnWidgetDestroying(views::Widget* widget) override; void OnWidgetDestroying(views::Widget* widget) override;
void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
// Overridden from SpeechUIModelObserver: // Overridden from SpeechUIModelObserver:
void OnSpeechRecognitionStateChanged( void OnSpeechRecognitionStateChanged(
...@@ -152,7 +135,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -152,7 +135,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// open. // open.
views::View* overlay_view_; views::View* overlay_view_;
base::ObserverList<AppListViewObserver> observers_;
std::unique_ptr<HideViewAnimationObserver> animation_observer_; std::unique_ptr<HideViewAnimationObserver> animation_observer_;
// For UMA and testing. If non-null, triggered when the app list is painted. // For UMA and testing. If non-null, triggered when the app list is painted.
......
// Copyright 2013 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.
#ifndef UI_APP_LIST_VIEWS_APP_LIST_VIEW_OBSERVER_H_
#define UI_APP_LIST_VIEWS_APP_LIST_VIEW_OBSERVER_H_
namespace views {
class Widget;
}
namespace app_list {
class AppListViewObserver {
public:
virtual void OnActivationChanged(views::Widget* widget, bool active) = 0;
protected:
virtual ~AppListViewObserver() {}
};
} // namespace app_list
#endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_OBSERVER_H_
...@@ -175,11 +175,8 @@ AppListViewTestContext::AppListViewTestContext(gfx::NativeView parent) { ...@@ -175,11 +175,8 @@ AppListViewTestContext::AppListViewTestContext(gfx::NativeView parent) {
view_ = new app_list::AppListView(delegate_.get()); view_ = new app_list::AppListView(delegate_.get());
// Initialize centered around a point that ensures the window is wholly shown. // Initialize centered around a point that ensures the window is wholly shown.
view_->InitAsBubbleAtFixedLocation(parent, view_->InitAsBubble(parent, 0);
0, view_->SetAnchorPoint(gfx::Point(300, 300));
gfx::Point(300, 300),
views::BubbleBorder::FLOAT,
false /* border_accepts_events */);
} }
AppListViewTestContext::~AppListViewTestContext() { AppListViewTestContext::~AppListViewTestContext() {
......
...@@ -217,7 +217,6 @@ BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view, ...@@ -217,7 +217,6 @@ BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view,
kPanelVertMargin, kPanelVertMargin,
kPanelHorizMargin), kPanelHorizMargin),
accept_events_(true), accept_events_(true),
border_accepts_events_(true),
adjust_if_offscreen_(true), adjust_if_offscreen_(true),
parent_window_(NULL) { parent_window_(NULL) {
if (anchor_view) if (anchor_view)
......
...@@ -89,9 +89,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView, ...@@ -89,9 +89,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView,
bool accept_events() const { return accept_events_; } bool accept_events() const { return accept_events_; }
void set_accept_events(bool accept_events) { accept_events_ = accept_events; } void set_accept_events(bool accept_events) { accept_events_ = accept_events; }
bool border_accepts_events() const { return border_accepts_events_; }
void set_border_accepts_events(bool event) { border_accepts_events_ = event; }
bool adjust_if_offscreen() const { return adjust_if_offscreen_; } bool adjust_if_offscreen() const { return adjust_if_offscreen_; }
void set_adjust_if_offscreen(bool adjust) { adjust_if_offscreen_ = adjust; } void set_adjust_if_offscreen(bool adjust) { adjust_if_offscreen_ = adjust; }
...@@ -196,7 +193,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView, ...@@ -196,7 +193,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView,
// Specifies whether the bubble (or its border) handles mouse events, etc. // Specifies whether the bubble (or its border) handles mouse events, etc.
bool accept_events_; bool accept_events_;
bool border_accepts_events_;
// If true (defaults to true), the arrow may be mirrored and moved to fit the // If true (defaults to true), the arrow may be mirrored and moved to fit the
// bubble on screen better. It would be a no-op if the bubble has no arrow. // bubble on screen better. It would be a no-op if the bubble has no arrow.
......
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