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/renderer_host/chrome_render_view_host_observer.h" | 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/net/predictor.h" | 9 #include "chrome/browser/net/predictor.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 : content::RenderViewHostObserver(render_view_host), | 27 : content::RenderViewHostObserver(render_view_host), |
28 predictor_(predictor) { | 28 predictor_(predictor) { |
29 SiteInstance* site_instance = render_view_host->site_instance(); | 29 SiteInstance* site_instance = render_view_host->site_instance(); |
30 profile_ = Profile::FromBrowserContext( | 30 profile_ = Profile::FromBrowserContext( |
31 site_instance->GetBrowserContext()); | 31 site_instance->GetBrowserContext()); |
32 | 32 |
33 InitRenderViewHostForExtensions(); | 33 InitRenderViewHostForExtensions(); |
34 } | 34 } |
35 | 35 |
36 ChromeRenderViewHostObserver::~ChromeRenderViewHostObserver() { | 36 ChromeRenderViewHostObserver::~ChromeRenderViewHostObserver() { |
37 RemoveRenderViewHostForExtensions(render_view_host()); | 37 if (render_view_host()) |
| 38 RemoveRenderViewHostForExtensions(render_view_host()); |
38 } | 39 } |
39 | 40 |
40 void ChromeRenderViewHostObserver::RenderViewHostInitialized() { | 41 void ChromeRenderViewHostObserver::RenderViewHostInitialized() { |
41 InitRenderViewForExtensions(); | 42 InitRenderViewForExtensions(); |
42 } | 43 } |
43 | 44 |
44 void ChromeRenderViewHostObserver::RenderViewHostDestroyed( | 45 void ChromeRenderViewHostObserver::RenderViewHostDestroyed( |
45 RenderViewHost* rvh) { | 46 RenderViewHost* rvh) { |
46 RemoveRenderViewHostForExtensions(rvh); | 47 RemoveRenderViewHostForExtensions(rvh); |
47 delete this; | 48 delete this; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (process_manager) | 162 if (process_manager) |
162 process_manager->UnregisterRenderViewHost(rvh); | 163 process_manager->UnregisterRenderViewHost(rvh); |
163 } | 164 } |
164 | 165 |
165 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { | 166 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { |
166 content::NotificationService::current()->Notify( | 167 content::NotificationService::current()->Notify( |
167 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, | 168 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, |
168 content::Source<RenderViewHost>(render_view_host()), | 169 content::Source<RenderViewHost>(render_view_host()), |
169 content::NotificationService::NoDetails()); | 170 content::NotificationService::NoDetails()); |
170 } | 171 } |
OLD | NEW |