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

Unified Diff: ash/wm/resize_shadow_controller.cc

Issue 2472183003: Remove linked_ptr from ash (Closed)
Patch Set: review Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/resize_shadow_controller.h ('k') | ash/wm/video_detector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/resize_shadow_controller.cc
diff --git a/ash/wm/resize_shadow_controller.cc b/ash/wm/resize_shadow_controller.cc
index c0d29ce136caf6f47027772d33183853d56a1fc7..8950d2baee43ae24fd7ae54d95338cc2774da1f0 100644
--- a/ash/wm/resize_shadow_controller.cc
+++ b/ash/wm/resize_shadow_controller.cc
@@ -14,10 +14,8 @@ namespace ash {
ResizeShadowController::ResizeShadowController() {}
ResizeShadowController::~ResizeShadowController() {
- for (WindowShadowMap::const_iterator it = window_shadows_.begin();
- it != window_shadows_.end(); ++it) {
- it->first->RemoveObserver(this);
- }
+ for (const auto& shadow : window_shadows_)
+ shadow.first->RemoveObserver(this);
}
void ResizeShadowController::ShowShadow(aura::Window* window, int hit_test) {
@@ -52,20 +50,22 @@ void ResizeShadowController::OnWindowDestroyed(aura::Window* window) {
}
ResizeShadow* ResizeShadowController::CreateShadow(aura::Window* window) {
- linked_ptr<ResizeShadow> shadow(new ResizeShadow());
- window_shadows_.insert(std::make_pair(window, shadow));
+ auto shadow = base::MakeUnique<ResizeShadow>();
// Attach the layers to this window.
shadow->Init(window);
// Ensure initial bounds are correct.
shadow->Layout(window->bounds());
// Watch for bounds changes.
window->AddObserver(this);
- return shadow.get();
+
+ ResizeShadow* raw_shadow = shadow.get();
+ window_shadows_.insert(std::make_pair(window, std::move(shadow)));
+ return raw_shadow;
}
ResizeShadow* ResizeShadowController::GetShadowForWindow(aura::Window* window) {
- WindowShadowMap::const_iterator it = window_shadows_.find(window);
- return it != window_shadows_.end() ? it->second.get() : NULL;
+ auto it = window_shadows_.find(window);
+ return it != window_shadows_.end() ? it->second.get() : nullptr;
}
} // namespace ash
« no previous file with comments | « ash/wm/resize_shadow_controller.h ('k') | ash/wm/video_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698