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

Side by Side Diff: ash/mus/shelf_delegate_mus.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: address comments 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
« no previous file with comments | « ash/mus/keyboard_ui_mus.cc ('k') | ash/mus/shell_delegate_mus.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mus/shelf_delegate_mus.h" 5 #include "ash/mus/shelf_delegate_mus.h"
6 6
7 #include <memory>
8
7 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
8 #include "ash/shelf/shelf_item_delegate.h" 10 #include "ash/shelf/shelf_item_delegate.h"
9 #include "ash/shelf/shelf_item_delegate_manager.h" 11 #include "ash/shelf/shelf_item_delegate_manager.h"
10 #include "ash/shelf/shelf_layout_manager.h" 12 #include "ash/shelf/shelf_layout_manager.h"
11 #include "ash/shelf/shelf_model.h" 13 #include "ash/shelf/shelf_model.h"
12 #include "ash/shelf/shelf_widget.h" 14 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 15 #include "ash/shell.h"
14 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
15 #include "components/mus/public/cpp/property_type_converters.h" 17 #include "components/mus/public/cpp/property_type_converters.h"
16 #include "components/mus/public/cpp/window.h" 18 #include "components/mus/public/cpp/window.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 item.status = user_window->window_has_focus ? STATUS_ACTIVE : STATUS_RUNNING; 181 item.status = user_window->window_has_focus ? STATUS_ACTIVE : STATUS_RUNNING;
180 item.image = GetShelfIconFromBitmap(user_window->window_app_icon); 182 item.image = GetShelfIconFromBitmap(user_window->window_app_icon);
181 183
182 ShelfID shelf_id = model_->next_id(); 184 ShelfID shelf_id = model_->next_id();
183 window_id_to_shelf_id_.insert( 185 window_id_to_shelf_id_.insert(
184 std::make_pair(user_window->window_id, shelf_id)); 186 std::make_pair(user_window->window_id, shelf_id));
185 model_->Add(item); 187 model_->Add(item);
186 188
187 ShelfItemDelegateManager* manager = 189 ShelfItemDelegateManager* manager =
188 Shell::GetInstance()->shelf_item_delegate_manager(); 190 Shell::GetInstance()->shelf_item_delegate_manager();
189 scoped_ptr<ShelfItemDelegate> delegate(new ShelfItemDelegateMus( 191 std::unique_ptr<ShelfItemDelegate> delegate(new ShelfItemDelegateMus(
190 user_window->window_id, user_window->window_title.To<base::string16>(), 192 user_window->window_id, user_window->window_title.To<base::string16>(),
191 user_window_controller_.get())); 193 user_window_controller_.get()));
192 manager->SetShelfItemDelegate(shelf_id, std::move(delegate)); 194 manager->SetShelfItemDelegate(shelf_id, std::move(delegate));
193 } 195 }
194 196
195 void ShelfDelegateMus::OnUserWindowRemoved(uint32_t window_id) { 197 void ShelfDelegateMus::OnUserWindowRemoved(uint32_t window_id) {
196 DCHECK(window_id_to_shelf_id_.count(window_id)); 198 DCHECK(window_id_to_shelf_id_.count(window_id));
197 model_->RemoveItemAt( 199 model_->RemoveItemAt(
198 model_->ItemIndexByID(window_id_to_shelf_id_[window_id])); 200 model_->ItemIndexByID(window_id_to_shelf_id_[window_id]));
199 } 201 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 DCHECK_GE(index, 0); 246 DCHECK_GE(index, 0);
245 ShelfItems::const_iterator iter = model_->ItemByID(shelf_id); 247 ShelfItems::const_iterator iter = model_->ItemByID(shelf_id);
246 DCHECK(iter != model_->items().end()); 248 DCHECK(iter != model_->items().end());
247 ShelfItem item = *iter; 249 ShelfItem item = *iter;
248 item.status = has_focus ? STATUS_ACTIVE : STATUS_RUNNING; 250 item.status = has_focus ? STATUS_ACTIVE : STATUS_RUNNING;
249 model_->Set(index, item); 251 model_->Set(index, item);
250 } 252 }
251 253
252 } // namespace sysui 254 } // namespace sysui
253 } // namespace ash 255 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/keyboard_ui_mus.cc ('k') | ash/mus/shell_delegate_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698