Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc

Issue 499733002: Fixed javascript_dialog_manager to compile when extensions are disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/app_modal_dialogs/javascript_dialog_manager.h" 5 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #else 51 #else
52 return NULL; 52 return NULL;
53 #endif // defined(ENABLE_EXTENSIONS) 53 #endif // defined(ENABLE_EXTENSIONS)
54 } 54 }
55 55
56 // Keeps an |extension| from shutting down its lazy background page. If an 56 // Keeps an |extension| from shutting down its lazy background page. If an
57 // extension opens a dialog its lazy background page must stay alive until the 57 // extension opens a dialog its lazy background page must stay alive until the
58 // dialog closes. 58 // dialog closes.
59 void IncrementLazyKeepaliveCount(const Extension* extension, 59 void IncrementLazyKeepaliveCount(const Extension* extension,
60 WebContents* web_contents) { 60 WebContents* web_contents) {
61 #if defined(ENABLE_EXTENSIONS)
61 DCHECK(extension); 62 DCHECK(extension);
62 DCHECK(web_contents); 63 DCHECK(web_contents);
63 extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents); 64 extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents);
64 if (pm) 65 if (pm)
65 pm->IncrementLazyKeepaliveCount(extension); 66 pm->IncrementLazyKeepaliveCount(extension);
67 #endif // defined(ENABLE_EXTENSIONS)
msw 2014/08/22 22:21:50 nit: "// ENABLE_EXTENSIONS" would follow the more
David Yen 2014/08/22 22:28:25 Done. I went ahead and fixed all the other #endif
66 } 68 }
67 69
68 // Allows an |extension| to shut down its lazy background page after a dialog 70 // Allows an |extension| to shut down its lazy background page after a dialog
69 // closes (if nothing else is keeping it open). 71 // closes (if nothing else is keeping it open).
70 void DecrementLazyKeepaliveCount(const Extension* extension, 72 void DecrementLazyKeepaliveCount(const Extension* extension,
71 WebContents* web_contents) { 73 WebContents* web_contents) {
74 #if defined(ENABLE_EXTENSIONS)
72 DCHECK(extension); 75 DCHECK(extension);
73 DCHECK(web_contents); 76 DCHECK(web_contents);
74 extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents); 77 extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents);
75 if (pm) 78 if (pm)
76 pm->DecrementLazyKeepaliveCount(extension); 79 pm->DecrementLazyKeepaliveCount(extension);
80 #endif // defined(ENABLE_EXTENSIONS)
77 } 81 }
78 82
79 class ChromeJavaScriptDialogManager : public JavaScriptDialogManager { 83 class ChromeJavaScriptDialogManager : public JavaScriptDialogManager {
80 public: 84 public:
81 static ChromeJavaScriptDialogManager* GetInstance(); 85 static ChromeJavaScriptDialogManager* GetInstance();
82 86
83 virtual void RunJavaScriptDialog( 87 virtual void RunJavaScriptDialog(
84 WebContents* web_contents, 88 WebContents* web_contents,
85 const GURL& origin_url, 89 const GURL& origin_url,
86 const std::string& accept_lang, 90 const std::string& accept_lang,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 DecrementLazyKeepaliveCount(extension, web_contents); 317 DecrementLazyKeepaliveCount(extension, web_contents);
314 318
315 callback.Run(success, user_input); 319 callback.Run(success, user_input);
316 } 320 }
317 321
318 } // namespace 322 } // namespace
319 323
320 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() { 324 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() {
321 return ChromeJavaScriptDialogManager::GetInstance(); 325 return ChromeJavaScriptDialogManager::GetInstance();
322 } 326 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698