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/tab_contents/background_contents.h" | 5 #include "chrome/browser/tab_contents/background_contents.h" |
6 | 6 |
7 #include "chrome/browser/background/background_contents_service.h" | 7 #include "chrome/browser/background/background_contents_service.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 9 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 void BackgroundContents::CloseContents(WebContents* source) { | 89 void BackgroundContents::CloseContents(WebContents* source) { |
90 content::NotificationService::current()->Notify( | 90 content::NotificationService::current()->Notify( |
91 chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, | 91 chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, |
92 content::Source<Profile>(profile_), | 92 content::Source<Profile>(profile_), |
93 content::Details<BackgroundContents>(this)); | 93 content::Details<BackgroundContents>(this)); |
94 delete this; | 94 delete this; |
95 } | 95 } |
96 | 96 |
97 bool BackgroundContents::ShouldSuppressDialogs() { | 97 bool BackgroundContents::ShouldSuppressDialogs(WebContents* source) { |
98 return true; | 98 return true; |
99 } | 99 } |
100 | 100 |
101 void BackgroundContents::DidNavigateMainFramePostCommit(WebContents* tab) { | 101 void BackgroundContents::DidNavigateMainFramePostCommit(WebContents* tab) { |
102 // Note: because BackgroundContents are only available to extension apps, | 102 // Note: because BackgroundContents are only available to extension apps, |
103 // navigation is limited to urls within the app's extent. This is enforced in | 103 // navigation is limited to urls within the app's extent. This is enforced in |
104 // RenderView::decidePolicyForNavigation. If BackgroundContents become | 104 // RenderView::decidePolicyForNavigation. If BackgroundContents become |
105 // available as a part of the web platform, it probably makes sense to have | 105 // available as a part of the web platform, it probably makes sense to have |
106 // some way to scope navigation of a background page to its opener's security | 106 // some way to scope navigation of a background page to its opener's security |
107 // origin. Note: if the first navigation is to a URL outside the app's | 107 // origin. Note: if the first navigation is to a URL outside the app's |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 151 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
152 case chrome::NOTIFICATION_APP_TERMINATING: { | 152 case chrome::NOTIFICATION_APP_TERMINATING: { |
153 delete this; | 153 delete this; |
154 break; | 154 break; |
155 } | 155 } |
156 default: | 156 default: |
157 NOTREACHED() << "Unexpected notification sent."; | 157 NOTREACHED() << "Unexpected notification sent."; |
158 break; | 158 break; |
159 } | 159 } |
160 } | 160 } |
OLD | NEW |