diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 03:06:00 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 03:06:00 +0000 |
commit | 8a201eb4b559aa82e6f3c0363817d1ba03ecabee (patch) | |
tree | 23fc1c5e9e2e4c2af4ecc7981ed822155de4f792 /ash | |
parent | 80fe82fc9788d5ca591f3df08ff43c9d608ec40b (diff) | |
download | chromium_src-8a201eb4b559aa82e6f3c0363817d1ba03ecabee.zip chromium_src-8a201eb4b559aa82e6f3c0363817d1ba03ecabee.tar.gz chromium_src-8a201eb4b559aa82e6f3c0363817d1ba03ecabee.tar.bz2 |
[Aura] Remove webui applist and enable views applist.
BUG=105913,105620
TEST=Verify fix for issue 105913,105620.
Review URL: http://codereview.chromium.org/9185014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117375 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/app_list/app_list.cc | 35 | ||||
-rw-r--r-- | ash/app_list/app_list.h | 6 | ||||
-rw-r--r-- | ash/app_list/app_list_view.cc | 11 | ||||
-rw-r--r-- | ash/app_list/app_list_view.h | 9 | ||||
-rw-r--r-- | ash/ash_switches.cc | 3 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/shell/app_list.cc | 16 | ||||
-rw-r--r-- | ash/shell/example_factory.h | 8 | ||||
-rw-r--r-- | ash/shell/shell_main.cc | 10 | ||||
-rw-r--r-- | ash/shell_delegate.h | 11 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 5 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.h | 3 |
12 files changed, 23 insertions, 95 deletions
diff --git a/ash/app_list/app_list.cc b/ash/app_list/app_list.cc index 31f7d6f..9f2ce91 100644 --- a/ash/app_list/app_list.cc +++ b/ash/app_list/app_list.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -48,8 +48,7 @@ ui::Layer* GetLayer(views::Widget* widget) { AppList::AppList() : aura::EventFilter(NULL), is_visible_(false), - widget_(NULL), - ALLOW_THIS_IN_INITIALIZER_LIST(set_widget_factory_(this)) { + widget_(NULL) { } AppList::~AppList() { @@ -64,24 +63,17 @@ void AppList::SetVisible(bool visible) { if (widget_) { ScheduleAnimation(); - } else if (is_visible_ && !set_widget_factory_.HasWeakPtrs()) { - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kAuraViewsAppList)) { - scoped_ptr<AppListModel> model(new AppListModel); - Shell::GetInstance()->delegate()->BuildAppListModel(model.get()); - - // AppListModel and AppListViewDelegate are owned by AppListView. They - // will be released with AppListView on close. - new AppListView( - model.release(), - Shell::GetInstance()->delegate()->CreateAppListViewDelegate(), - GetPreferredBounds(false), - base::Bind(&AppList::SetWidget, set_widget_factory_.GetWeakPtr())); - } else { - Shell::GetInstance()->delegate()->RequestAppListWidget( - GetPreferredBounds(false), - base::Bind(&AppList::SetWidget, set_widget_factory_.GetWeakPtr())); - } + } else if (is_visible_) { + scoped_ptr<AppListModel> model(new AppListModel); + Shell::GetInstance()->delegate()->BuildAppListModel(model.get()); + + // AppListModel and AppListViewDelegate are owned by AppListView. They + // will be released with AppListView on close. + AppListView* app_list_view = new AppListView( + model.release(), + Shell::GetInstance()->delegate()->CreateAppListViewDelegate(), + GetPreferredBounds(false)); + SetWidget(app_list_view->GetWidget()); } } @@ -94,7 +86,6 @@ bool AppList::IsVisible() { void AppList::SetWidget(views::Widget* widget) { DCHECK(widget_ == NULL); - set_widget_factory_.InvalidateWeakPtrs(); if (is_visible_) { widget_ = widget; diff --git a/ash/app_list/app_list.h b/ash/app_list/app_list.h index d1ddf2a..2dfd0c9 100644 --- a/ash/app_list/app_list.h +++ b/ash/app_list/app_list.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -8,7 +8,6 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/memory/weak_ptr.h" #include "ui/aura/event_filter.h" #include "ui/gfx/compositor/layer_animation_observer.h" #include "ui/views/widget/widget.h" @@ -71,9 +70,6 @@ class AppList : public aura::EventFilter, // App list widget we get from ShellDelegate. views::Widget* widget_; - // A weak ptr factory for callbacks that ShellDelegate used to set widget. - base::WeakPtrFactory<AppList> set_widget_factory_; - DISALLOW_COPY_AND_ASSIGN(AppList); }; diff --git a/ash/app_list/app_list_view.cc b/ash/app_list/app_list_view.cc index 9b019ab..9aa34108 100644 --- a/ash/app_list/app_list_view.cc +++ b/ash/app_list/app_list_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -17,11 +17,10 @@ namespace ash { AppListView::AppListView( AppListModel* model, AppListViewDelegate* delegate, - const gfx::Rect& bounds, - const ash::ShellDelegate::SetWidgetCallback& callback) + const gfx::Rect& bounds) : model_(model), delegate_(delegate) { - Init(bounds, callback); + Init(bounds); } AppListView::~AppListView() { @@ -32,8 +31,7 @@ void AppListView::Close() { Shell::GetInstance()->ToggleAppList(); } -void AppListView::Init(const gfx::Rect& bounds, - const ShellDelegate::SetWidgetCallback& callback) { +void AppListView::Init(const gfx::Rect& bounds) { SetLayoutManager(new views::FillLayout); AppListGroupsView* groups_view = new AppListGroupsView(model_.get(), this); AddChildView(groups_view); @@ -49,7 +47,6 @@ void AppListView::Init(const gfx::Rect& bounds, widget->Init(widget_params); widget->SetContentsView(this); - callback.Run(widget); if (groups_view->GetFocusedTile()) groups_view->GetFocusedTile()->RequestFocus(); } diff --git a/ash/app_list/app_list_view.h b/ash/app_list/app_list_view.h index 35fd0d7..17bfcec 100644 --- a/ash/app_list/app_list_view.h +++ b/ash/app_list/app_list_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -8,7 +8,6 @@ #include "ash/app_list/app_list_item_view_listener.h" #include "ash/ash_export.h" -#include "ash/shell_delegate.h" #include "base/memory/scoped_ptr.h" #include "ui/views/widget/widget_delegate.h" @@ -29,8 +28,7 @@ class ASH_EXPORT AppListView : public views::WidgetDelegateView, // Takes ownership of |model| and |delegate|. AppListView(AppListModel* model, AppListViewDelegate* delegate, - const gfx::Rect& bounds, - const ShellDelegate::SetWidgetCallback& callback); + const gfx::Rect& bounds); virtual ~AppListView(); // Closes app list. @@ -38,8 +36,7 @@ class ASH_EXPORT AppListView : public views::WidgetDelegateView, private: // Initializes the window. - void Init(const gfx::Rect& bounds, - const ShellDelegate::SetWidgetCallback& callback); + void Init(const gfx::Rect& bounds); // Overridden from views::View: virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 30857a8..10b71ad 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -20,9 +20,6 @@ const char kAuraNoShadows[] = "aura-no-shadows"; // Use Aura-style translucent window frame. const char kAuraTranslucentFrames[] = "aura-translucent-frames"; -// Use views-based app list. -const char kAuraViewsAppList[] = "aura-views-applist"; - // Use a custom window style, e.g. --aura-window-mode=compact. // When this flag is not passed we default to "normal" mode. const char kAuraWindowMode[] = "aura-window-mode"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 65ba77d..2b5d8ad 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -15,7 +15,6 @@ namespace switches { ASH_EXPORT extern const char kAuraGoogleDialogFrames[]; ASH_EXPORT extern const char kAuraNoShadows[]; ASH_EXPORT extern const char kAuraTranslucentFrames[]; -ASH_EXPORT extern const char kAuraViewsAppList[]; ASH_EXPORT extern const char kAuraWindowMode[]; ASH_EXPORT extern const char kAuraWindowModeCompact[]; ASH_EXPORT extern const char kAuraWindowModeNormal[]; diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index 78639da..0a908f9 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -148,19 +148,5 @@ ash::AppListViewDelegate* CreateAppListViewDelegate() { return new ExampleAppListViewDelegate; } -// TODO(xiyuan): Remove this. -void CreateAppList( - const gfx::Rect& bounds, - const ash::ShellDelegate::SetWidgetCallback& callback) { - ash::AppListModel* model = new ash::AppListModel; - BuildAppListModel(model); - - new ash::AppListView( - model, - CreateAppListViewDelegate(), - bounds, - callback); -} - } // namespace shell } // namespace ash diff --git a/ash/shell/example_factory.h b/ash/shell/example_factory.h index f6fdeac..225a2fb 100644 --- a/ash/shell/example_factory.h +++ b/ash/shell/example_factory.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -6,8 +6,6 @@ #define ASH_SHELL_EXAMPLE_FACTORY_H_ #pragma once -#include "ash/shell_delegate.h" - namespace ash { class AppListModel; class AppListViewDelegate; @@ -31,10 +29,6 @@ void BuildAppListModel(ash::AppListModel* model); ash::AppListViewDelegate* CreateAppListViewDelegate(); -void CreateAppList( - const gfx::Rect& bounds, - const ash::ShellDelegate::SetWidgetCallback& callback); - } // namespace shell } // namespace ash diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc index 5619d00..bf26a4e 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -57,16 +57,6 @@ class ShellDelegateImpl : public ash::ShellDelegate { return ash::internal::CreateStatusArea(); } - virtual void RequestAppListWidget( - const gfx::Rect& bounds, - const SetWidgetCallback& callback) OVERRIDE { - // TODO(xiyuan): Clean this up. - // The code below here is because we don't want to use - // --aura-views-applist. This function is deprecated and all code - // here will be removed when we clean it up. - ash::shell::CreateAppList(bounds, callback); - } - virtual void BuildAppListModel(ash::AppListModel* model) OVERRIDE { ash::shell::BuildAppListModel(model); } diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 21e181d..0bb1ce6 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -32,9 +32,6 @@ struct LauncherItem; // Delegate of the Shell. class ASH_EXPORT ShellDelegate { public: - // Callback to pass back a widget used by RequestAppListWidget. - typedef base::Callback<void(views::Widget*)> SetWidgetCallback; - // The Shell owns the delegate. virtual ~ShellDelegate() {} @@ -45,14 +42,6 @@ class ASH_EXPORT ShellDelegate { // Invoked to create a new status area. Can return NULL. virtual views::Widget* CreateStatusArea() = 0; - // Invoked to create app list widget. The Delegate calls the callback - // when the widget is ready to show. - // Deprecated. - // TODO(xiyuan): Clean this up when switching to views app list. - virtual void RequestAppListWidget( - const gfx::Rect& bounds, - const SetWidgetCallback& callback) = 0; - // Invoked to ask the delegate to populate the |model|. virtual void BuildAppListModel(AppListModel* model) = 0; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index 3ece145..92c36d7 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -26,11 +26,6 @@ views::Widget* TestShellDelegate::CreateStatusArea() { return NULL; } -void TestShellDelegate::RequestAppListWidget( - const gfx::Rect& bounds, - const SetWidgetCallback& callback) { -} - void TestShellDelegate::BuildAppListModel(AppListModel* model) { } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index 1c3cb6d..50cd72d 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -20,9 +20,6 @@ class TestShellDelegate : public ShellDelegate { // Overridden from ShellDelegate: virtual void CreateNewWindow() OVERRIDE; virtual views::Widget* CreateStatusArea() OVERRIDE; - virtual void RequestAppListWidget( - const gfx::Rect& bounds, - const SetWidgetCallback& callback) OVERRIDE; virtual void BuildAppListModel(AppListModel* model) OVERRIDE; virtual AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual std::vector<aura::Window*> GetCycleWindowList() const OVERRIDE; |