| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "chrome/browser/background/background_contents_service.h" | 10 #include "chrome/browser/background/background_contents_service.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 void BackgroundContents::CloseContents(WebContents* source) { | 118 void BackgroundContents::CloseContents(WebContents* source) { |
| 119 content::NotificationService::current()->Notify( | 119 content::NotificationService::current()->Notify( |
| 120 chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, | 120 chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, |
| 121 content::Source<Profile>(profile_), | 121 content::Source<Profile>(profile_), |
| 122 content::Details<BackgroundContents>(this)); | 122 content::Details<BackgroundContents>(this)); |
| 123 delete this; | 123 delete this; |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool BackgroundContents::ShouldSuppressDialogs(WebContents* source) { | 126 bool BackgroundContents::ShouldSuppressDialogs(WebContents* source, |
| 127 bool before_unload) { |
| 127 return true; | 128 return true; |
| 128 } | 129 } |
| 129 | 130 |
| 130 void BackgroundContents::DidNavigateMainFramePostCommit(WebContents* tab) { | 131 void BackgroundContents::DidNavigateMainFramePostCommit(WebContents* tab) { |
| 131 // Note: because BackgroundContents are only available to extension apps, | 132 // Note: because BackgroundContents are only available to extension apps, |
| 132 // navigation is limited to urls within the app's extent. This is enforced in | 133 // navigation is limited to urls within the app's extent. This is enforced in |
| 133 // RenderView::decidePolicyForNavigation. If BackgroundContents become | 134 // RenderView::decidePolicyForNavigation. If BackgroundContents become |
| 134 // available as a part of the web platform, it probably makes sense to have | 135 // available as a part of the web platform, it probably makes sense to have |
| 135 // some way to scope navigation of a background page to its opener's security | 136 // some way to scope navigation of a background page to its opener's security |
| 136 // origin. Note: if the first navigation is to a URL outside the app's | 137 // origin. Note: if the first navigation is to a URL outside the app's |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 void BackgroundContents::AddDeferredStartRenderHostObserver( | 218 void BackgroundContents::AddDeferredStartRenderHostObserver( |
| 218 extensions::DeferredStartRenderHostObserver* observer) { | 219 extensions::DeferredStartRenderHostObserver* observer) { |
| 219 deferred_start_render_host_observer_list_.AddObserver(observer); | 220 deferred_start_render_host_observer_list_.AddObserver(observer); |
| 220 } | 221 } |
| 221 | 222 |
| 222 void BackgroundContents::RemoveDeferredStartRenderHostObserver( | 223 void BackgroundContents::RemoveDeferredStartRenderHostObserver( |
| 223 extensions::DeferredStartRenderHostObserver* observer) { | 224 extensions::DeferredStartRenderHostObserver* observer) { |
| 224 deferred_start_render_host_observer_list_.RemoveObserver(observer); | 225 deferred_start_render_host_observer_list_.RemoveObserver(observer); |
| 225 } | 226 } |
| OLD | NEW |