OLD | NEW |
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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
17 #include "chrome/browser/extensions/extension_info_map.h" | 17 #include "chrome/browser/extensions/extension_info_map.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "content/public/browser/render_view_host_observer.h" | 22 #include "content/public/browser/render_view_host_observer.h" |
| 23 #include "content/public/common/console_message_level.h" |
23 #include "ipc/ipc_message.h" | 24 #include "ipc/ipc_message.h" |
24 | 25 |
25 class Browser; | 26 class Browser; |
26 class ChromeRenderMessageFilter; | 27 class ChromeRenderMessageFilter; |
27 class ExtensionFunction; | 28 class ExtensionFunction; |
28 class ExtensionFunctionDispatcher; | 29 class ExtensionFunctionDispatcher; |
29 class UIThreadExtensionFunction; | 30 class UIThreadExtensionFunction; |
30 class IOThreadExtensionFunction; | 31 class IOThreadExtensionFunction; |
31 class Profile; | 32 class Profile; |
32 class QuotaLimitHeuristic; | 33 class QuotaLimitHeuristic; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 310 |
310 // Same as above but uses WindowControllerList instead of BrowserList. | 311 // Same as above but uses WindowControllerList instead of BrowserList. |
311 extensions::WindowController* GetExtensionWindowController(); | 312 extensions::WindowController* GetExtensionWindowController(); |
312 | 313 |
313 // Returns true if this function (and the profile and extension that it was | 314 // Returns true if this function (and the profile and extension that it was |
314 // invoked from) can operate on the window wrapped by |window_controller|. | 315 // invoked from) can operate on the window wrapped by |window_controller|. |
315 bool CanOperateOnWindow( | 316 bool CanOperateOnWindow( |
316 const extensions::WindowController* window_controller) const; | 317 const extensions::WindowController* window_controller) const; |
317 | 318 |
318 protected: | 319 protected: |
| 320 // Emits a message to the extension's devtools console. |
| 321 void WriteToConsole(content::ConsoleMessageLevel level, |
| 322 const std::string& message); |
| 323 |
319 friend struct content::BrowserThread::DeleteOnThread< | 324 friend struct content::BrowserThread::DeleteOnThread< |
320 content::BrowserThread::UI>; | 325 content::BrowserThread::UI>; |
321 friend class base::DeleteHelper<UIThreadExtensionFunction>; | 326 friend class base::DeleteHelper<UIThreadExtensionFunction>; |
322 | 327 |
323 virtual ~UIThreadExtensionFunction(); | 328 virtual ~UIThreadExtensionFunction(); |
324 | 329 |
325 virtual void SendResponse(bool success) OVERRIDE; | 330 virtual void SendResponse(bool success) OVERRIDE; |
326 | 331 |
327 // The dispatcher that will service this extension function call. | 332 // The dispatcher that will service this extension function call. |
328 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_; | 333 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 public: | 453 public: |
449 SyncIOThreadExtensionFunction(); | 454 SyncIOThreadExtensionFunction(); |
450 | 455 |
451 virtual void Run() OVERRIDE; | 456 virtual void Run() OVERRIDE; |
452 | 457 |
453 protected: | 458 protected: |
454 virtual ~SyncIOThreadExtensionFunction(); | 459 virtual ~SyncIOThreadExtensionFunction(); |
455 }; | 460 }; |
456 | 461 |
457 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 462 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |