| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/message_loop_helpers.h" |
| 16 #include "base/process.h" | 17 #include "base/process.h" |
| 17 #include "chrome/browser/extensions/extension_info_map.h" | 18 #include "chrome/browser/extensions/extension_info_map.h" |
| 18 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/render_view_host_observer.h" | 23 #include "content/public/browser/render_view_host_observer.h" |
| 23 #include "ipc/ipc_message.h" | 24 #include "ipc/ipc_message.h" |
| 24 | 25 |
| 25 class Browser; | 26 class Browser; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) { | 241 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) { |
| 241 dispatcher_ = dispatcher; | 242 dispatcher_ = dispatcher; |
| 242 } | 243 } |
| 243 ExtensionFunctionDispatcher* dispatcher() const { | 244 ExtensionFunctionDispatcher* dispatcher() const { |
| 244 return dispatcher_.get(); | 245 return dispatcher_.get(); |
| 245 } | 246 } |
| 246 | 247 |
| 247 protected: | 248 protected: |
| 248 friend struct content::BrowserThread::DeleteOnThread< | 249 friend struct content::BrowserThread::DeleteOnThread< |
| 249 content::BrowserThread::UI>; | 250 content::BrowserThread::UI>; |
| 250 friend class DeleteTask<UIThreadExtensionFunction>; | 251 friend class base::DeleteHelper<UIThreadExtensionFunction>; |
| 251 | 252 |
| 252 virtual ~UIThreadExtensionFunction(); | 253 virtual ~UIThreadExtensionFunction(); |
| 253 | 254 |
| 254 virtual void SendResponse(bool success) OVERRIDE; | 255 virtual void SendResponse(bool success) OVERRIDE; |
| 255 | 256 |
| 256 // Gets the "current" browser, if any. | 257 // Gets the "current" browser, if any. |
| 257 // | 258 // |
| 258 // Many extension APIs operate relative to the current browser, which is the | 259 // Many extension APIs operate relative to the current browser, which is the |
| 259 // browser the calling code is running inside of. For example, popups, tabs, | 260 // browser the calling code is running inside of. For example, popups, tabs, |
| 260 // and infobars all have a containing browser, but background pages and | 261 // and infobars all have a containing browser, but background pages and |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 void set_extension_info_map(const ExtensionInfoMap* extension_info_map) { | 343 void set_extension_info_map(const ExtensionInfoMap* extension_info_map) { |
| 343 extension_info_map_ = extension_info_map; | 344 extension_info_map_ = extension_info_map; |
| 344 } | 345 } |
| 345 const ExtensionInfoMap* extension_info_map() const { | 346 const ExtensionInfoMap* extension_info_map() const { |
| 346 return extension_info_map_.get(); | 347 return extension_info_map_.get(); |
| 347 } | 348 } |
| 348 | 349 |
| 349 protected: | 350 protected: |
| 350 friend struct content::BrowserThread::DeleteOnThread< | 351 friend struct content::BrowserThread::DeleteOnThread< |
| 351 content::BrowserThread::IO>; | 352 content::BrowserThread::IO>; |
| 352 friend class DeleteTask<IOThreadExtensionFunction>; | 353 friend class base::DeleteHelper<IOThreadExtensionFunction>; |
| 353 | 354 |
| 354 virtual ~IOThreadExtensionFunction(); | 355 virtual ~IOThreadExtensionFunction(); |
| 355 | 356 |
| 356 virtual void Destruct() const OVERRIDE; | 357 virtual void Destruct() const OVERRIDE; |
| 357 | 358 |
| 358 virtual void SendResponse(bool success) OVERRIDE; | 359 virtual void SendResponse(bool success) OVERRIDE; |
| 359 | 360 |
| 360 private: | 361 private: |
| 361 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender_; | 362 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender_; |
| 362 int routing_id_; | 363 int routing_id_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 public: | 396 public: |
| 396 SyncIOThreadExtensionFunction(); | 397 SyncIOThreadExtensionFunction(); |
| 397 | 398 |
| 398 virtual void Run() OVERRIDE; | 399 virtual void Run() OVERRIDE; |
| 399 | 400 |
| 400 protected: | 401 protected: |
| 401 virtual ~SyncIOThreadExtensionFunction(); | 402 virtual ~SyncIOThreadExtensionFunction(); |
| 402 }; | 403 }; |
| 403 | 404 |
| 404 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 405 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| OLD | NEW |