OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/file_path.h" |
| 12 #include "chrome/browser/extensions/extension_function.h" |
| 13 #include "chrome/common/notification_service.h" |
| 14 #include "chrome/common/notification_registrar.h" |
| 15 |
| 16 class MessageLoop; |
| 17 |
| 18 // Implement API call tabs.executeScript and tabs.insertCSS. |
| 19 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, |
| 20 public NotificationObserver { |
| 21 public: |
| 22 ExecuteCodeInTabFunction() : execute_tab_id_(-1), ui_loop_(NULL) {} |
| 23 |
| 24 private: |
| 25 virtual bool RunImpl(); |
| 26 |
| 27 virtual void Observe(NotificationType type, |
| 28 const NotificationSource& source, |
| 29 const NotificationDetails& details); |
| 30 |
| 31 // Load contents from file whose path is specified in JSON arguments. Run |
| 32 // in file thread. |
| 33 void LoadFile(); |
| 34 |
| 35 // Run in UI thread. |
| 36 void Execute(); |
| 37 |
| 38 NotificationRegistrar registrar_; |
| 39 |
| 40 // Id of tab which executes code. |
| 41 int execute_tab_id_; |
| 42 |
| 43 MessageLoop* ui_loop_; |
| 44 |
| 45 // Contain path of file which is specified in JSON arguments. |
| 46 FilePath file_path_; |
| 47 |
| 48 // Contain code to be executed. |
| 49 std::string code_string_; |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
OLD | NEW |