Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: ash/test/test_shelf_delegate.cc

Issue 152223002: Renames LauncherID, LauncherItem and LauncherItems... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OWNERS Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/test/test_shelf_delegate.h ('k') | ash/test/test_shell_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_shelf_delegate.h" 5 #include "ash/test/test_shelf_delegate.h"
6 6
7 #include "ash/shelf/shelf_item_delegate_manager.h" 7 #include "ash/shelf/shelf_item_delegate_manager.h"
8 #include "ash/shelf/shelf_model.h" 8 #include "ash/shelf/shelf_model.h"
9 #include "ash/shelf/shelf_util.h" 9 #include "ash/shelf/shelf_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 11 matching lines...) Expand all
22 TestShelfDelegate::TestShelfDelegate(ShelfModel* model) 22 TestShelfDelegate::TestShelfDelegate(ShelfModel* model)
23 : model_(model) { 23 : model_(model) {
24 CHECK(!instance_); 24 CHECK(!instance_);
25 instance_ = this; 25 instance_ = this;
26 } 26 }
27 27
28 TestShelfDelegate::~TestShelfDelegate() { 28 TestShelfDelegate::~TestShelfDelegate() {
29 instance_ = NULL; 29 instance_ = NULL;
30 } 30 }
31 31
32 void TestShelfDelegate::AddLauncherItem(aura::Window* window) { 32 void TestShelfDelegate::AddShelfItem(aura::Window* window) {
33 AddLauncherItem(window, STATUS_CLOSED); 33 AddShelfItem(window, STATUS_CLOSED);
34 } 34 }
35 35
36 void TestShelfDelegate::AddLauncherItem(aura::Window* window, 36 void TestShelfDelegate::AddShelfItem(aura::Window* window,
37 ShelfItemStatus status) { 37 ShelfItemStatus status) {
38 LauncherItem item; 38 ShelfItem item;
39 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) 39 if (window->type() == ui::wm::WINDOW_TYPE_PANEL)
40 item.type = TYPE_APP_PANEL; 40 item.type = TYPE_APP_PANEL;
41 else 41 else
42 item.type = TYPE_PLATFORM_APP; 42 item.type = TYPE_PLATFORM_APP;
43 LauncherID id = model_->next_id(); 43 ShelfID id = model_->next_id();
44 item.status = status; 44 item.status = status;
45 model_->Add(item); 45 model_->Add(item);
46 window->AddObserver(this); 46 window->AddObserver(this);
47 47
48 ShelfItemDelegateManager* manager = 48 ShelfItemDelegateManager* manager =
49 Shell::GetInstance()->shelf_item_delegate_manager(); 49 Shell::GetInstance()->shelf_item_delegate_manager();
50 // |manager| owns TestShelfItemDelegate. 50 // |manager| owns TestShelfItemDelegate.
51 scoped_ptr<ShelfItemDelegate> delegate(new TestShelfItemDelegate(window)); 51 scoped_ptr<ShelfItemDelegate> delegate(new TestShelfItemDelegate(window));
52 manager->SetShelfItemDelegate(id, delegate.Pass()); 52 manager->SetShelfItemDelegate(id, delegate.Pass());
53 SetLauncherIDForWindow(id, window); 53 SetShelfIDForWindow(id, window);
54 } 54 }
55 55
56 void TestShelfDelegate::RemoveLauncherItemForWindow(aura::Window* window) { 56 void TestShelfDelegate::RemoveShelfItemForWindow(aura::Window* window) {
57 LauncherID id = GetLauncherIDForWindow(window); 57 ShelfID id = GetShelfIDForWindow(window);
58 if (id == 0) 58 if (id == 0)
59 return; 59 return;
60 int index = model_->ItemIndexByID(id); 60 int index = model_->ItemIndexByID(id);
61 DCHECK_NE(-1, index); 61 DCHECK_NE(-1, index);
62 model_->RemoveItemAt(index); 62 model_->RemoveItemAt(index);
63 window->RemoveObserver(this); 63 window->RemoveObserver(this);
64 } 64 }
65 65
66 void TestShelfDelegate::OnWindowDestroying(aura::Window* window) { 66 void TestShelfDelegate::OnWindowDestroying(aura::Window* window) {
67 RemoveLauncherItemForWindow(window); 67 RemoveShelfItemForWindow(window);
68 } 68 }
69 69
70 void TestShelfDelegate::OnWindowHierarchyChanging( 70 void TestShelfDelegate::OnWindowHierarchyChanging(
71 const HierarchyChangeParams& params) { 71 const HierarchyChangeParams& params) {
72 // The window may be legitimately reparented while staying open if it moves 72 // The window may be legitimately reparented while staying open if it moves
73 // to another display or container. If the window does not have a new parent 73 // to another display or container. If the window does not have a new parent
74 // then remove the shelf item. 74 // then remove the shelf item.
75 if (!params.new_parent) 75 if (!params.new_parent)
76 RemoveLauncherItemForWindow(params.target); 76 RemoveShelfItemForWindow(params.target);
77 } 77 }
78 78
79 void TestShelfDelegate::OnShelfCreated(Shelf* shelf) { 79 void TestShelfDelegate::OnShelfCreated(Shelf* shelf) {
80 } 80 }
81 81
82 void TestShelfDelegate::OnShelfDestroyed(Shelf* shelf) { 82 void TestShelfDelegate::OnShelfDestroyed(Shelf* shelf) {
83 } 83 }
84 84
85 LauncherID TestShelfDelegate::GetLauncherIDForAppID(const std::string& app_id) { 85 ShelfID TestShelfDelegate::GetShelfIDForAppID(const std::string& app_id) {
86 return 0; 86 return 0;
87 } 87 }
88 88
89 const std::string& TestShelfDelegate::GetAppIDForLauncherID(LauncherID id) { 89 const std::string& TestShelfDelegate::GetAppIDForShelfID(ShelfID id) {
90 return base::EmptyString(); 90 return base::EmptyString();
91 } 91 }
92 92
93 void TestShelfDelegate::PinAppWithID(const std::string& app_id) { 93 void TestShelfDelegate::PinAppWithID(const std::string& app_id) {
94 } 94 }
95 95
96 bool TestShelfDelegate::CanPin() const { 96 bool TestShelfDelegate::CanPin() const {
97 return true; 97 return true;
98 } 98 }
99 99
100 bool TestShelfDelegate::IsAppPinned(const std::string& app_id) { 100 bool TestShelfDelegate::IsAppPinned(const std::string& app_id) {
101 return false; 101 return false;
102 } 102 }
103 103
104 void TestShelfDelegate::UnpinAppWithID(const std::string& app_id) { 104 void TestShelfDelegate::UnpinAppWithID(const std::string& app_id) {
105 } 105 }
106 106
107 } // namespace test 107 } // namespace test
108 } // namespace ash 108 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/test_shelf_delegate.h ('k') | ash/test/test_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698