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

Side by Side Diff: extensions/browser/app_window/app_window_geometry_cache.cc

Issue 2424593002: Reduce FOR_EACH_OBSERVER usage in extensions (Closed)
Patch Set: script_observers_ Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/app_window/app_window_geometry_cache.h" 5 #include "extensions/browser/app_window/app_window_geometry_cache.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 value->SetInteger("h", bounds.height()); 125 value->SetInteger("h", bounds.height());
126 value->SetInteger("screen_bounds_x", screen_bounds.x()); 126 value->SetInteger("screen_bounds_x", screen_bounds.x());
127 value->SetInteger("screen_bounds_y", screen_bounds.y()); 127 value->SetInteger("screen_bounds_y", screen_bounds.y());
128 value->SetInteger("screen_bounds_w", screen_bounds.width()); 128 value->SetInteger("screen_bounds_w", screen_bounds.width());
129 value->SetInteger("screen_bounds_h", screen_bounds.height()); 129 value->SetInteger("screen_bounds_h", screen_bounds.height());
130 value->SetInteger("state", it->second.window_state); 130 value->SetInteger("state", it->second.window_state);
131 value->SetString( 131 value->SetString(
132 "ts", base::Int64ToString(it->second.last_change.ToInternalValue())); 132 "ts", base::Int64ToString(it->second.last_change.ToInternalValue()));
133 dict->SetWithoutPathExpansion(it->first, std::move(value)); 133 dict->SetWithoutPathExpansion(it->first, std::move(value));
134 134
135 FOR_EACH_OBSERVER( 135 for (auto& observer : observers_)
136 Observer, 136 observer.OnGeometryCacheChanged(extension_id, it->first, bounds);
137 observers_,
138 OnGeometryCacheChanged(extension_id, it->first, bounds));
139 } 137 }
140 138
141 prefs_->SetGeometryCache(extension_id, std::move(dict)); 139 prefs_->SetGeometryCache(extension_id, std::move(dict));
142 } 140 }
143 } 141 }
144 142
145 bool AppWindowGeometryCache::GetGeometry(const std::string& extension_id, 143 bool AppWindowGeometryCache::GetGeometry(const std::string& extension_id,
146 const std::string& window_id, 144 const std::string& window_id,
147 gfx::Rect* bounds, 145 gfx::Rect* bounds,
148 gfx::Rect* screen_bounds, 146 gfx::Rect* screen_bounds,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 300
303 void AppWindowGeometryCache::AddObserver(Observer* observer) { 301 void AppWindowGeometryCache::AddObserver(Observer* observer) {
304 observers_.AddObserver(observer); 302 observers_.AddObserver(observer);
305 } 303 }
306 304
307 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { 305 void AppWindowGeometryCache::RemoveObserver(Observer* observer) {
308 observers_.RemoveObserver(observer); 306 observers_.RemoveObserver(observer);
309 } 307 }
310 308
311 } // namespace extensions 309 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698