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

Side by Side Diff: services/navigation/public/cpp/view.cc

Issue 2424613002: Remove usage of FOR_EACH_OBSERVER macro in services/ (Closed)
Patch Set: 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 | « no previous file | services/ui/public/cpp/input_devices/input_device_client.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 "services/navigation/public/cpp/view.h" 5 #include "services/navigation/public/cpp/view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "services/navigation/public/cpp/view_delegate.h" 8 #include "services/navigation/public/cpp/view_delegate.h"
9 #include "services/navigation/public/cpp/view_observer.h" 9 #include "services/navigation/public/cpp/view_observer.h"
10 #include "services/ui/public/cpp/window.h" 10 #include "services/ui/public/cpp/window.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 //////////////////////////////////////////////////////////////////////////////// 94 ////////////////////////////////////////////////////////////////////////////////
95 // View, mojom::ViewClient implementation: 95 // View, mojom::ViewClient implementation:
96 96
97 void View::OpenURL(mojom::OpenURLParamsPtr params) { 97 void View::OpenURL(mojom::OpenURLParamsPtr params) {
98 if (delegate_) 98 if (delegate_)
99 delegate_->OpenURL(this, std::move(params)); 99 delegate_->OpenURL(this, std::move(params));
100 } 100 }
101 101
102 void View::LoadingStateChanged(bool is_loading) { 102 void View::LoadingStateChanged(bool is_loading) {
103 is_loading_ = is_loading; 103 is_loading_ = is_loading;
104 FOR_EACH_OBSERVER(ViewObserver, observers_, LoadingStateChanged(this)); 104 for (auto& observer : observers_)
105 observer.LoadingStateChanged(this);
105 } 106 }
106 107
107 void View::NavigationStateChanged(const GURL& url, 108 void View::NavigationStateChanged(const GURL& url,
108 const mojo::String& title, 109 const mojo::String& title,
109 bool can_go_back, 110 bool can_go_back,
110 bool can_go_forward) { 111 bool can_go_forward) {
111 url_ = url; 112 url_ = url;
112 title_ = base::UTF8ToUTF16(title.get()); 113 title_ = base::UTF8ToUTF16(title.get());
113 can_go_back_ = can_go_back; 114 can_go_back_ = can_go_back;
114 can_go_forward_ = can_go_forward; 115 can_go_forward_ = can_go_forward;
115 FOR_EACH_OBSERVER(ViewObserver, observers_, NavigationStateChanged(this)); 116 for (auto& observer : observers_)
117 observer.NavigationStateChanged(this);
116 } 118 }
117 119
118 void View::LoadProgressChanged(double progress) { 120 void View::LoadProgressChanged(double progress) {
119 FOR_EACH_OBSERVER(ViewObserver, observers_, 121 for (auto& observer : observers_)
120 LoadProgressChanged(this, progress)); 122 observer.LoadProgressChanged(this, progress);
121 } 123 }
122 124
123 void View::UpdateHoverURL(const GURL& url) { 125 void View::UpdateHoverURL(const GURL& url) {
124 FOR_EACH_OBSERVER(ViewObserver, observers_, HoverTargetURLChanged(this, url)); 126 for (auto& observer : observers_)
127 observer.HoverTargetURLChanged(this, url);
125 } 128 }
126 129
127 void View::ViewCreated(mojom::ViewPtr view, 130 void View::ViewCreated(mojom::ViewPtr view,
128 mojom::ViewClientRequest request, 131 mojom::ViewClientRequest request,
129 bool is_popup, 132 bool is_popup,
130 const gfx::Rect& initial_bounds, 133 const gfx::Rect& initial_bounds,
131 bool user_gesture) { 134 bool user_gesture) {
132 if (delegate_) { 135 if (delegate_) {
133 delegate_->ViewCreated( 136 delegate_->ViewCreated(
134 this, base::WrapUnique(new View(std::move(view), std::move(request))), 137 this, base::WrapUnique(new View(std::move(view), std::move(request))),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (from_front) { 173 if (from_front) {
171 auto it = navigation_list_.begin() + count; 174 auto it = navigation_list_.begin() + count;
172 navigation_list_.erase(navigation_list_.begin(), it); 175 navigation_list_.erase(navigation_list_.begin(), it);
173 } else { 176 } else {
174 auto it = navigation_list_.end() - count; 177 auto it = navigation_list_.end() - count;
175 navigation_list_.erase(it, navigation_list_.end()); 178 navigation_list_.erase(it, navigation_list_.end());
176 } 179 }
177 } 180 }
178 181
179 } // namespace navigation 182 } // namespace navigation
OLDNEW
« no previous file with comments | « no previous file | services/ui/public/cpp/input_devices/input_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698