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 | |
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
29 files changed, 26 insertions, 867 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; diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index aae6711..1c8c5aa 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -174,9 +174,6 @@ <include name="IDR_HTTP_AUTH_HTML" file="resources\http_auth.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_TAB_MODAL_CONFIRM_DIALOG_HTML" file="resources\tab_modal_confirm_dialog.html" flattenhtml="true" type="BINDATA" /> </if> - <if expr="pp_ifdef('use_aura')"> - <include name="IDR_APP_LIST_HTML" file="resources\aura\app_list\app_list.html" flattenhtml="true" type="BINDATA" /> - </if> <if expr="pp_ifdef('chromeos') and pp_ifdef('_google_chrome')"> <include name="IDR_HELP_MANIFEST" file="resources\help_app\manifest.json" type="BINDATA" /> </if> diff --git a/chrome/browser/resources/aura/app_list/app_list.css b/chrome/browser/resources/aura/app_list/app_list.css deleted file mode 100644 index 63c8e1e..0000000 --- a/chrome/browser/resources/aura/app_list/app_list.css +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2011 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. - */ - -html, -body { - -webkit-user-select: none; - height: 100%; - margin: 0; - overflow: hidden; - padding: 0; -} - -.tile-page-content { - padding: 0; -} - -.tile-page-scrollbar { - background-color: #7f7f7f; -} - -.app-contents > span { - color: white; - font-size: 14px; - font-weight: bold; - padding: 2px; /* Extra padding for text-shadow. */ - text-shadow: 0 0 2px black, 0 0 4px black; -} - -/* - * #container is used to host apps page in a fixed 900x550 area so that - * we don't have excessive space between app icons and nav dots. #container - * is center aligned with its parent. We use top:50% and left:50% to move it - * to parent's center and use negative margin-top and margin-left to align its - * center with parent's center. Because of this, margin-top must be half of - * the height and margin-left must be half of the width. - */ -#container { - height: 550px; - left: 50%; - margin-top: -225px; - margin-left: -450px; - position: absolute; - top: 50%; - width: 900px; -} - -#card-slider-frame { - /* Must match #footer height. */ - bottom: 50px; - overflow: hidden; - position: absolute; - height: 500px; - width: 100%; -} - -#page-list { - /* fill the apps-frame */ - height: 100%; - display: -webkit-box; -} - -#footer { - background: transparent; - bottom: 0; - position: absolute; - width: 100%; - z-index: 5; -} - -#footer-content { - -webkit-box-align: center; - display: -webkit-box; - height: 49px; -} - -.dot .selection-bar { - border-color: #7f7f7f; - opacity: 0.2; -} - -.dot input { - color: #7f7f7f; - font-size: 12px; -} - -.dot:focus input, -.dot:hover input, -.dot.selected input { - color: white; -} - -.dot:focus .selection-bar, -.dot:hover .selection-bar, -.dot.drag-target .selection-bar { - border-color: #b2b2b2; - opacity: 1; -} - -.dot.selected .selection-bar { - opacity: 1; -} diff --git a/chrome/browser/resources/aura/app_list/app_list.html b/chrome/browser/resources/aura/app_list/app_list.html deleted file mode 100644 index f642fe0..0000000 --- a/chrome/browser/resources/aura/app_list/app_list.html +++ /dev/null @@ -1,79 +0,0 @@ -<!DOCTYPE HTML> -<html i18n-values="dir:textdirection;"> -<head> -<meta charset="utf-8"> - -<link rel="stylesheet" href="../../ntp4/apps_page.css"> -<link rel="stylesheet" href="../../ntp4/nav_dot.css"> -<link rel="stylesheet" href="../../ntp4/tile_page.css"> -<link rel="stylesheet" href="app_list.css"> - -<!-- It's important that this be the first script loaded. --> -<script src="../../ntp4/logging.js"></script> - -<script src="chrome://resources/js/cr.js"></script> -<script src="chrome://resources/js/cr/event_target.js"></script> -<script src="chrome://resources/js/cr/ui.js"></script> -<script src="chrome://resources/js/cr/ui/card_slider.js"></script> -<script src="chrome://resources/js/cr/ui/drag_wrapper.js"></script> -<script src="chrome://resources/js/cr/ui/touch_handler.js"></script> -<script src="chrome://resources/js/event_tracker.js"></script> -<script src="chrome://resources/js/local_strings.js"></script> -<script src="chrome://resources/js/util.js"></script> - -<script src="../../ntp4/tile_page.js"></script> -<script src="../../ntp4/apps_page.js"></script> -<script src="../../ntp4/dot_list.js"></script> -<script src="../../ntp4/page_list_view.js"></script> -<script src="../../ntp4/nav_dot.js"></script> -<script src="../../ntp4/trash.js"></script> - -<script src="app_list.js"></script> -<script src="apps_view.js"></script> -</head> - -<body> - <div id="container"> - <div id="card-slider-frame"> - <div id="page-list"></div> - </div> - <div id="footer"> - <div id="footer-border"></div> - <div id="footer-content"> - <ul id="dot-list"> - </ul> - </div> - </div> - </div> -</body> - -<!-- Apps promo. --> -<div id="apps-promo-extras-template" class="apps-promo-extras" hidden> - <h3 class="apps-promo-heading"></h3> - <a class="apps-promo-link g-button-basic"><a/> -</div> - -<!-- App Contents w/ Large Icon --> -<div id="app-large-icon-template" class="app-contents" hidden> - <div class="app-img-container"> - <img class="invisible"> - </div> - <span class="title"></span> -</div> - -<!-- App Contents w/ Small Icon --> -<div id="app-small-icon-template" class="app-contents" hidden> - <div class="app-icon-div"> - <div class="app-img-container"> - <img class="invisible"> - </div> - <div class="color-stripe"></div> - </div> - <span class="title"></span> -</div> - -<script src="chrome://app-list/strings.js"></script> -<script src="chrome://resources/js/i18n_template.js"></script> -<script src="chrome://resources/js/i18n_process.js"></script> - -</html> diff --git a/chrome/browser/resources/aura/app_list/app_list.js b/chrome/browser/resources/aura/app_list/app_list.js deleted file mode 100644 index dc12805..0000000 --- a/chrome/browser/resources/aura/app_list/app_list.js +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2011 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. - -/** - * @fileoverview App list UI. - * For now, most of its logic is borrowed from ntp4. - */ - -// Use an anonymous function to enable strict mode just for this file (which -// will be concatenated with other files when embedded in Chrome -cr.define('appList', function() { - 'use strict'; - - /** - * AppsView instance. - * @type {!Object|undefined} - */ - var appsView; - - /** - * Invoked at startup once the DOM is available to initialize the app. - */ - function load() { - appsView = new appList.AppsView(); - - document.addEventListener('click', onDocClick); - } - - /** - * Document click event handler. - */ - function onDocClick(e) { - // Close if click is on body, or not on app, paging dot or its children. - if (e.target == document.body || - (!e.target.classList.contains('app') && - !e.target.classList.contains('dot') && - !findAncestorByClass(e.target, 'dot'))) { - chrome.send('close'); - } - } - - /** - * Wrappers to forward the callback to corresponding PageListView member. - */ - function appAdded(appData, opt_highlight) { - appsView.appAdded(appData, opt_highlight); - } - - function appRemoved(appData, isUninstall) { - appsView.appRemoved(appData, isUninstall); - } - - function appsPrefChangeCallback(data) { - appsView.appsPrefChangedCallback(data); - } - - function enterRearrangeMode() { - appsView.enterRearrangeMode(); - } - - function getAppsCallback(data) { - appsView.getAppsCallback(data); - chrome.send('onAppsLoaded'); - } - - function getAppsPageIndex(page) { - return appsView.getAppsPageIndex(page); - } - - function getCardSlider() { - return appsView.cardSlider; - } - - function leaveRearrangeMode(e) { - appsView.leaveRearrangeMode(e); - } - - function saveAppPageName(appPage, name) { - appsView.saveAppPageName(appPage, name); - } - - function setAppToBeHighlighted(appId) { - appsView.highlightAppId = appId; - } - - // Return an object with all the exports - return { - appAdded: appAdded, - appRemoved: appRemoved, - appsPrefChangeCallback: appsPrefChangeCallback, - enterRearrangeMode: enterRearrangeMode, - getAppsPageIndex: getAppsPageIndex, - getAppsCallback: getAppsCallback, - getCardSlider: getCardSlider, - leaveRearrangeMode: leaveRearrangeMode, - load: load, - saveAppPageName: saveAppPageName, - setAppToBeHighlighted: setAppToBeHighlighted - }; -}); - -// publish ntp globals -// TODO(xiyuan): update the following when content handlers are changed to use -// ntp namespace. -var appsPrefChangeCallback = appList.appsPrefChangeCallback; -var getAppsCallback = appList.getAppsCallback; - -var ntp4 = ntp4 || {}; -ntp4.appAdded = appList.appAdded; -ntp4.appRemoved = appList.appRemoved; -ntp4.enterRearrangeMode = appList.enterRearrangeMode; -ntp4.getAppsPageIndex = appList.getAppsPageIndex; -ntp4.getCardSlider = appList.getCardSlider; -ntp4.leaveRearrangeMode = appList.leaveRearrangeMode; -ntp4.saveAppPageName = appList.saveAppPageName; -ntp4.setAppToBeHighlighted = appList.setAppToBeHighlighted; - -document.addEventListener('DOMContentLoaded', appList.load); diff --git a/chrome/browser/resources/aura/app_list/apps_view.js b/chrome/browser/resources/aura/app_list/apps_view.js deleted file mode 100644 index 8c54e49..0000000 --- a/chrome/browser/resources/aura/app_list/apps_view.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2011 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. - -/** - * @fileoverview AppListView implementation. - */ - -cr.define('appList', function() { - 'use strict'; - - /** - * Creates an AppsView object. - * @constructor - * @extends {PageListView} - */ - function AppsView() { - this.initialize(getRequiredElement('page-list'), - getRequiredElement('dot-list'), - getRequiredElement('card-slider-frame')); - } - - AppsView.prototype = { - __proto__: ntp4.PageListView.prototype - }; - - // Return an object with all the exports - return { - AppsView: AppsView - }; -}); diff --git a/chrome/browser/ui/views/aura/app_list_window.cc b/chrome/browser/ui/views/aura/app_list_window.cc deleted file mode 100644 index 7bfcaa2..0000000 --- a/chrome/browser/ui/views/aura/app_list_window.cc +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2011 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 "chrome/browser/ui/views/aura/app_list_window.h" - -#include "ash/shell.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/views/dom_view.h" -#include "chrome/browser/ui/webui/aura/app_list_ui.h" -#include "chrome/common/url_constants.h" -#include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/public/browser/web_contents.h" -#include "ui/views/widget/widget.h" - -using content::WebContents; - -AppListWindow::AppListWindow(const gfx::Rect& bounds, - const ash::ShellDelegate::SetWidgetCallback& callback) - : widget_(NULL), - contents_(NULL), - callback_(callback), - content_rendered_(false), - apps_loaded_(false) { - Init(bounds); -} - -AppListWindow::~AppListWindow() { -} - -void AppListWindow::DeleteDelegate() { - delete this; -} - -views::View* AppListWindow::GetInitiallyFocusedView() { - return contents_; -} - -views::Widget* AppListWindow::GetWidget() { - return widget_; -} - -const views::Widget* AppListWindow::GetWidget() const { - return widget_; -} - -bool AppListWindow::HandleContextMenu(const ContextMenuParams& params) { - // Do not show the context menu for non-debug build. -#if !defined(NDEBUG) - return false; -#else - return true; -#endif -} - -void AppListWindow::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { - if (event.windowsKeyCode == ui::VKEY_ESCAPE) - Close(); -} - -bool AppListWindow::TakeFocus(bool reverse) { - // Forward the focus back to web contents. - contents_->dom_contents()->web_contents()->FocusThroughTabTraversal(reverse); - return true; -} - -bool AppListWindow::IsPopupOrPanel(const WebContents* source) const { - return true; -} - -void AppListWindow::OnRenderHostCreated(RenderViewHost* host) { -} - -void AppListWindow::OnTabMainFrameLoaded() { -} - -void AppListWindow::OnTabMainFrameFirstRender() { - content_rendered_ = true; - SetWidgetIfReady(); -} - -void AppListWindow::Close() { - // We should be visible when running here and toggle actually closes us. - ash::Shell::GetInstance()->ToggleAppList(); -} - -void AppListWindow::OnAppsLoaded() { - apps_loaded_ = true; - SetWidgetIfReady(); -} - -void AppListWindow::Init(const gfx::Rect& bounds) { - DCHECK(!widget_ && !contents_); - - contents_ = new DOMView(); - contents_->Init(ProfileManager::GetDefaultProfile(), NULL); - - WebContents* tab = contents_->dom_contents()->web_contents(); - tab_watcher_.reset(new TabFirstRenderWatcher(tab, this)); - tab->SetDelegate(this); - - contents_->LoadURL(GURL(chrome::kChromeUIAppListURL)); - static_cast<AppListUI*>(tab->GetWebUI())->set_delegate(this); - - // Use a background with transparency to trigger transparent webkit. - SkBitmap background; - background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); - background.allocPixels(); - background.eraseARGB(0x00, 0x00, 0x00, 0x00); - - RenderViewHost* host = tab->GetRenderViewHost(); - host->view()->SetBackground(background); - - views::Widget::InitParams widget_params( - views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); - widget_params.bounds = bounds; - widget_params.delegate = this; - widget_params.keep_on_top = true; - widget_params.transparent = true; - - widget_ = new views::Widget; - widget_->Init(widget_params); - widget_->SetContentsView(contents_); -} - -void AppListWindow::SetWidgetIfReady() { - if (content_rendered_ && apps_loaded_) - callback_.Run(widget_); -} diff --git a/chrome/browser/ui/views/aura/app_list_window.h b/chrome/browser/ui/views/aura/app_list_window.h deleted file mode 100644 index 9fe5191..0000000 --- a/chrome/browser/ui/views/aura/app_list_window.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2011 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 CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ -#define CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ -#pragma once - -#include "ash/shell_delegate.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/tab_first_render_watcher.h" -#include "chrome/browser/ui/webui/aura/app_list_ui_delegate.h" -#include "content/public/browser/web_contents_delegate.h" -#include "ui/views/widget/widget_delegate.h" - -class DOMView; - -namespace views { -class Widget; -} - -class AppListWindow : public views::WidgetDelegate, - public content::WebContentsDelegate, - public TabFirstRenderWatcher::Delegate, - public AppListUIDelegate { - public: - AppListWindow( - const gfx::Rect& bounds, - const ash::ShellDelegate::SetWidgetCallback& callback); - - private: - virtual ~AppListWindow(); - - // views::WidgetDelegate overrides: - virtual void DeleteDelegate() OVERRIDE; - virtual views::View* GetInitiallyFocusedView() OVERRIDE; - virtual views::Widget* GetWidget() OVERRIDE; - virtual const views::Widget* GetWidget() const OVERRIDE; - - // content::WebContentsDelegate implementation: - virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; - virtual void HandleKeyboardEvent( - const NativeWebKeyboardEvent& event) OVERRIDE; - virtual bool IsPopupOrPanel( - const content::WebContents* source) const OVERRIDE; - virtual bool TakeFocus(bool reverse) OVERRIDE; - - // TabFirstRenderWatcher::Delegate implementation: - virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; - virtual void OnTabMainFrameLoaded() OVERRIDE; - virtual void OnTabMainFrameFirstRender() OVERRIDE; - - // AppListUIDelegate implementation: - virtual void Close() OVERRIDE; - virtual void OnAppsLoaded() OVERRIDE; - - // Initializes the window. - void Init(const gfx::Rect& bounds); - - // Check and fire set widget callback if we are ready. - void SetWidgetIfReady(); - - views::Widget* widget_; - DOMView* contents_; - - // Monitors TabContents and set |content_rendered_| flag when it's rendered. - scoped_ptr<TabFirstRenderWatcher> tab_watcher_; - - // Callback to set app list widget when it's ready. - ash::ShellDelegate::SetWidgetCallback callback_; - - // True if webui is rendered. - bool content_rendered_; - - // True if apps info is loaded by webui. - bool apps_loaded_; - - DISALLOW_COPY_AND_ASSIGN(AppListWindow); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ diff --git a/chrome/browser/ui/views/aura/chrome_shell_delegate.cc b/chrome/browser/ui/views/aura/chrome_shell_delegate.cc index 1e8338c..52bb9a2 100644 --- a/chrome/browser/ui/views/aura/chrome_shell_delegate.cc +++ b/chrome/browser/ui/views/aura/chrome_shell_delegate.cc @@ -12,7 +12,6 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/views/aura/app_list_window.h" #include "chrome/browser/ui/views/aura/app_list/app_list_model_builder.h" #include "chrome/browser/ui/views/aura/app_list/app_list_view_delegate.h" #include "chrome/browser/ui/views/aura/status_area_host_aura.h" @@ -68,13 +67,6 @@ views::Widget* ChromeShellDelegate::CreateStatusArea() { return status_area_widget; } -void ChromeShellDelegate::RequestAppListWidget( - const gfx::Rect& bounds, - const SetWidgetCallback& callback) { - // AppListWindow deletes itself when closed. - new AppListWindow(bounds, callback); -} - void ChromeShellDelegate::BuildAppListModel(ash::AppListModel* model) { AppListModelBuilder builder(ProfileManager::GetDefaultProfile(), model); diff --git a/chrome/browser/ui/views/aura/chrome_shell_delegate.h b/chrome/browser/ui/views/aura/chrome_shell_delegate.h index 4db466b..b4133b9 100644 --- a/chrome/browser/ui/views/aura/chrome_shell_delegate.h +++ b/chrome/browser/ui/views/aura/chrome_shell_delegate.h @@ -38,9 +38,6 @@ class ChromeShellDelegate : public ash::ShellDelegate { // ash::ShellDelegate overrides; virtual void CreateNewWindow() OVERRIDE; virtual views::Widget* CreateStatusArea() OVERRIDE; - virtual void RequestAppListWidget( - const gfx::Rect& bounds, - const SetWidgetCallback& callback) OVERRIDE; virtual void BuildAppListModel(ash::AppListModel* model) OVERRIDE; virtual ash::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual std::vector<aura::Window*> GetCycleWindowList() const OVERRIDE; diff --git a/chrome/browser/ui/webui/aura/app_list_ui.cc b/chrome/browser/ui/webui/aura/app_list_ui.cc deleted file mode 100644 index 994135d..0000000 --- a/chrome/browser/ui/webui/aura/app_list_ui.cc +++ /dev/null @@ -1,133 +0,0 @@ -// 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 "chrome/browser/ui/webui/aura/app_list_ui.h" - -#include "base/utf_string_conversions.h" -#include "chrome/browser/google/google_util.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" -#include "chrome/browser/ui/webui/aura/app_list_ui_delegate.h" -#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" -#include "chrome/common/extensions/extension_constants.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_ui_message_handler.h" -#include "grit/browser_resources.h" -#include "grit/chromium_strings.h" -#include "grit/generated_resources.h" -#include "ui/base/l10n/l10n_util.h" - -using content::WebContents; -using content::WebUIMessageHandler; - -namespace { - -static const int kPageIdOffset = 10; -static const int kIndexMask = (1 << kPageIdOffset) - 1; - -// TODO(xiyuan): Merge this with the one on ntp_resource_cache. -string16 GetUrlWithLang(const GURL& url) { - return ASCIIToUTF16(google_util::AppendGoogleLocaleParam(url).spec()); -} - -ChromeWebUIDataSource* CreateAppListUIHTMLSource(PrefService* prefs) { - ChromeWebUIDataSource* source = - new ChromeWebUIDataSource(chrome::kChromeUIAppListHost); - - DictionaryValue localized_strings; - localized_strings.SetString("title", - l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); - localized_strings.SetString("appuninstall", - l10n_util::GetStringFUTF16( - IDS_EXTENSIONS_UNINSTALL, - l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); - localized_strings.SetString("appoptions", - l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS)); - localized_strings.SetString("appcreateshortcut", - l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT)); - localized_strings.SetString("appDefaultPageName", - l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME)); - localized_strings.SetString("applaunchtypepinned", - l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_PINNED)); - localized_strings.SetString("applaunchtyperegular", - l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR)); - localized_strings.SetString("applaunchtypewindow", - l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); - localized_strings.SetString("applaunchtypefullscreen", - l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN)); - localized_strings.SetString("web_store_title", - l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); - localized_strings.SetString("web_store_url", - GetUrlWithLang(GURL(extension_urls::GetWebstoreLaunchURL()))); - - localized_strings.SetString("search-box-hint", - l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); - - // TODO(xiyuan): Maybe need to use another prefs for app list. - int shown_page = prefs->GetInteger(prefs::kNTPShownPage); - localized_strings.SetInteger("shown_page_type", shown_page & ~kIndexMask); - localized_strings.SetInteger("shown_page_index", shown_page & kIndexMask); - - source->AddLocalizedStrings(localized_strings); - source->set_json_path("strings.js"); - source->set_default_resource(IDR_APP_LIST_HTML); - return source; -} - -class AppListHandler : public WebUIMessageHandler { - public: - AppListHandler() {} - virtual ~AppListHandler() {} - - // WebUIMessageHandler - virtual void RegisterMessages() OVERRIDE; - - private: - AppListUI* app_list_ui() const { - return static_cast<AppListUI*>(web_ui()); - } - - void HandleClose(const base::ListValue* args); - void HandleAppsLoaded(const base::ListValue* args); - - DISALLOW_COPY_AND_ASSIGN(AppListHandler); -}; - -void AppListHandler::RegisterMessages() { - web_ui()->RegisterMessageCallback("close", - base::Bind(&AppListHandler::HandleClose, base::Unretained(this))); - web_ui()->RegisterMessageCallback("onAppsLoaded", - base::Bind(&AppListHandler::HandleAppsLoaded, base::Unretained(this))); -} - -void AppListHandler::HandleClose(const base::ListValue* args) { - if (app_list_ui()->delegate()) - app_list_ui()->delegate()->Close(); -} - -void AppListHandler::HandleAppsLoaded(const base::ListValue* args) { - if (app_list_ui()->delegate()) - app_list_ui()->delegate()->OnAppsLoaded(); -} - -} // namespace - -AppListUI::AppListUI(WebContents* contents) - : WebUI(contents), - delegate_(NULL) { - AddMessageHandler(new AppListHandler); - - Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); - ExtensionService* service = profile->GetExtensionService(); - if (service) - AddMessageHandler(new AppLauncherHandler(service)); - - // Set up the source. - PrefService* prefs = profile->GetPrefs(); - profile->GetChromeURLDataManager()->AddDataSource( - CreateAppListUIHTMLSource(prefs)); -} diff --git a/chrome/browser/ui/webui/aura/app_list_ui.h b/chrome/browser/ui/webui/aura/app_list_ui.h deleted file mode 100644 index 138ce67..0000000 --- a/chrome/browser/ui/webui/aura/app_list_ui.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_AURA_APP_LIST_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_AURA_APP_LIST_UI_H_ -#pragma once - -#include "content/browser/webui/web_ui.h" - -class AppListUIDelegate; - -class AppListUI : public WebUI { - public: - explicit AppListUI(content::WebContents* contents); - - AppListUIDelegate* delegate() const { - return delegate_; - } - - void set_delegate(AppListUIDelegate* delegate) { - delegate_ = delegate; - } - - private: - AppListUIDelegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(AppListUI); -}; - -#endif // CHROME_BROWSER_UI_WEBUI_AURA_APP_LIST_UI_H_ diff --git a/chrome/browser/ui/webui/aura/app_list_ui_delegate.h b/chrome/browser/ui/webui/aura/app_list_ui_delegate.h deleted file mode 100644 index a23d376..0000000 --- a/chrome/browser/ui/webui/aura/app_list_ui_delegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_AURA_APP_LIST_UI_DELEGATE_H_ -#define CHROME_BROWSER_UI_WEBUI_AURA_APP_LIST_UI_DELEGATE_H_ -#pragma once - -class AppListUIDelegate { - public: - // Close AppListUI. - virtual void Close() = 0; - - // Invoked when apps are loaded. - virtual void OnAppsLoaded() = 0; -}; - -#endif // CHROME_BROWSER_UI_WEBUI_AURA_APP_LIST_UI_DELEGATE_H_ diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc index 06368fc..e88c620 100644 --- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc +++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.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. @@ -80,9 +80,6 @@ class ChromeURLContentSecurityPolicyExceptionSet insert(chrome::kChromeUIHttpAuthHost); insert(chrome::kChromeUITabModalConfirmDialogHost); #endif -#if defined(USE_AURA) - insert(chrome::kChromeUIAppListHost); -#endif } }; diff --git a/chrome/browser/ui/webui/chrome_web_ui_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_factory.cc index f412def..0c4747e 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_factory.cc @@ -80,9 +80,7 @@ #include "chrome/browser/ui/webui/certificate_viewer_ui.h" #endif -#if defined(USE_AURA) -#include "chrome/browser/ui/webui/aura/app_list_ui.h" -#else +#if !defined(USE_AURA) #include "chrome/browser/ui/webui/input_window_dialog_ui.h" #endif @@ -283,10 +281,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebContents* web_contents, } #endif -#if defined(USE_AURA) - if (url.host() == chrome::kChromeUIAppListHost) - return &NewWebUI<AppListUI>; -#else +#if !defined(USE_AURA) if (url.host() == chrome::kChromeUIInputWindowDialogHost) return &NewWebUI<InputWindowDialogUI>; #endif diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 259b787..f24f58e 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3334,8 +3334,6 @@ 'browser/ui/views/app_menu_button_win.h', 'browser/ui/views/appcache_info_view.cc', 'browser/ui/views/appcache_info_view.h', - 'browser/ui/views/aura/app_list_window.cc', - 'browser/ui/views/aura/app_list_window.h', 'browser/ui/views/aura/app_list/app_list_model_builder.cc', 'browser/ui/views/aura/app_list/app_list_model_builder.h', 'browser/ui/views/aura/app_list/app_list_view_delegate.cc', @@ -3706,9 +3704,6 @@ 'browser/ui/webui/about_ui.h', 'browser/ui/webui/active_downloads_ui.cc', 'browser/ui/webui/active_downloads_ui.h', - 'browser/ui/webui/aura/app_list_ui_delegate.h', - 'browser/ui/webui/aura/app_list_ui.cc', - 'browser/ui/webui/aura/app_list_ui.h', 'browser/ui/webui/bookmarks_ui.cc', 'browser/ui/webui/bookmarks_ui.h', 'browser/ui/webui/feedback_ui.cc', diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index f85a85f..809c75f 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -113,10 +113,6 @@ const char kChromeUITabModalConfirmDialogURL[] = "chrome://tab-modal-confirm-dialog/"; #endif -#if defined(USE_AURA) -const char kChromeUIAppListURL[] = "chrome://app-list/"; -#endif - // Add Chrome UI hosts here, in alphabetical order. // Add hosts to kChromePaths in browser_about_handler.cc to be listed by // chrome://chrome-urls (about:about) and the built-in AutocompleteProvider. @@ -246,10 +242,6 @@ const char kChromeUIHttpAuthHost[] = "http-auth"; const char kChromeUITabModalConfirmDialogHost[] = "tab-modal-confirm-dialog"; #endif -#if defined(USE_AURA) -const char kChromeUIAppListHost[] = "app-list"; -#endif - // Option sub pages. // Add sub page paths to kChromeSettingsSubPages in builtin_provider.cc to be // listed by the built-in AutocompleteProvider. diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index a4dbcfa..d275a28 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -102,10 +102,6 @@ extern const char kChromeUIHttpAuthURL[]; extern const char kChromeUITabModalConfirmDialogURL[]; #endif -#if defined(USE_AURA) -extern const char kChromeUIAppListURL[]; -#endif - // chrome components of URLs. Should be kept in sync with the full URLs above. extern const char kChromeUIAboutHost[]; extern const char kChromeUIAboutPageFrameHost[]; @@ -233,10 +229,6 @@ extern const char kChromeUIHttpAuthHost[]; extern const char kChromeUITabModalConfirmDialogHost[]; #endif -#if defined(USE_AURA) -extern const char kChromeUIAppListHost[]; -#endif - // Options sub-pages. extern const char kAdvancedOptionsSubPage[]; extern const char kAutofillSubPage[]; |