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

Side by Side Diff: ash/shelf/shelf_item_delegate_manager.cc

Issue 97173003: ash: Rename more Launcher classes to Shelf*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: link chrome Created 7 years 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/shelf/shelf_item_delegate_manager.h ('k') | ash/shelf/shelf_menu_model.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/launcher/launcher_item_delegate_manager.h" 5 #include "ash/shelf/shelf_item_delegate_manager.h"
6 6
7 #include "ash/launcher/launcher_item_delegate.h" 7 #include "ash/shelf/shelf_item_delegate.h"
8 #include "ash/shelf/shelf_model.h" 8 #include "ash/shelf/shelf_model.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 LauncherItemDelegateManager::LauncherItemDelegateManager(ShelfModel* model) 15 ShelfItemDelegateManager::ShelfItemDelegateManager(ShelfModel* model)
16 : model_(model) { 16 : model_(model) {
17 DCHECK(model_); 17 DCHECK(model_);
18 model_->AddObserver(this); 18 model_->AddObserver(this);
19 } 19 }
20 20
21 LauncherItemDelegateManager::~LauncherItemDelegateManager() { 21 ShelfItemDelegateManager::~ShelfItemDelegateManager() {
22 model_->RemoveObserver(this); 22 model_->RemoveObserver(this);
23 STLDeleteContainerPairSecondPointers(id_to_item_delegate_map_.begin(), 23 STLDeleteContainerPairSecondPointers(id_to_item_delegate_map_.begin(),
24 id_to_item_delegate_map_.end()); 24 id_to_item_delegate_map_.end());
25 } 25 }
26 26
27 void LauncherItemDelegateManager::SetLauncherItemDelegate( 27 void ShelfItemDelegateManager::SetShelfItemDelegate(
28 ash::LauncherID id, 28 LauncherID id,
29 scoped_ptr<LauncherItemDelegate> item_delegate) { 29 scoped_ptr<ShelfItemDelegate> item_delegate) {
30 // If another LauncherItemDelegate is already registered for |id|, we assume 30 // If another ShelfItemDelegate is already registered for |id|, we assume
31 // that this request is replacing LauncherItemDelegate for |id| with 31 // that this request is replacing ShelfItemDelegate for |id| with
32 // |item_delegate|. 32 // |item_delegate|.
33 RemoveLauncherItemDelegate(id); 33 RemoveShelfItemDelegate(id);
34 id_to_item_delegate_map_[id] = item_delegate.release(); 34 id_to_item_delegate_map_[id] = item_delegate.release();
35 } 35 }
36 36
37 LauncherItemDelegate* LauncherItemDelegateManager::GetLauncherItemDelegate( 37 ShelfItemDelegate* ShelfItemDelegateManager::GetShelfItemDelegate(
38 ash::LauncherID id) { 38 LauncherID id) {
39 if (model_->ItemIndexByID(id) != -1) { 39 if (model_->ItemIndexByID(id) != -1) {
40 // Each LauncherItem has to have a LauncherItemDelegate. 40 // Each LauncherItem has to have a ShelfItemDelegate.
41 DCHECK(id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()); 41 DCHECK(id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end());
42 return id_to_item_delegate_map_[id]; 42 return id_to_item_delegate_map_[id];
43 } 43 }
44 return NULL; 44 return NULL;
45 } 45 }
46 46
47 void LauncherItemDelegateManager::ShelfItemAdded(int index) { 47 void ShelfItemDelegateManager::ShelfItemAdded(int index) {
48 } 48 }
49 49
50 void LauncherItemDelegateManager::ShelfItemRemoved(int index, LauncherID id) { 50 void ShelfItemDelegateManager::ShelfItemRemoved(int index, LauncherID id) {
51 RemoveLauncherItemDelegate(id); 51 RemoveShelfItemDelegate(id);
52 } 52 }
53 53
54 void LauncherItemDelegateManager::ShelfItemMoved(int start_index, 54 void ShelfItemDelegateManager::ShelfItemMoved(int start_index,
55 int target_index) { 55 int target_index) {
56 } 56 }
57 57
58 void LauncherItemDelegateManager::ShelfItemChanged( 58 void ShelfItemDelegateManager::ShelfItemChanged(int index,
59 int index, 59 const LauncherItem& old_item) {
60 const LauncherItem& old_item) {
61 } 60 }
62 61
63 void LauncherItemDelegateManager::ShelfStatusChanged() { 62 void ShelfItemDelegateManager::ShelfStatusChanged() {
64 } 63 }
65 64
66 void LauncherItemDelegateManager::RemoveLauncherItemDelegate( 65 void ShelfItemDelegateManager::RemoveShelfItemDelegate(LauncherID id) {
67 ash::LauncherID id) {
68 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) { 66 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) {
69 delete id_to_item_delegate_map_[id]; 67 delete id_to_item_delegate_map_[id];
70 id_to_item_delegate_map_.erase(id); 68 id_to_item_delegate_map_.erase(id);
71 } 69 }
72 } 70 }
73 71
74 } // namespace ash 72 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_item_delegate_manager.h ('k') | ash/shelf/shelf_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698