| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_API_OFFSCREEN_TABS_OFFSCREEN_TABS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_OFFSCREEN_TABS_OFFSCREEN_TABS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_OFFSCREEN_TABS_OFFSCREEN_TABS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_OFFSCREEN_TABS_OFFSCREEN_TABS_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class BackingStore; | 29 class BackingStore; |
| 30 class SkBitmap; | 30 class SkBitmap; |
| 31 class TabContentsWrapper; | 31 class TabContentsWrapper; |
| 32 namespace content { | 32 namespace content { |
| 33 class WebContents; | 33 class WebContents; |
| 34 } // namespace content | 34 } // namespace content |
| 35 | 35 |
| 36 // Creates an offscreen tab. | 36 // Creates an offscreen tab. |
| 37 class CreateOffscreenTabFunction : public SyncExtensionFunction { | 37 class CreateOffscreenTabFunction : public SyncExtensionFunction { |
| 38 public: | 38 public: |
| 39 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create") |
| 40 |
| 39 CreateOffscreenTabFunction(); | 41 CreateOffscreenTabFunction(); |
| 42 |
| 43 protected: |
| 44 virtual ~CreateOffscreenTabFunction(); |
| 45 |
| 46 // ExtensionFunction: |
| 47 virtual bool RunImpl() OVERRIDE; |
| 48 |
| 40 private: | 49 private: |
| 41 virtual ~CreateOffscreenTabFunction(); | |
| 42 virtual bool RunImpl() OVERRIDE; | |
| 43 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create") | |
| 44 DISALLOW_COPY_AND_ASSIGN(CreateOffscreenTabFunction); | 50 DISALLOW_COPY_AND_ASSIGN(CreateOffscreenTabFunction); |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 // Gets info about an offscreen tab. | 53 // Gets info about an offscreen tab. |
| 48 class GetOffscreenTabFunction : public SyncExtensionFunction { | 54 class GetOffscreenTabFunction : public SyncExtensionFunction { |
| 49 public: | 55 public: |
| 56 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get") |
| 57 |
| 50 GetOffscreenTabFunction(); | 58 GetOffscreenTabFunction(); |
| 59 |
| 60 protected: |
| 61 virtual ~GetOffscreenTabFunction(); |
| 62 |
| 63 // ExtensionFunction: |
| 64 virtual bool RunImpl() OVERRIDE; |
| 65 |
| 51 private: | 66 private: |
| 52 virtual ~GetOffscreenTabFunction(); | |
| 53 virtual bool RunImpl() OVERRIDE; | |
| 54 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get") | |
| 55 DISALLOW_COPY_AND_ASSIGN(GetOffscreenTabFunction); | 67 DISALLOW_COPY_AND_ASSIGN(GetOffscreenTabFunction); |
| 56 }; | 68 }; |
| 57 | 69 |
| 58 // Gets all offscreen tabs created by the tab that invoked this function. | 70 // Gets all offscreen tabs created by the tab that invoked this function. |
| 59 class GetAllOffscreenTabFunction : public SyncExtensionFunction { | 71 class GetAllOffscreenTabFunction : public SyncExtensionFunction { |
| 60 public: | 72 public: |
| 73 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll") |
| 74 |
| 61 GetAllOffscreenTabFunction(); | 75 GetAllOffscreenTabFunction(); |
| 76 |
| 77 protected: |
| 78 virtual ~GetAllOffscreenTabFunction(); |
| 79 |
| 80 // ExtensionFunction: |
| 81 virtual bool RunImpl() OVERRIDE; |
| 82 |
| 62 private: | 83 private: |
| 63 virtual ~GetAllOffscreenTabFunction(); | |
| 64 virtual bool RunImpl() OVERRIDE; | |
| 65 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll") | |
| 66 DISALLOW_COPY_AND_ASSIGN(GetAllOffscreenTabFunction); | 84 DISALLOW_COPY_AND_ASSIGN(GetAllOffscreenTabFunction); |
| 67 }; | 85 }; |
| 68 | 86 |
| 69 // Removes an offscreen tab. | 87 // Removes an offscreen tab. |
| 70 class RemoveOffscreenTabFunction : public SyncExtensionFunction { | 88 class RemoveOffscreenTabFunction : public SyncExtensionFunction { |
| 71 public: | 89 public: |
| 90 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove") |
| 91 |
| 72 RemoveOffscreenTabFunction(); | 92 RemoveOffscreenTabFunction(); |
| 93 |
| 94 protected: |
| 95 virtual ~RemoveOffscreenTabFunction(); |
| 96 |
| 97 // ExtensionFunction: |
| 98 virtual bool RunImpl() OVERRIDE; |
| 99 |
| 73 private: | 100 private: |
| 74 virtual ~RemoveOffscreenTabFunction(); | |
| 75 virtual bool RunImpl() OVERRIDE; | |
| 76 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove") | |
| 77 DISALLOW_COPY_AND_ASSIGN(RemoveOffscreenTabFunction); | 101 DISALLOW_COPY_AND_ASSIGN(RemoveOffscreenTabFunction); |
| 78 }; | 102 }; |
| 79 | 103 |
| 80 // Synthesizes a keyboard event based on a passed-in JavaScript keyboard event. | 104 // Synthesizes a keyboard event based on a passed-in JavaScript keyboard event. |
| 81 // TODO(jstritar): This would be useful on the chrome.tabs API. | 105 // TODO(jstritar): This would be useful on the chrome.tabs API. |
| 82 class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction { | 106 class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction { |
| 83 public: | 107 public: |
| 84 SendKeyboardEventOffscreenTabFunction(); | |
| 85 private: | |
| 86 virtual ~SendKeyboardEventOffscreenTabFunction(); | |
| 87 virtual bool RunImpl() OVERRIDE; | |
| 88 DECLARE_EXTENSION_FUNCTION_NAME( | 108 DECLARE_EXTENSION_FUNCTION_NAME( |
| 89 "experimental.offscreenTabs.sendKeyboardEvent") | 109 "experimental.offscreenTabs.sendKeyboardEvent") |
| 110 |
| 111 SendKeyboardEventOffscreenTabFunction(); |
| 112 |
| 113 protected: |
| 114 virtual ~SendKeyboardEventOffscreenTabFunction(); |
| 115 |
| 116 // ExtensionFunction: |
| 117 virtual bool RunImpl() OVERRIDE; |
| 118 |
| 119 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(SendKeyboardEventOffscreenTabFunction); | 120 DISALLOW_COPY_AND_ASSIGN(SendKeyboardEventOffscreenTabFunction); |
| 91 }; | 121 }; |
| 92 | 122 |
| 93 // Synthesizes a mouse event based on a passed-in JavaScript mouse event. | 123 // Synthesizes a mouse event based on a passed-in JavaScript mouse event. |
| 94 // Since only the application knows where the user clicks, x and y coordinates | 124 // Since only the application knows where the user clicks, x and y coordinates |
| 95 // need to be passed in as well in this case of click, mousedown, and mouseup. | 125 // need to be passed in as well in this case of click, mousedown, and mouseup. |
| 96 // TODO(jstritar): This would be useful on the chrome.tabs API. | 126 // TODO(jstritar): This would be useful on the chrome.tabs API. |
| 97 class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction { | 127 class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction { |
| 98 public: | 128 public: |
| 129 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent") |
| 130 |
| 99 SendMouseEventOffscreenTabFunction(); | 131 SendMouseEventOffscreenTabFunction(); |
| 132 |
| 133 protected: |
| 134 virtual ~SendMouseEventOffscreenTabFunction(); |
| 135 |
| 136 // ExtensionFunction: |
| 137 virtual bool RunImpl() OVERRIDE; |
| 138 |
| 100 private: | 139 private: |
| 101 virtual ~SendMouseEventOffscreenTabFunction(); | |
| 102 virtual bool RunImpl() OVERRIDE; | |
| 103 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent") | |
| 104 DISALLOW_COPY_AND_ASSIGN(SendMouseEventOffscreenTabFunction); | 140 DISALLOW_COPY_AND_ASSIGN(SendMouseEventOffscreenTabFunction); |
| 105 }; | 141 }; |
| 106 | 142 |
| 107 // Gets a snapshot of the offscreen tab and returns it as a data URL. | 143 // Gets a snapshot of the offscreen tab and returns it as a data URL. |
| 108 class ToDataUrlOffscreenTabFunction : public CaptureVisibleTabFunction { | 144 class ToDataUrlOffscreenTabFunction : public CaptureVisibleTabFunction { |
| 109 public: | 145 public: |
| 146 // TODO(jstritar): Rename to toDataUrl. |
| 147 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl") |
| 148 |
| 110 ToDataUrlOffscreenTabFunction(); | 149 ToDataUrlOffscreenTabFunction(); |
| 111 private: | 150 |
| 151 protected: |
| 112 virtual ~ToDataUrlOffscreenTabFunction(); | 152 virtual ~ToDataUrlOffscreenTabFunction(); |
| 153 |
| 154 // CaptureVisibleTabFunction: |
| 113 virtual bool GetTabToCapture(content::WebContents** web_contents, | 155 virtual bool GetTabToCapture(content::WebContents** web_contents, |
| 114 TabContentsWrapper** wrapper) OVERRIDE; | 156 TabContentsWrapper** wrapper) OVERRIDE; |
| 115 // TODO(jstritar): Rename to toDataUrl. | 157 |
| 116 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl") | 158 private: |
| 117 DISALLOW_COPY_AND_ASSIGN(ToDataUrlOffscreenTabFunction); | 159 DISALLOW_COPY_AND_ASSIGN(ToDataUrlOffscreenTabFunction); |
| 118 }; | 160 }; |
| 119 | 161 |
| 120 // Updates an offscreen tab. | 162 // Updates an offscreen tab. |
| 121 class UpdateOffscreenTabFunction : public UpdateTabFunction { | 163 class UpdateOffscreenTabFunction : public UpdateTabFunction { |
| 122 public: | 164 public: |
| 165 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update") |
| 166 |
| 123 UpdateOffscreenTabFunction(); | 167 UpdateOffscreenTabFunction(); |
| 168 |
| 169 protected: |
| 170 virtual ~UpdateOffscreenTabFunction(); |
| 171 |
| 172 // ExtensionFunction: |
| 173 virtual bool RunImpl() OVERRIDE; |
| 174 |
| 175 // UpdateTabFunction: |
| 176 virtual void PopulateResult() OVERRIDE; |
| 177 |
| 124 private: | 178 private: |
| 125 virtual ~UpdateOffscreenTabFunction(); | |
| 126 virtual bool RunImpl() OVERRIDE; | |
| 127 virtual void PopulateResult() OVERRIDE; | |
| 128 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update") | |
| 129 DISALLOW_COPY_AND_ASSIGN(UpdateOffscreenTabFunction); | 179 DISALLOW_COPY_AND_ASSIGN(UpdateOffscreenTabFunction); |
| 130 }; | 180 }; |
| 131 | 181 |
| 132 #endif // CHROME_BROWSER_EXTENSIONS_API_OFFSCREEN_TABS_OFFSCREEN_TABS_API_H_ | 182 #endif // CHROME_BROWSER_EXTENSIONS_API_OFFSCREEN_TABS_OFFSCREEN_TABS_API_H_ |
| OLD | NEW |