| 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 "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
| 24 | 24 |
| 25 class Browser; | 25 class Browser; |
| 26 class ChromeRenderMessageFilter; | 26 class ChromeRenderMessageFilter; |
| 27 class ExtensionFunction; | 27 class ExtensionFunction; |
| 28 class ExtensionFunctionDispatcher; | 28 class ExtensionFunctionDispatcher; |
| 29 class ExtensionWindowController; | |
| 30 class UIThreadExtensionFunction; | 29 class UIThreadExtensionFunction; |
| 31 class IOThreadExtensionFunction; | 30 class IOThreadExtensionFunction; |
| 32 class Profile; | 31 class Profile; |
| 33 class QuotaLimitHeuristic; | 32 class QuotaLimitHeuristic; |
| 34 | 33 |
| 35 namespace base { | 34 namespace base { |
| 36 class ListValue; | 35 class ListValue; |
| 37 class Value; | 36 class Value; |
| 38 } | 37 } |
| 39 | 38 |
| 40 namespace content { | 39 namespace content { |
| 41 class RenderViewHost; | 40 class RenderViewHost; |
| 42 } | 41 } |
| 43 | 42 |
| 43 namespace extensions { |
| 44 class WindowController; |
| 45 } |
| 46 |
| 44 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ | 47 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ |
| 45 if (!(test)) { \ | 48 if (!(test)) { \ |
| 46 bad_message_ = true; \ | 49 bad_message_ = true; \ |
| 47 return false; \ | 50 return false; \ |
| 48 } \ | 51 } \ |
| 49 } while (0) | 52 } while (0) |
| 50 | 53 |
| 51 #define EXTENSION_FUNCTION_ERROR(error) do { \ | 54 #define EXTENSION_FUNCTION_ERROR(error) do { \ |
| 52 error_ = error; \ | 55 error_ = error; \ |
| 53 bad_message_ = true; \ | 56 bad_message_ = true; \ |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Incognito browsers are not considered unless the calling extension has | 282 // Incognito browsers are not considered unless the calling extension has |
| 280 // incognito access enabled. | 283 // incognito access enabled. |
| 281 // | 284 // |
| 282 // This method can return NULL if there is no matching browser, which can | 285 // This method can return NULL if there is no matching browser, which can |
| 283 // happen if only incognito windows are open, or early in startup or shutdown | 286 // happen if only incognito windows are open, or early in startup or shutdown |
| 284 // shutdown when there are no active windows. | 287 // shutdown when there are no active windows. |
| 285 // | 288 // |
| 286 // TODO(stevenjb): Replace this with GetExtensionWindowController(). | 289 // TODO(stevenjb): Replace this with GetExtensionWindowController(). |
| 287 Browser* GetCurrentBrowser(); | 290 Browser* GetCurrentBrowser(); |
| 288 | 291 |
| 289 // Same as above but uses ExtensionWindowList instead of BrowserList. | 292 // Same as above but uses WindowControllerList instead of BrowserList. |
| 290 ExtensionWindowController* GetExtensionWindowController(); | 293 extensions::WindowController* GetExtensionWindowController(); |
| 291 | 294 |
| 292 // Returns true if this function (and the profile and extension that it was | 295 // Returns true if this function (and the profile and extension that it was |
| 293 // invoked from) can operate on the window wrapped by |window_controller|. | 296 // invoked from) can operate on the window wrapped by |window_controller|. |
| 294 bool CanOperateOnWindow( | 297 bool CanOperateOnWindow( |
| 295 const ExtensionWindowController* window_controller) const; | 298 const extensions::WindowController* window_controller) const; |
| 296 | 299 |
| 297 protected: | 300 protected: |
| 298 friend struct content::BrowserThread::DeleteOnThread< | 301 friend struct content::BrowserThread::DeleteOnThread< |
| 299 content::BrowserThread::UI>; | 302 content::BrowserThread::UI>; |
| 300 friend class base::DeleteHelper<UIThreadExtensionFunction>; | 303 friend class base::DeleteHelper<UIThreadExtensionFunction>; |
| 301 | 304 |
| 302 virtual ~UIThreadExtensionFunction(); | 305 virtual ~UIThreadExtensionFunction(); |
| 303 | 306 |
| 304 virtual void SendResponse(bool success) OVERRIDE; | 307 virtual void SendResponse(bool success) OVERRIDE; |
| 305 | 308 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 public: | 430 public: |
| 428 SyncIOThreadExtensionFunction(); | 431 SyncIOThreadExtensionFunction(); |
| 429 | 432 |
| 430 virtual void Run() OVERRIDE; | 433 virtual void Run() OVERRIDE; |
| 431 | 434 |
| 432 protected: | 435 protected: |
| 433 virtual ~SyncIOThreadExtensionFunction(); | 436 virtual ~SyncIOThreadExtensionFunction(); |
| 434 }; | 437 }; |
| 435 | 438 |
| 436 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 439 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| OLD | NEW |