| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "chrome/common/extensions/extension_resource.h" | 12 #include "chrome/common/extensions/extension_resource.h" |
| 13 #include "content/browser/tab_contents/tab_contents_observer.h" | 13 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 14 | 14 |
| 15 // Implement API call tabs.executeScript and tabs.insertCSS. | 15 // Implement API call tabs.executeScript and tabs.insertCSS. |
| 16 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, | 16 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, |
| 17 public TabContentsObserver { | 17 public TabContentsObserver { |
| 18 public: | 18 public: |
| 19 ExecuteCodeInTabFunction(); | 19 ExecuteCodeInTabFunction(); |
| 20 virtual ~ExecuteCodeInTabFunction(); | 20 virtual ~ExecuteCodeInTabFunction(); |
| 21 | 21 |
| 22 private: | 22 private: |
| 23 virtual bool RunImpl(); | 23 virtual bool RunImpl() OVERRIDE; |
| 24 | 24 |
| 25 // TabContentsObserver overrides. | 25 // TabContentsObserver overrides. |
| 26 virtual bool OnMessageReceived(const IPC::Message& message); | 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 27 | 27 |
| 28 // Message handler. | 28 // Message handler. |
| 29 void OnExecuteCodeFinished(int request_id, bool success, | 29 void OnExecuteCodeFinished(int request_id, bool success, |
| 30 const std::string& error); | 30 const std::string& error); |
| 31 | 31 |
| 32 // Called when contents from the file whose path is specified in JSON | 32 // Called when contents from the file whose path is specified in JSON |
| 33 // arguments has been loaded. | 33 // arguments has been loaded. |
| 34 void DidLoadFile(bool success, const std::string& data); | 34 void DidLoadFile(bool success, const std::string& data); |
| 35 | 35 |
| 36 // Runs on FILE thread. Loads message bundles for the extension and | 36 // Runs on FILE thread. Loads message bundles for the extension and |
| (...skipping 25 matching lines...) Expand all Loading... |
| 62 | 62 |
| 63 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { | 63 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { |
| 64 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") | 64 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { | 67 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { |
| 68 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") | 68 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 71 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
| OLD | NEW |