| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_host.h" | 5 #include "extensions/browser/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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 extension_function_dispatcher_.Dispatch(params, render_view_host()); | 342 extension_function_dispatcher_.Dispatch(params, render_view_host()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void ExtensionHost::OnEventAck() { | 345 void ExtensionHost::OnEventAck() { |
| 346 EventRouter* router = EventRouter::Get(browser_context_); | 346 EventRouter* router = EventRouter::Get(browser_context_); |
| 347 if (router) | 347 if (router) |
| 348 router->OnEventAck(browser_context_, extension_id()); | 348 router->OnEventAck(browser_context_, extension_id()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void ExtensionHost::OnIncrementLazyKeepaliveCount() { | 351 void ExtensionHost::OnIncrementLazyKeepaliveCount() { |
| 352 ProcessManager* pm = ExtensionSystem::Get( | 352 ProcessManager::Get(browser_context_) |
| 353 browser_context_)->process_manager(); | 353 ->IncrementLazyKeepaliveCount(extension()); |
| 354 if (pm) | |
| 355 pm->IncrementLazyKeepaliveCount(extension()); | |
| 356 } | 354 } |
| 357 | 355 |
| 358 void ExtensionHost::OnDecrementLazyKeepaliveCount() { | 356 void ExtensionHost::OnDecrementLazyKeepaliveCount() { |
| 359 ProcessManager* pm = ExtensionSystem::Get( | 357 ProcessManager::Get(browser_context_) |
| 360 browser_context_)->process_manager(); | 358 ->DecrementLazyKeepaliveCount(extension()); |
| 361 if (pm) | |
| 362 pm->DecrementLazyKeepaliveCount(extension()); | |
| 363 } | 359 } |
| 364 | 360 |
| 365 // content::WebContentsObserver | 361 // content::WebContentsObserver |
| 366 | 362 |
| 367 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { | 363 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { |
| 368 render_view_host_ = render_view_host; | 364 render_view_host_ = render_view_host; |
| 369 } | 365 } |
| 370 | 366 |
| 371 void ExtensionHost::RenderViewDeleted(RenderViewHost* render_view_host) { | 367 void ExtensionHost::RenderViewDeleted(RenderViewHost* render_view_host) { |
| 372 // If our RenderViewHost is deleted, fall back to the host_contents' current | 368 // If our RenderViewHost is deleted, fall back to the host_contents' current |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return delegate_->CheckMediaAccessPermission( | 431 return delegate_->CheckMediaAccessPermission( |
| 436 web_contents, security_origin, type, extension()); | 432 web_contents, security_origin, type, extension()); |
| 437 } | 433 } |
| 438 | 434 |
| 439 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { | 435 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { |
| 440 ViewType view_type = extensions::GetViewType(web_contents); | 436 ViewType view_type = extensions::GetViewType(web_contents); |
| 441 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 437 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
| 442 } | 438 } |
| 443 | 439 |
| 444 } // namespace extensions | 440 } // namespace extensions |
| OLD | NEW |