OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_extension_function.h" | 5 #include "chrome/browser/extensions/chrome_extension_function.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/browser_process.h" | |
9 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 10 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
10 #include "chrome/browser/extensions/window_controller.h" | 11 #include "chrome/browser/extensions/window_controller.h" |
11 #include "chrome/browser/extensions/window_controller_list.h" | 12 #include "chrome/browser/extensions/window_controller_list.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
18 #include "extensions/browser/extension_function_dispatcher.h" | 19 #include "extensions/browser/extension_function_dispatcher.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 | 94 |
94 ChromeUIThreadExtensionFunction::~ChromeUIThreadExtensionFunction() { | 95 ChromeUIThreadExtensionFunction::~ChromeUIThreadExtensionFunction() { |
95 } | 96 } |
96 | 97 |
97 ChromeAsyncExtensionFunction::ChromeAsyncExtensionFunction() { | 98 ChromeAsyncExtensionFunction::ChromeAsyncExtensionFunction() { |
98 } | 99 } |
99 | 100 |
100 ChromeAsyncExtensionFunction::~ChromeAsyncExtensionFunction() {} | 101 ChromeAsyncExtensionFunction::~ChromeAsyncExtensionFunction() {} |
101 | 102 |
102 ExtensionFunction::ResponseAction ChromeAsyncExtensionFunction::Run() { | 103 ExtensionFunction::ResponseAction ChromeAsyncExtensionFunction::Run() { |
104 if (g_browser_process->IsShuttingDown()) { | |
105 error_ = "Shutting down."; | |
106 return RespondNow(Error(error_)); | |
Peter Beverloo
2016/07/05 12:42:10
Is this potentially developer-visible at this poin
Devlin
2016/07/06 16:54:23
ChromeAsyncExtensionFunction is just one of many E
dgn
2016/07/07 15:20:17
Thanks for the explanation. I'm not too keen on st
Devlin
2016/07/08 01:01:01
If this solves the immediate problem, we can avoid
dgn
2016/07/12 15:58:19
Done. I could not make the check in ExtensionFunct
Devlin
2016/07/12 16:19:38
Instead you can use ExtensionsBrowserClient. We d
dgn
2016/07/13 20:15:08
Oh wow it makes it much simpler indeed. Thanks! I'
| |
107 } | |
108 | |
103 return RunAsync() ? RespondLater() : RespondNow(Error(error_)); | 109 return RunAsync() ? RespondLater() : RespondNow(Error(error_)); |
104 } | 110 } |
105 | 111 |
106 // static | 112 // static |
107 bool ChromeAsyncExtensionFunction::ValidationFailure( | 113 bool ChromeAsyncExtensionFunction::ValidationFailure( |
108 ChromeAsyncExtensionFunction* function) { | 114 ChromeAsyncExtensionFunction* function) { |
109 return false; | 115 return false; |
110 } | 116 } |
111 | 117 |
112 ChromeSyncExtensionFunction::ChromeSyncExtensionFunction() { | 118 ChromeSyncExtensionFunction::ChromeSyncExtensionFunction() { |
113 } | 119 } |
114 | 120 |
115 ChromeSyncExtensionFunction::~ChromeSyncExtensionFunction() {} | 121 ChromeSyncExtensionFunction::~ChromeSyncExtensionFunction() {} |
116 | 122 |
117 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() { | 123 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() { |
118 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) | 124 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) |
119 : Error(error_)); | 125 : Error(error_)); |
120 } | 126 } |
121 | 127 |
122 // static | 128 // static |
123 bool ChromeSyncExtensionFunction::ValidationFailure( | 129 bool ChromeSyncExtensionFunction::ValidationFailure( |
124 ChromeSyncExtensionFunction* function) { | 130 ChromeSyncExtensionFunction* function) { |
125 return false; | 131 return false; |
126 } | 132 } |
OLD | NEW |