| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/background/background_contents.h" | 5 #include "chrome/browser/background/background_contents.h" |
| 6 | 6 |
| 7 #include "base/profiler/scoped_tracker.h" | 7 #include "base/profiler/scoped_tracker.h" |
| 8 #include "chrome/browser/background/background_contents_service.h" | 8 #include "chrome/browser/background/background_contents_service.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 10 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 content::Source<Profile>(profile_), | 155 content::Source<Profile>(profile_), |
| 156 content::Details<BackgroundContents>(this)); | 156 content::Details<BackgroundContents>(this)); |
| 157 | 157 |
| 158 // Our RenderView went away, so we should go away also, so killing the process | 158 // Our RenderView went away, so we should go away also, so killing the process |
| 159 // via the TaskManager doesn't permanently leave a BackgroundContents hanging | 159 // via the TaskManager doesn't permanently leave a BackgroundContents hanging |
| 160 // around the system, blocking future instances from being created | 160 // around the system, blocking future instances from being created |
| 161 // <http://crbug.com/65189>. | 161 // <http://crbug.com/65189>. |
| 162 delete this; | 162 delete this; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void BackgroundContents::DidStartLoading( | 165 void BackgroundContents::DidStartLoading() { |
| 166 content::RenderViewHost* render_view_host) { | |
| 167 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, | 166 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, |
| 168 deferred_start_render_host_observer_list_, | 167 deferred_start_render_host_observer_list_, |
| 169 OnDeferredStartRenderHostDidStartLoading(this)); | 168 OnDeferredStartRenderHostDidStartLoading(this)); |
| 170 } | 169 } |
| 171 | 170 |
| 172 void BackgroundContents::DidStopLoading( | 171 void BackgroundContents::DidStopLoading() { |
| 173 content::RenderViewHost* render_view_host) { | |
| 174 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, | 172 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, |
| 175 deferred_start_render_host_observer_list_, | 173 deferred_start_render_host_observer_list_, |
| 176 OnDeferredStartRenderHostDidStopLoading(this)); | 174 OnDeferredStartRenderHostDidStopLoading(this)); |
| 177 } | 175 } |
| 178 | 176 |
| 179 void BackgroundContents::Observe(int type, | 177 void BackgroundContents::Observe(int type, |
| 180 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
| 181 const content::NotificationDetails& details) { | 179 const content::NotificationDetails& details) { |
| 182 // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent | 180 // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent |
| 183 // background pages are closed when the last referencing frame is closed. | 181 // background pages are closed when the last referencing frame is closed. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 205 | 203 |
| 206 void BackgroundContents::AddDeferredStartRenderHostObserver( | 204 void BackgroundContents::AddDeferredStartRenderHostObserver( |
| 207 extensions::DeferredStartRenderHostObserver* observer) { | 205 extensions::DeferredStartRenderHostObserver* observer) { |
| 208 deferred_start_render_host_observer_list_.AddObserver(observer); | 206 deferred_start_render_host_observer_list_.AddObserver(observer); |
| 209 } | 207 } |
| 210 | 208 |
| 211 void BackgroundContents::RemoveDeferredStartRenderHostObserver( | 209 void BackgroundContents::RemoveDeferredStartRenderHostObserver( |
| 212 extensions::DeferredStartRenderHostObserver* observer) { | 210 extensions::DeferredStartRenderHostObserver* observer) { |
| 213 deferred_start_render_host_observer_list_.RemoveObserver(observer); | 211 deferred_start_render_host_observer_list_.RemoveObserver(observer); |
| 214 } | 212 } |
| OLD | NEW |