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

Side by Side Diff: ui/snapshot/screenshot_grabber.cc

Issue 2422073002: Reduce FOR_EACH_OBSERVER usage in ui/ (Closed)
Patch Set: remove space 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
« no previous file with comments | « ui/ozone/platform/drm/mus_thread_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/snapshot/screenshot_grabber.h" 5 #include "ui/snapshot/screenshot_grabber.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <climits> 9 #include <climits>
10 #include <string> 10 #include <string>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 base::TimeDelta::FromMilliseconds(kScreenshotMinimumIntervalInMS); 180 base::TimeDelta::FromMilliseconds(kScreenshotMinimumIntervalInMS);
181 } 181 }
182 182
183 void ScreenshotGrabber::NotifyScreenshotCompleted( 183 void ScreenshotGrabber::NotifyScreenshotCompleted(
184 ScreenshotGrabberObserver::Result screenshot_result, 184 ScreenshotGrabberObserver::Result screenshot_result,
185 const base::FilePath& screenshot_path) { 185 const base::FilePath& screenshot_path) {
186 DCHECK(base::MessageLoopForUI::IsCurrent()); 186 DCHECK(base::MessageLoopForUI::IsCurrent());
187 #if defined(USE_AURA) 187 #if defined(USE_AURA)
188 cursor_hider_.reset(); 188 cursor_hider_.reset();
189 #endif 189 #endif
190 FOR_EACH_OBSERVER(ScreenshotGrabberObserver, observers_, 190 for (ScreenshotGrabberObserver& observer : observers_)
191 OnScreenshotCompleted(screenshot_result, screenshot_path)); 191 observer.OnScreenshotCompleted(screenshot_result, screenshot_path);
192 } 192 }
193 193
194 void ScreenshotGrabber::AddObserver(ScreenshotGrabberObserver* observer) { 194 void ScreenshotGrabber::AddObserver(ScreenshotGrabberObserver* observer) {
195 observers_.AddObserver(observer); 195 observers_.AddObserver(observer);
196 } 196 }
197 197
198 void ScreenshotGrabber::RemoveObserver(ScreenshotGrabberObserver* observer) { 198 void ScreenshotGrabber::RemoveObserver(ScreenshotGrabberObserver* observer) {
199 observers_.RemoveObserver(observer); 199 observers_.RemoveObserver(observer);
200 } 200 }
201 201
(...skipping 26 matching lines...) Expand all
228 228
229 ShowNotificationCallback notification_callback(base::Bind( 229 ShowNotificationCallback notification_callback(base::Bind(
230 &ScreenshotGrabber::NotifyScreenshotCompleted, factory_.GetWeakPtr())); 230 &ScreenshotGrabber::NotifyScreenshotCompleted, factory_.GetWeakPtr()));
231 client_->PrepareFileAndRunOnBlockingPool( 231 client_->PrepareFileAndRunOnBlockingPool(
232 screenshot_path, blocking_task_runner_, 232 screenshot_path, blocking_task_runner_,
233 base::Bind(&SaveScreenshot, base::ThreadTaskRunnerHandle::Get(), 233 base::Bind(&SaveScreenshot, base::ThreadTaskRunnerHandle::Get(),
234 notification_callback, screenshot_path, png_data)); 234 notification_callback, screenshot_path, png_data));
235 } 235 }
236 236
237 } // namespace ui 237 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/mus_thread_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698