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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/renderer_preferences_util.h" | 9 #include "chrome/browser/renderer_preferences_util.h" |
10 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 10 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void BackgroundContents::AddNewContents(WebContents* source, | 103 void BackgroundContents::AddNewContents(WebContents* source, |
104 WebContents* new_contents, | 104 WebContents* new_contents, |
105 WindowOpenDisposition disposition, | 105 WindowOpenDisposition disposition, |
106 const gfx::Rect& initial_pos, | 106 const gfx::Rect& initial_pos, |
107 bool user_gesture, | 107 bool user_gesture, |
108 bool* was_blocked) { | 108 bool* was_blocked) { |
109 delegate_->AddWebContents( | 109 delegate_->AddWebContents( |
110 new_contents, disposition, initial_pos, user_gesture, was_blocked); | 110 new_contents, disposition, initial_pos, user_gesture, was_blocked); |
111 } | 111 } |
112 | 112 |
113 void BackgroundContents::RenderViewGone(base::TerminationStatus status) { | 113 void BackgroundContents::RenderProcessGone(base::TerminationStatus status) { |
114 content::NotificationService::current()->Notify( | 114 content::NotificationService::current()->Notify( |
115 chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, | 115 chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, |
116 content::Source<Profile>(profile_), | 116 content::Source<Profile>(profile_), |
117 content::Details<BackgroundContents>(this)); | 117 content::Details<BackgroundContents>(this)); |
118 | 118 |
119 // Our RenderView went away, so we should go away also, so killing the process | 119 // Our RenderView went away, so we should go away also, so killing the process |
120 // via the TaskManager doesn't permanently leave a BackgroundContents hanging | 120 // via the TaskManager doesn't permanently leave a BackgroundContents hanging |
121 // around the system, blocking future instances from being created | 121 // around the system, blocking future instances from being created |
122 // <http://crbug.com/65189>. | 122 // <http://crbug.com/65189>. |
123 delete this; | 123 delete this; |
124 } | 124 } |
125 | 125 |
126 void BackgroundContents::Observe(int type, | 126 void BackgroundContents::Observe(int type, |
127 const content::NotificationSource& source, | 127 const content::NotificationSource& source, |
128 const content::NotificationDetails& details) { | 128 const content::NotificationDetails& details) { |
129 // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent | 129 // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent |
130 // background pages are closed when the last referencing frame is closed. | 130 // background pages are closed when the last referencing frame is closed. |
131 switch (type) { | 131 switch (type) { |
132 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 132 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
133 case chrome::NOTIFICATION_APP_TERMINATING: { | 133 case chrome::NOTIFICATION_APP_TERMINATING: { |
134 delete this; | 134 delete this; |
135 break; | 135 break; |
136 } | 136 } |
137 default: | 137 default: |
138 NOTREACHED() << "Unexpected notification sent."; | 138 NOTREACHED() << "Unexpected notification sent."; |
139 break; | 139 break; |
140 } | 140 } |
141 } | 141 } |
OLD | NEW |