Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/test/test_launcher_delegate.h" | 5 #include "ash/test/test_launcher_delegate.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_model.h" | 7 #include "ash/launcher/launcher_model.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 TestLauncherDelegate* TestLauncherDelegate::instance_ = NULL; | 16 TestLauncherDelegate* TestLauncherDelegate::instance_ = NULL; |
| 17 | 17 |
| 18 TestLauncherDelegate::TestLauncherDelegate(LauncherModel* model) | 18 TestLauncherDelegate::TestLauncherDelegate(LauncherModel* model) |
| 19 : model_(model) { | 19 : model_(model) { |
| 20 CHECK(!instance_); | 20 CHECK(!instance_); |
| 21 instance_ = this; | 21 instance_ = this; |
| 22 } | 22 } |
| 23 | 23 |
| 24 TestLauncherDelegate::~TestLauncherDelegate() { | 24 TestLauncherDelegate::~TestLauncherDelegate() { |
| 25 instance_ = NULL; | 25 instance_ = NULL; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void TestLauncherDelegate::AddLauncherItem(aura::Window* window) { | 28 void TestLauncherDelegate::AddLauncherItem(aura::Window* window) { |
| 29 AddLauncherItem(window, STATUS_CLOSED); | |
| 30 } | |
| 31 | |
| 32 void TestLauncherDelegate::AddLauncherItem( | |
| 33 aura::Window* window, LauncherItemStatus status) { | |
|
sky
2012/05/11 17:00:01
nit: wrap status to next line.
Mr4D (OOO till 08-26)
2012/05/11 18:09:59
Done.
| |
| 29 ash::LauncherItem item; | 34 ash::LauncherItem item; |
| 30 item.type = ash::TYPE_TABBED; | 35 item.type = ash::TYPE_TABBED; |
| 31 DCHECK(window_to_id_.find(window) == window_to_id_.end()); | 36 DCHECK(window_to_id_.find(window) == window_to_id_.end()); |
| 32 window_to_id_[window] = model_->next_id(); | 37 window_to_id_[window] = model_->next_id(); |
| 33 item.image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 38 item.image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
| 34 item.image.allocPixels(); | 39 item.image.allocPixels(); |
| 40 item.status = status; | |
| 35 model_->Add(item); | 41 model_->Add(item); |
| 36 if (observed_windows_.find(window->parent()) == observed_windows_.end()) { | 42 if (observed_windows_.find(window->parent()) == observed_windows_.end()) { |
| 37 window->parent()->AddObserver(this); | 43 window->parent()->AddObserver(this); |
| 38 observed_windows_.insert(window->parent()); | 44 observed_windows_.insert(window->parent()); |
| 39 } | 45 } |
| 40 } | 46 } |
| 41 | 47 |
| 42 void TestLauncherDelegate::OnWillRemoveWindow(aura::Window* window) { | 48 void TestLauncherDelegate::OnWillRemoveWindow(aura::Window* window) { |
| 43 ash::LauncherID id = GetIDByWindow(window); | 49 ash::LauncherID id = GetIDByWindow(window); |
| 44 if (id == 0) | 50 if (id == 0) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 } | 106 } |
| 101 return NULL; | 107 return NULL; |
| 102 } | 108 } |
| 103 | 109 |
| 104 bool TestLauncherDelegate::IsDraggable(const ash::LauncherItem& item) { | 110 bool TestLauncherDelegate::IsDraggable(const ash::LauncherItem& item) { |
| 105 return true; | 111 return true; |
| 106 } | 112 } |
| 107 | 113 |
| 108 } // namespace test | 114 } // namespace test |
| 109 } // namespace ash | 115 } // namespace ash |
| OLD | NEW |