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

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

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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/shelf/shelf_item_delegate_manager.h" 5 #include "ash/shelf/shelf_item_delegate_manager.h"
6 6
7 #include "ash/shelf/shelf_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"
(...skipping 18 matching lines...) Expand all
29 observers_.AddObserver(observer); 29 observers_.AddObserver(observer);
30 } 30 }
31 31
32 void ShelfItemDelegateManager::RemoveObserver( 32 void ShelfItemDelegateManager::RemoveObserver(
33 ShelfItemDelegateManagerObserver* observer) { 33 ShelfItemDelegateManagerObserver* observer) {
34 observers_.RemoveObserver(observer); 34 observers_.RemoveObserver(observer);
35 } 35 }
36 36
37 void ShelfItemDelegateManager::SetShelfItemDelegate( 37 void ShelfItemDelegateManager::SetShelfItemDelegate(
38 ShelfID id, 38 ShelfID id,
39 scoped_ptr<ShelfItemDelegate> item_delegate) { 39 std::unique_ptr<ShelfItemDelegate> item_delegate) {
40 // If another ShelfItemDelegate is already registered for |id|, we assume 40 // If another ShelfItemDelegate is already registered for |id|, we assume
41 // that this request is replacing ShelfItemDelegate for |id| with 41 // that this request is replacing ShelfItemDelegate for |id| with
42 // |item_delegate|. 42 // |item_delegate|.
43 RemoveShelfItemDelegate(id); 43 RemoveShelfItemDelegate(id);
44 44
45 FOR_EACH_OBSERVER(ShelfItemDelegateManagerObserver, 45 FOR_EACH_OBSERVER(ShelfItemDelegateManagerObserver,
46 observers_, 46 observers_,
47 OnSetShelfItemDelegate(id, item_delegate.get())); 47 OnSetShelfItemDelegate(id, item_delegate.get()));
48 48
49 id_to_item_delegate_map_[id] = item_delegate.release(); 49 id_to_item_delegate_map_[id] = item_delegate.release();
(...skipping 24 matching lines...) Expand all
74 const ShelfItem& old_item) {} 74 const ShelfItem& old_item) {}
75 75
76 void ShelfItemDelegateManager::RemoveShelfItemDelegate(ShelfID id) { 76 void ShelfItemDelegateManager::RemoveShelfItemDelegate(ShelfID id) {
77 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) { 77 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) {
78 delete id_to_item_delegate_map_[id]; 78 delete id_to_item_delegate_map_[id];
79 id_to_item_delegate_map_.erase(id); 79 id_to_item_delegate_map_.erase(id);
80 } 80 }
81 } 81 }
82 82
83 } // namespace ash 83 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698