File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -60,19 +60,25 @@ NwAppQuitFunction::Run() {
60
60
return RespondNow (NoArguments ());
61
61
}
62
62
63
- ExtensionFunction::ResponseAction
64
- NwAppCloseAllWindowsFunction::Run () {
65
- AppWindowRegistry* registry = AppWindowRegistry::Get (browser_context ());
66
- if (!registry)
67
- return RespondNow (Error (" " ));
68
-
63
+ void NwAppCloseAllWindowsFunction::DoJob (AppWindowRegistry* registry, std::string id) {
69
64
AppWindowRegistry::AppWindowList windows =
70
- registry->GetAppWindowsForApp (extension ()-> id () );
65
+ registry->GetAppWindowsForApp (id );
71
66
72
67
for (AppWindow* window : windows) {
73
68
if (window->NWCanClose ())
74
69
window->GetBaseWindow ()->Close ();
75
70
}
71
+ }
72
+
73
+ ExtensionFunction::ResponseAction
74
+ NwAppCloseAllWindowsFunction::Run () {
75
+ AppWindowRegistry* registry = AppWindowRegistry::Get (browser_context ());
76
+ if (!registry)
77
+ return RespondNow (Error (" " ));
78
+ base::MessageLoop::current ()->task_runner ()->PostTask (
79
+ FROM_HERE,
80
+ base::Bind (&NwAppCloseAllWindowsFunction::DoJob, registry, extension ()->id ()));
81
+
76
82
return RespondNow (NoArguments ());
77
83
}
78
84
Original file line number Diff line number Diff line change 8
8
#include " extensions/browser/extension_function.h"
9
9
10
10
namespace extensions {
11
+ class AppWindowRegistry ;
11
12
12
13
class NwAppQuitFunction : public UIThreadExtensionFunction {
13
14
public:
@@ -27,6 +28,7 @@ class NwAppCloseAllWindowsFunction : public UIThreadExtensionFunction {
27
28
public:
28
29
NwAppCloseAllWindowsFunction () {}
29
30
31
+ static void DoJob (AppWindowRegistry* registry, std::string id);
30
32
protected:
31
33
~NwAppCloseAllWindowsFunction () override {}
32
34
You can’t perform that action at this time.
0 commit comments