| 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 "ui/views/controls/webview/webview.h" | 5 #include "ui/views/controls/webview/webview.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
| 8 #include "content/public/browser/navigation_controller.h" | 8 #include "content/public/browser/navigation_controller.h" |
| 9 #include "content/public/browser/notification_details.h" | 9 #include "content/public/browser/notification_details.h" |
| 10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 210 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 211 content::Source<content::WebContents>(web_contents_)); | 211 content::Source<content::WebContents>(web_contents_)); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void WebView::DetachWebContents() { | 215 void WebView::DetachWebContents() { |
| 216 if (web_contents_) { | 216 if (web_contents_) { |
| 217 wcv_holder_->Detach(); | 217 wcv_holder_->Detach(); |
| 218 #if defined(OS_WIN) && !defined(USE_AURA) | 218 #if defined(OS_WIN) && !defined(USE_AURA) |
| 219 // TODO(beng): This should either not be necessary, or be done implicitly by | 219 // TODO(beng): This should either not be necessary, or be done implicitly by |
| 220 // NativeViewHostWin on Detach(). As it stands, this is needed | 220 // NativeViewHostWin on Detach(). As it stands, this is needed so that the |
| 221 // so that the view of the detached contents knows to tell the | 221 // view of the detached contents knows to tell the renderer it's been |
| 222 // renderer its been hidden. | 222 // hidden. |
| 223 // |
| 224 // Moving this out of here would also mean we wouldn't be potentially |
| 225 // calling member functions on a half-destroyed WebContents. |
| 223 ShowWindow(web_contents_->GetNativeView(), SW_HIDE); | 226 ShowWindow(web_contents_->GetNativeView(), SW_HIDE); |
| 224 #endif | 227 #endif |
| 225 } | 228 } |
| 226 registrar_.RemoveAll(); | 229 registrar_.RemoveAll(); |
| 227 } | 230 } |
| 228 | 231 |
| 229 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, | 232 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, |
| 230 content::RenderViewHost* new_host) { | 233 content::RenderViewHost* new_host) { |
| 231 if (GetFocusManager()->GetFocusedView() == this) | 234 if (GetFocusManager()->GetFocusedView() == this) |
| 232 web_contents_->Focus(); | 235 web_contents_->Focus(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 250 return content::WebContents::Create(browser_context, | 253 return content::WebContents::Create(browser_context, |
| 251 site_instance, | 254 site_instance, |
| 252 MSG_ROUTING_NONE, | 255 MSG_ROUTING_NONE, |
| 253 NULL); | 256 NULL); |
| 254 } | 257 } |
| 255 | 258 |
| 256 return contents; | 259 return contents; |
| 257 } | 260 } |
| 258 | 261 |
| 259 } // namespace views | 262 } // namespace views |
| OLD | NEW |