| 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 // BackgroundContents only loads once, so this can only be the first time it | 166 // BackgroundContents only loads once, so this can only be the first time it |
| 168 // has started loading. | 167 // has started loading. |
| 169 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, | 168 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, |
| 170 deferred_start_render_host_observer_list_, | 169 deferred_start_render_host_observer_list_, |
| 171 OnDeferredStartRenderHostDidStartFirstLoad(this)); | 170 OnDeferredStartRenderHostDidStartFirstLoad(this)); |
| 172 } | 171 } |
| 173 | 172 |
| 174 void BackgroundContents::DidStopLoading( | 173 void BackgroundContents::DidStopLoading() { |
| 175 content::RenderViewHost* render_view_host) { | |
| 176 // BackgroundContents only loads once, so this can only be the first time | 174 // BackgroundContents only loads once, so this can only be the first time |
| 177 // it has stopped loading. | 175 // it has stopped loading. |
| 178 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, | 176 FOR_EACH_OBSERVER(extensions::DeferredStartRenderHostObserver, |
| 179 deferred_start_render_host_observer_list_, | 177 deferred_start_render_host_observer_list_, |
| 180 OnDeferredStartRenderHostDidStopFirstLoad(this)); | 178 OnDeferredStartRenderHostDidStopFirstLoad(this)); |
| 181 } | 179 } |
| 182 | 180 |
| 183 void BackgroundContents::Observe(int type, | 181 void BackgroundContents::Observe(int type, |
| 184 const content::NotificationSource& source, | 182 const content::NotificationSource& source, |
| 185 const content::NotificationDetails& details) { | 183 const content::NotificationDetails& details) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 209 | 207 |
| 210 void BackgroundContents::AddDeferredStartRenderHostObserver( | 208 void BackgroundContents::AddDeferredStartRenderHostObserver( |
| 211 extensions::DeferredStartRenderHostObserver* observer) { | 209 extensions::DeferredStartRenderHostObserver* observer) { |
| 212 deferred_start_render_host_observer_list_.AddObserver(observer); | 210 deferred_start_render_host_observer_list_.AddObserver(observer); |
| 213 } | 211 } |
| 214 | 212 |
| 215 void BackgroundContents::RemoveDeferredStartRenderHostObserver( | 213 void BackgroundContents::RemoveDeferredStartRenderHostObserver( |
| 216 extensions::DeferredStartRenderHostObserver* observer) { | 214 extensions::DeferredStartRenderHostObserver* observer) { |
| 217 deferred_start_render_host_observer_list_.RemoveObserver(observer); | 215 deferred_start_render_host_observer_list_.RemoveObserver(observer); |
| 218 } | 216 } |
| OLD | NEW |