summaryrefslogtreecommitdiffstats
path: root/ash/app_list
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-12 03:06:00 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-12 03:06:00 +0000
commit8a201eb4b559aa82e6f3c0363817d1ba03ecabee (patch)
tree23fc1c5e9e2e4c2af4ecc7981ed822155de4f792 /ash/app_list
parent80fe82fc9788d5ca591f3df08ff43c9d608ec40b (diff)
downloadchromium_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/app_list')
-rw-r--r--ash/app_list/app_list.cc35
-rw-r--r--ash/app_list/app_list.h6
-rw-r--r--ash/app_list/app_list_view.cc11
-rw-r--r--ash/app_list/app_list_view.h9
4 files changed, 21 insertions, 40 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;