| 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 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/process/process.h" | 19 #include "base/process/process.h" |
| 20 #include "base/sequenced_task_runner_helpers.h" | 20 #include "base/sequenced_task_runner_helpers.h" |
| 21 #include "base/timer/elapsed_timer.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/common/console_message_level.h" | 23 #include "content/public/common/console_message_level.h" |
| 23 #include "extensions/browser/extension_function_histogram_value.h" | 24 #include "extensions/browser/extension_function_histogram_value.h" |
| 24 #include "extensions/browser/info_map.h" | 25 #include "extensions/browser/info_map.h" |
| 25 #include "extensions/common/extension.h" | 26 #include "extensions/common/extension.h" |
| 26 #include "extensions/common/features/feature.h" | 27 #include "extensions/common/features/feature.h" |
| 27 #include "ipc/ipc_message.h" | 28 #include "ipc/ipc_message.h" |
| 28 | 29 |
| 29 class ExtensionFunction; | 30 class ExtensionFunction; |
| 30 class UIThreadExtensionFunction; | 31 class UIThreadExtensionFunction; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 int source_tab_id_; | 434 int source_tab_id_; |
| 434 | 435 |
| 435 // The type of the JavaScript context where this call originated. | 436 // The type of the JavaScript context where this call originated. |
| 436 extensions::Feature::Context source_context_type_; | 437 extensions::Feature::Context source_context_type_; |
| 437 | 438 |
| 438 // The process ID of the page that triggered this function call, or -1 | 439 // The process ID of the page that triggered this function call, or -1 |
| 439 // if unknown. | 440 // if unknown. |
| 440 int source_process_id_; | 441 int source_process_id_; |
| 441 | 442 |
| 442 private: | 443 private: |
| 444 base::ElapsedTimer timer_; |
| 445 |
| 443 void OnRespondingLater(ResponseValue response); | 446 void OnRespondingLater(ResponseValue response); |
| 444 | 447 |
| 445 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); | 448 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); |
| 446 }; | 449 }; |
| 447 | 450 |
| 448 // Extension functions that run on the UI thread. Most functions fall into | 451 // Extension functions that run on the UI thread. Most functions fall into |
| 449 // this category. | 452 // this category. |
| 450 class UIThreadExtensionFunction : public ExtensionFunction { | 453 class UIThreadExtensionFunction : public ExtensionFunction { |
| 451 public: | 454 public: |
| 452 // TODO(yzshen): We should be able to remove this interface now that we | 455 // TODO(yzshen): We should be able to remove this interface now that we |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 private: | 683 private: |
| 681 // If you're hitting a compile error here due to "final" - great! You're | 684 // If you're hitting a compile error here due to "final" - great! You're |
| 682 // doing the right thing, you just need to extend IOThreadExtensionFunction | 685 // doing the right thing, you just need to extend IOThreadExtensionFunction |
| 683 // instead of SyncIOExtensionFunction. | 686 // instead of SyncIOExtensionFunction. |
| 684 ResponseAction Run() final; | 687 ResponseAction Run() final; |
| 685 | 688 |
| 686 DISALLOW_COPY_AND_ASSIGN(SyncIOThreadExtensionFunction); | 689 DISALLOW_COPY_AND_ASSIGN(SyncIOThreadExtensionFunction); |
| 687 }; | 690 }; |
| 688 | 691 |
| 689 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 692 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| OLD | NEW |