Chromium Code Reviews| Index: ash/shell/shell_main.cc |
| diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc |
| index ee62358673789142ec2cf363d4eb0e48a121825e..588091fbfffd0bb83c5c692012ce519bf5f3cd73 100644 |
| --- a/ash/shell/shell_main.cc |
| +++ b/ash/shell/shell_main.cc |
| @@ -23,6 +23,7 @@ |
| #include "base/message_loop.h" |
| #include "grit/ui_resources.h" |
| #include "ui/aura/env.h" |
| +#include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/client/window_types.h" |
| #include "ui/aura/root_window.h" |
| #include "ui/aura/window_observer.h" |
| @@ -60,12 +61,17 @@ class ShellViewsDelegate : public views::TestViewsDelegate { |
| class WindowWatcher : public aura::WindowObserver { |
| public: |
| WindowWatcher() |
| - : window_(ash::Shell::GetInstance()->launcher()->window_container()) { |
| + : window_(ash::Shell::GetInstance()->launcher()->window_container()), |
| + panel_container_( |
| + ash::Shell::GetInstance()->GetContainer( |
| + ash::internal::kShellWindowId_PanelContainer)) { |
| window_->AddObserver(this); |
| + panel_container_->AddObserver(this); |
| } |
| virtual ~WindowWatcher() { |
| window_->RemoveObserver(this); |
| + panel_container_->AddObserver(this); |
| } |
| aura::Window* GetWindowByID(ash::LauncherID id) { |
| @@ -84,14 +90,16 @@ class WindowWatcher : public aura::WindowObserver { |
| // aura::WindowObserver overrides: |
| virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { |
| - if (new_window->type() != aura::client::WINDOW_TYPE_NORMAL) |
| - return; |
| + //if ((new_window->type() != aura::client::WINDOW_TYPE_NORMAL) |
|
sky
2012/03/23 21:41:14
Keep the old code.
|
| + // || (new_window->type() != aura::client::WINDOW_TYPE_PANEL)) |
| + // return; |
| static int image_count = 0; |
| ash::LauncherModel* model = ash::Shell::GetInstance()->launcher()->model(); |
| ash::LauncherItem item; |
| + ash::LauncherID id = model->next_id(); |
| item.type = ash::TYPE_TABBED; |
| - id_to_window_[model->next_id()] = new_window; |
| + id_to_window_[id] = new_window; |
| item.num_tabs = image_count + 1; |
| item.image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
| item.image.allocPixels(); |
| @@ -101,6 +109,7 @@ class WindowWatcher : public aura::WindowObserver { |
| image_count == 2 ? 255 : 0); |
| image_count = (image_count + 1) % 3; |
| model->Add(model->item_count(), item); |
| + new_window->SetProperty(aura::client::kLauncherIDKey, id); |
|
sky
2012/03/23 21:41:14
What is this for?
|
| } |
| virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE { |
| @@ -124,6 +133,8 @@ class WindowWatcher : public aura::WindowObserver { |
| // Window watching for newly created windows to be added to. |
| aura::Window* window_; |
| + aura::Window* panel_container_; |
| + |
| // Maps from window to the id we gave it. |
| IDToWindow id_to_window_; |