| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
| 13 #include "chrome/common/extensions/extension_resource.h" |
| 13 #include "chrome/common/notification_service.h" | 14 #include "chrome/common/notification_service.h" |
| 14 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 15 | 16 |
| 16 class MessageLoop; | 17 class MessageLoop; |
| 17 | 18 |
| 18 // Implement API call tabs.executeScript and tabs.insertCSS. | 19 // Implement API call tabs.executeScript and tabs.insertCSS. |
| 19 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, | 20 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, |
| 20 public NotificationObserver { | 21 public NotificationObserver { |
| 21 public: | 22 public: |
| 22 ExecuteCodeInTabFunction() : execute_tab_id_(-1) {} | 23 ExecuteCodeInTabFunction() : execute_tab_id_(-1) {} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 void DidLoadFile(bool success, const std::string& data); | 34 void DidLoadFile(bool success, const std::string& data); |
| 34 | 35 |
| 35 // Run in UI thread. Code string contains the code to be executed. | 36 // Run in UI thread. Code string contains the code to be executed. |
| 36 void Execute(const std::string& code_string); | 37 void Execute(const std::string& code_string); |
| 37 | 38 |
| 38 NotificationRegistrar registrar_; | 39 NotificationRegistrar registrar_; |
| 39 | 40 |
| 40 // Id of tab which executes code. | 41 // Id of tab which executes code. |
| 41 int execute_tab_id_; | 42 int execute_tab_id_; |
| 42 | 43 |
| 43 // Contain path of file which is specified in JSON arguments. | 44 // Contains extension resource built from path of file which is |
| 44 FilePath file_path_; | 45 // specified in JSON arguments. |
| 46 ExtensionResource resource_; |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 49 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
| OLD | NEW |