summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 00:45:22 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 00:45:22 +0000
commit3e238de9eee09390f4e197ef51a1593c77876dcb (patch)
tree0f5cda5296b7e499d844ce1f0e70845ec9740f4c /ash/test
parent60fda4626b035bfab0b4e2c05be2203d8de3fe9b (diff)
downloadchromium_src-3e238de9eee09390f4e197ef51a1593c77876dcb.zip
chromium_src-3e238de9eee09390f4e197ef51a1593c77876dcb.tar.gz
chromium_src-3e238de9eee09390f4e197ef51a1593c77876dcb.tar.bz2
Revert 133089 - Implement LauncherIconObserver.
This will be used to listen for changes in the launcher view so that panels can be correctly drawn over the corresponding launcher icon. BUG=124115 TEST=aura_shell_unittests Review URL: https://chromiumcodereview.appspot.com/10116011 TBR=dcheng@chromium.org Review URL: https://chromiumcodereview.appspot.com/10142005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/test_launcher_delegate.cc104
-rw-r--r--ash/test/test_launcher_delegate.h69
-rw-r--r--ash/test/test_shell_delegate.cc3
3 files changed, 1 insertions, 175 deletions
diff --git a/ash/test/test_launcher_delegate.cc b/ash/test/test_launcher_delegate.cc
deleted file mode 100644
index 5dab5c6..0000000
--- a/ash/test/test_launcher_delegate.cc
+++ /dev/null
@@ -1,104 +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 "ash/test/test_launcher_delegate.h"
-
-#include "ash/launcher/launcher_model.h"
-#include "ash/wm/window_util.h"
-#include "base/utf_string_conversions.h"
-#include "grit/ui_resources.h"
-#include "ui/aura/window.h"
-
-namespace ash {
-namespace test {
-
-TestLauncherDelegate* TestLauncherDelegate::instance_ = NULL;
-
-TestLauncherDelegate::TestLauncherDelegate(LauncherModel* model)
- : model_(model) {
- CHECK(!instance_);
- instance_ = this;
-}
-
-TestLauncherDelegate::~TestLauncherDelegate() {
- instance_ = NULL;
-}
-
-void TestLauncherDelegate::AddLauncherItem(aura::Window* window) {
- ash::LauncherItem item;
- item.type = ash::TYPE_TABBED;
- DCHECK(window_to_id_.find(window) == window_to_id_.end());
- window_to_id_[window] = model_->next_id();
- item.image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
- item.image.allocPixels();
- model_->Add(item);
- if (observed_windows_.find(window->parent()) == observed_windows_.end()) {
- window->parent()->AddObserver(this);
- observed_windows_.insert(window->parent());
- }
-}
-
-void TestLauncherDelegate::OnWillRemoveWindow(aura::Window* window) {
- ash::LauncherID id = GetIDByWindow(window);
- if (id == 0)
- return;
- int index = model_->ItemIndexByID(id);
- DCHECK_NE(-1, index);
- model_->RemoveItemAt(index);
- window_to_id_.erase(window);
- ObservedWindows::iterator it = observed_windows_.find(window->parent());
- if (it != observed_windows_.end()) {
- window->parent()->RemoveObserver(this);
- observed_windows_.erase(it);
- }
-}
-
-void TestLauncherDelegate::CreateNewTab() {
-}
-
-void TestLauncherDelegate::CreateNewWindow() {
-}
-
-void TestLauncherDelegate::ItemClicked(const ash::LauncherItem& item) {
- aura::Window* window = GetWindowByID(item.id);
- window->Show();
- ash::wm::ActivateWindow(window);
-}
-
-int TestLauncherDelegate::GetBrowserShortcutResourceId() {
- return IDR_AURA_LAUNCHER_BROWSER_SHORTCUT;
-}
-
-string16 TestLauncherDelegate::GetTitle(const ash::LauncherItem& item) {
- return GetWindowByID(item.id)->title();
-}
-
-ui::MenuModel* TestLauncherDelegate::CreateContextMenu(
- const ash::LauncherItem& item) {
- return NULL;
-}
-
-ui::MenuModel* TestLauncherDelegate::CreateContextMenuForLauncher() {
- return NULL;
-}
-
-ash::LauncherID TestLauncherDelegate::GetIDByWindow(aura::Window* window) {
- WindowToID::const_iterator found = window_to_id_.find(window);
- if (found == window_to_id_.end())
- return 0;
- return found->second;
-}
-
-aura::Window* TestLauncherDelegate::GetWindowByID(ash::LauncherID id) {
- for (WindowToID::const_iterator it = window_to_id_.begin();
- it != window_to_id_.end();
- it++) {
- if (it->second == id)
- return it->first;
- }
- return NULL;
-}
-
-} // namespace test
-} // namespace ash
diff --git a/ash/test/test_launcher_delegate.h b/ash/test/test_launcher_delegate.h
deleted file mode 100644
index bfb59df..0000000
--- a/ash/test/test_launcher_delegate.h
+++ /dev/null
@@ -1,69 +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.
-
-#ifndef ASH_TEST_TEST_LAUNCHER_DELEGATE_H_
-#define ASH_TEST_TEST_LAUNCHER_DELEGATE_H_
-#pragma once
-
-#include <map>
-#include <set>
-
-#include "ash/launcher/launcher_delegate.h"
-#include "base/compiler_specific.h"
-#include "ui/aura/window_observer.h"
-
-namespace ash {
-
-class LauncherModel;
-
-namespace test {
-
-// Test implementation of LauncherDelegate.
-// Tests may create icons for windows by calling AddLauncherItem
-class TestLauncherDelegate : public LauncherDelegate,
- public aura::WindowObserver {
- public:
- explicit TestLauncherDelegate(LauncherModel* model);
- ~TestLauncherDelegate();
-
- void AddLauncherItem(aura::Window* window);
-
- static TestLauncherDelegate* instance() { return instance_; }
-
- // WindowObserver implementation
- void OnWillRemoveWindow(aura::Window* window) OVERRIDE;
-
- // LauncherDelegate implementation.
- virtual void CreateNewTab() OVERRIDE;
- virtual void CreateNewWindow() OVERRIDE;
- virtual void ItemClicked(const LauncherItem& item) OVERRIDE;
- virtual int GetBrowserShortcutResourceId() OVERRIDE;
- virtual string16 GetTitle(const LauncherItem& item) OVERRIDE;
- virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item) OVERRIDE;
- virtual ui::MenuModel* CreateContextMenuForLauncher() OVERRIDE;
- virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
-
- private:
- typedef std::map<aura::Window*, ash::LauncherID> WindowToID;
- typedef std::set<aura::Window*> ObservedWindows;
-
- static TestLauncherDelegate* instance_;
-
- aura::Window* GetWindowByID(ash::LauncherID id);
-
- LauncherModel* model_;
-
- // Maps from window to the id we gave it.
- WindowToID window_to_id_;
-
- // Parent windows we are watching.
- ObservedWindows observed_windows_;
-
- DISALLOW_COPY_AND_ASSIGN(TestLauncherDelegate);
-};
-
-} // namespace test
-} // namespace ash
-
-#endif // ASH_TEST_TEST_LAUNCHER_DELEGATE
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index d24d34b..dfb1112 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -9,7 +9,6 @@
#include "ash/screenshot_delegate.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
-#include "ash/test/test_launcher_delegate.h"
#include "grit/ui_resources.h"
#include "ui/aura/window.h"
@@ -59,7 +58,7 @@ void TestShellDelegate::StartPartialScreenshot(
LauncherDelegate* TestShellDelegate::CreateLauncherDelegate(
ash::LauncherModel* model) {
- return new TestLauncherDelegate(model);
+ return NULL;
}
SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate(