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

Side by Side Diff: extensions/components/native_app_window/native_app_window_views.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
« no previous file with comments | « extensions/browser/warning_service.cc ('k') | extensions/renderer/user_script_set.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 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/components/native_app_window/native_app_window_views.h" 5 #include "extensions/components/native_app_window/native_app_window_views.h"
6 6
7 #include "base/threading/sequenced_worker_pool.h" 7 #include "base/threading/sequenced_worker_pool.h"
8 #include "content/public/browser/render_view_host.h" 8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/browser/render_widget_host.h" 9 #include "content/public/browser/render_widget_host.h"
10 #include "content/public/browser/render_widget_host_view.h" 10 #include "content/public/browser/render_widget_host_view.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void NativeAppWindowViews::AddObserver( 187 void NativeAppWindowViews::AddObserver(
188 web_modal::ModalDialogHostObserver* observer) { 188 web_modal::ModalDialogHostObserver* observer) {
189 observer_list_.AddObserver(observer); 189 observer_list_.AddObserver(observer);
190 } 190 }
191 void NativeAppWindowViews::RemoveObserver( 191 void NativeAppWindowViews::RemoveObserver(
192 web_modal::ModalDialogHostObserver* observer) { 192 web_modal::ModalDialogHostObserver* observer) {
193 observer_list_.RemoveObserver(observer); 193 observer_list_.RemoveObserver(observer);
194 } 194 }
195 195
196 void NativeAppWindowViews::OnViewWasResized() { 196 void NativeAppWindowViews::OnViewWasResized() {
197 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 197 for (auto& observer : observer_list_)
198 observer_list_, 198 observer.OnPositionRequiresUpdate();
199 OnPositionRequiresUpdate());
200 } 199 }
201 200
202 // WidgetDelegate implementation. 201 // WidgetDelegate implementation.
203 202
204 void NativeAppWindowViews::OnWidgetMove() { 203 void NativeAppWindowViews::OnWidgetMove() {
205 app_window_->OnNativeWindowChanged(); 204 app_window_->OnNativeWindowChanged();
206 } 205 }
207 206
208 views::View* NativeAppWindowViews::GetInitiallyFocusedView() { 207 views::View* NativeAppWindowViews::GetInitiallyFocusedView() {
209 return web_view_; 208 return web_view_;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 !draggable_region_->contains(location.x(), location.y()); 264 !draggable_region_->contains(location.x(), location.y());
266 } 265 }
267 #endif 266 #endif
268 267
269 return true; 268 return true;
270 } 269 }
271 270
272 // WidgetObserver implementation. 271 // WidgetObserver implementation.
273 272
274 void NativeAppWindowViews::OnWidgetDestroying(views::Widget* widget) { 273 void NativeAppWindowViews::OnWidgetDestroying(views::Widget* widget) {
275 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 274 for (auto& observer : observer_list_)
276 observer_list_, 275 observer.OnHostDestroying();
277 OnHostDestroying());
278 } 276 }
279 277
280 void NativeAppWindowViews::OnWidgetVisibilityChanged(views::Widget* widget, 278 void NativeAppWindowViews::OnWidgetVisibilityChanged(views::Widget* widget,
281 bool visible) { 279 bool visible) {
282 app_window_->OnNativeWindowChanged(); 280 app_window_->OnNativeWindowChanged();
283 } 281 }
284 282
285 void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget, 283 void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget,
286 bool active) { 284 bool active) {
287 app_window_->OnNativeWindowChanged(); 285 app_window_->OnNativeWindowChanged();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 433
436 bool NativeAppWindowViews::CanHaveAlphaEnabled() const { 434 bool NativeAppWindowViews::CanHaveAlphaEnabled() const {
437 return widget_->IsTranslucentWindowOpacitySupported(); 435 return widget_->IsTranslucentWindowOpacitySupported();
438 } 436 }
439 437
440 void NativeAppWindowViews::SetVisibleOnAllWorkspaces(bool always_visible) { 438 void NativeAppWindowViews::SetVisibleOnAllWorkspaces(bool always_visible) {
441 widget_->SetVisibleOnAllWorkspaces(always_visible); 439 widget_->SetVisibleOnAllWorkspaces(always_visible);
442 } 440 }
443 441
444 } // namespace native_app_window 442 } // namespace native_app_window
OLDNEW
« no previous file with comments | « extensions/browser/warning_service.cc ('k') | extensions/renderer/user_script_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698