Chromium Code Reviews| Index: chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc |
| diff --git a/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc b/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc |
| index 417a2898d0d5c5ca24a6a3f7a3de5ec48c670b12..cc006d907b9c6d351a68ce690f11156a3252db6f 100644 |
| --- a/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc |
| +++ b/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc |
| @@ -31,16 +31,14 @@ using extensions::Extension; |
| namespace { |
| +#if defined(ENABLE_EXTENSIONS) |
| // Returns the ProcessManager for the browser context from |web_contents|. |
| extensions::ProcessManager* GetExtensionsProcessManager( |
| WebContents* web_contents) { |
| -#if defined(ENABLE_EXTENSIONS) |
| return extensions::ExtensionSystem::Get( |
| web_contents->GetBrowserContext())->process_manager(); |
| -#else |
| - return NULL; |
| -#endif // defined(ENABLE_EXTENSIONS) |
| } |
| +#endif // ENABLE_EXTENSIONS |
| // Returns the extension associated with |web_contents| or NULL if there is no |
| // associated extension (or extensions are not supported). |
| @@ -50,7 +48,7 @@ const Extension* GetExtensionForWebContents(WebContents* web_contents) { |
| return pm->GetExtensionForRenderViewHost(web_contents->GetRenderViewHost()); |
| #else |
| return NULL; |
| -#endif // defined(ENABLE_EXTENSIONS) |
| +#endif // ENABLE_EXTENSIONS |
|
Lei Zhang
2014/08/22 22:39:50
nit: I think most people do // defined(FOO)
David Yen
2014/08/22 23:03:58
Done.
|
| } |
| // Keeps an |extension| from shutting down its lazy background page. If an |
| @@ -58,22 +56,26 @@ const Extension* GetExtensionForWebContents(WebContents* web_contents) { |
| // dialog closes. |
| void IncrementLazyKeepaliveCount(const Extension* extension, |
| WebContents* web_contents) { |
| +#if defined(ENABLE_EXTENSIONS) |
|
msw
2014/08/22 22:36:10
I'm actually not sure what build errors you'd see
David Yen
2014/08/22 23:05:52
Even though technically it can never be called, th
|
| DCHECK(extension); |
| DCHECK(web_contents); |
| extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents); |
| if (pm) |
| pm->IncrementLazyKeepaliveCount(extension); |
| +#endif // ENABLE_EXTENSIONS |
| } |
| // Allows an |extension| to shut down its lazy background page after a dialog |
| // closes (if nothing else is keeping it open). |
| void DecrementLazyKeepaliveCount(const Extension* extension, |
| WebContents* web_contents) { |
| +#if defined(ENABLE_EXTENSIONS) |
| DCHECK(extension); |
| DCHECK(web_contents); |
| extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents); |
| if (pm) |
| pm->DecrementLazyKeepaliveCount(extension); |
| +#endif // ENABLE_EXTENSIONS |
| } |
| class ChromeJavaScriptDialogManager : public JavaScriptDialogManager { |