| 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/extensions/api/messaging/message_service.h" | 8 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/renderer_preferences_util.h" | 10 #include "chrome/browser/renderer_preferences_util.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // some way to scope navigation of a background page to its opener's security | 87 // some way to scope navigation of a background page to its opener's security |
| 88 // origin. Note: if the first navigation is to a URL outside the app's | 88 // origin. Note: if the first navigation is to a URL outside the app's |
| 89 // extent a background page will be opened but will remain at about:blank. | 89 // extent a background page will be opened but will remain at about:blank. |
| 90 content::NotificationService::current()->Notify( | 90 content::NotificationService::current()->Notify( |
| 91 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, | 91 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, |
| 92 content::Source<Profile>(profile_), | 92 content::Source<Profile>(profile_), |
| 93 content::Details<BackgroundContents>(this)); | 93 content::Details<BackgroundContents>(this)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Forward requests to add a new WebContents to our delegate. | 96 // Forward requests to add a new WebContents to our delegate. |
| 97 void BackgroundContents::AddNewContents(WebContents* source, | 97 bool BackgroundContents::AddNewContents(WebContents* source, |
| 98 WebContents* new_contents, | 98 WebContents* new_contents, |
| 99 WindowOpenDisposition disposition, | 99 WindowOpenDisposition disposition, |
| 100 const gfx::Rect& initial_pos, | 100 const gfx::Rect& initial_pos, |
| 101 bool user_gesture) { | 101 bool user_gesture) { |
| 102 delegate_->AddWebContents( | 102 return delegate_->AddWebContents( |
| 103 new_contents, disposition, initial_pos, user_gesture); | 103 new_contents, disposition, initial_pos, user_gesture); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void BackgroundContents::RenderViewGone(base::TerminationStatus status) { | 106 void BackgroundContents::RenderViewGone(base::TerminationStatus status) { |
| 107 content::NotificationService::current()->Notify( | 107 content::NotificationService::current()->Notify( |
| 108 chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, | 108 chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, |
| 109 content::Source<Profile>(profile_), | 109 content::Source<Profile>(profile_), |
| 110 content::Details<BackgroundContents>(this)); | 110 content::Details<BackgroundContents>(this)); |
| 111 | 111 |
| 112 // Our RenderView went away, so we should go away also, so killing the process | 112 // Our RenderView went away, so we should go away also, so killing the process |
| (...skipping 12 matching lines...) Expand all Loading... |
| 125 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 125 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 126 case content::NOTIFICATION_APP_TERMINATING: { | 126 case content::NOTIFICATION_APP_TERMINATING: { |
| 127 delete this; | 127 delete this; |
| 128 break; | 128 break; |
| 129 } | 129 } |
| 130 default: | 130 default: |
| 131 NOTREACHED() << "Unexpected notification sent."; | 131 NOTREACHED() << "Unexpected notification sent."; |
| 132 break; | 132 break; |
| 133 } | 133 } |
| 134 } | 134 } |
| OLD | NEW |