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/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 // TODO(jamescook): Break ExtensionWebContentsObserver into pieces to extract | 141 // TODO(jamescook): Break ExtensionWebContentsObserver into pieces to extract |
142 // the core IPC message handling and URL schema support from Chrome-level | 142 // the core IPC message handling and URL schema support from Chrome-level |
143 // error console message and MessageService support. | 143 // error console message and MessageService support. |
144 ExtensionWebContentsObserver::CreateForWebContents(host_contents()); | 144 ExtensionWebContentsObserver::CreateForWebContents(host_contents()); |
145 | 145 |
146 render_view_host_ = host_contents_->GetRenderViewHost(); | 146 render_view_host_ = host_contents_->GetRenderViewHost(); |
147 | 147 |
148 // Listen for when an extension is unloaded from the same profile, as it may | 148 // Listen for when an extension is unloaded from the same profile, as it may |
149 // be the same extension that this points to. | 149 // be the same extension that this points to. |
150 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 150 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
151 content::Source<BrowserContext>(browser_context_)); | 151 content::Source<BrowserContext>(browser_context_)); |
152 | 152 |
153 // Set up Chrome-level pref observers. | 153 // Set up Chrome-level pref observers. |
154 delegate_->OnExtensionHostCreated(host_contents()); | 154 delegate_->OnExtensionHostCreated(host_contents()); |
155 } | 155 } |
156 | 156 |
157 ExtensionHost::~ExtensionHost() { | 157 ExtensionHost::~ExtensionHost() { |
158 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && | 158 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && |
159 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { | 159 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { |
160 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", | 160 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 content::NotificationService::current()->Notify( | 219 content::NotificationService::current()->Notify( |
220 chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 220 chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
221 content::Source<BrowserContext>(browser_context_), | 221 content::Source<BrowserContext>(browser_context_), |
222 content::Details<ExtensionHost>(this)); | 222 content::Details<ExtensionHost>(this)); |
223 } | 223 } |
224 | 224 |
225 void ExtensionHost::Observe(int type, | 225 void ExtensionHost::Observe(int type, |
226 const content::NotificationSource& source, | 226 const content::NotificationSource& source, |
227 const content::NotificationDetails& details) { | 227 const content::NotificationDetails& details) { |
228 switch (type) { | 228 switch (type) { |
229 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 229 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
230 // The extension object will be deleted after this notification has been | 230 // The extension object will be deleted after this notification has been |
231 // sent. NULL it out so that dirty pointer issues don't arise in cases | 231 // sent. NULL it out so that dirty pointer issues don't arise in cases |
232 // when multiple ExtensionHost objects pointing to the same Extension are | 232 // when multiple ExtensionHost objects pointing to the same Extension are |
233 // present. | 233 // present. |
234 if (extension_ == content::Details<UnloadedExtensionInfo>(details)-> | 234 if (extension_ == content::Details<UnloadedExtensionInfo>(details)-> |
235 extension) { | 235 extension) { |
236 extension_ = NULL; | 236 extension_ = NULL; |
237 } | 237 } |
238 break; | 238 break; |
239 default: | 239 default: |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 bool ExtensionHost::PreHandleGestureEvent( | 437 bool ExtensionHost::PreHandleGestureEvent( |
438 content::WebContents* source, | 438 content::WebContents* source, |
439 const blink::WebGestureEvent& event) { | 439 const blink::WebGestureEvent& event) { |
440 // Disable pinch zooming. | 440 // Disable pinch zooming. |
441 return event.type == blink::WebGestureEvent::GesturePinchBegin || | 441 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
442 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 442 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
443 event.type == blink::WebGestureEvent::GesturePinchEnd; | 443 event.type == blink::WebGestureEvent::GesturePinchEnd; |
444 } | 444 } |
445 | 445 |
446 } // namespace extensions | 446 } // namespace extensions |
OLD | NEW |