OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 13 #include "content/common/notification_observer.h" |
| 14 #include "content/common/notification_registrar.h" |
| 15 |
| 16 class BackingStore; |
| 17 class Browser; |
| 18 class SkBitmap; |
| 19 class TabContents; |
| 20 class TabContentsWrapper; |
| 21 class TabStripModel; |
| 22 |
| 23 namespace base { |
| 24 class DictionaryValue; |
| 25 class ListValue; |
| 26 } |
| 27 |
| 28 class OffscreenTabsEventManager : public NotificationObserver { |
| 29 public: |
| 30 OffscreenTabsEventManager(); |
| 31 virtual ~OffscreenTabsEventManager(); |
| 32 void RegisterForTabNotifications(const TabContents* contents); |
| 33 void UnregisterForTabNotifications(const TabContents* contents); |
| 34 private: |
| 35 virtual void Observe(const int type, |
| 36 const NotificationSource& source, |
| 37 const NotificationDetails& details); |
| 38 NotificationRegistrar registrar_; |
| 39 }; |
| 40 class CreateOffscreenTabFunction : public SyncExtensionFunction { |
| 41 public: |
| 42 CreateOffscreenTabFunction(); |
| 43 virtual ~CreateOffscreenTabFunction(); |
| 44 virtual bool RunImpl(); |
| 45 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create") |
| 46 }; |
| 47 class GetOffscreenTabFunction : public SyncExtensionFunction { |
| 48 public: |
| 49 GetOffscreenTabFunction(); |
| 50 virtual ~GetOffscreenTabFunction(); |
| 51 virtual bool RunImpl(); |
| 52 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get") |
| 53 }; |
| 54 class GetAllOffscreenTabFunction : public SyncExtensionFunction { |
| 55 public: |
| 56 GetAllOffscreenTabFunction(); |
| 57 virtual ~GetAllOffscreenTabFunction(); |
| 58 virtual bool RunImpl(); |
| 59 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll") |
| 60 }; |
| 61 class RemoveOffscreenTabFunction : public SyncExtensionFunction { |
| 62 public: |
| 63 RemoveOffscreenTabFunction(); |
| 64 virtual ~RemoveOffscreenTabFunction(); |
| 65 virtual bool RunImpl(); |
| 66 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove") |
| 67 }; |
| 68 class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction { |
| 69 public: |
| 70 SendKeyboardEventOffscreenTabFunction(); |
| 71 virtual ~SendKeyboardEventOffscreenTabFunction(); |
| 72 virtual bool RunImpl(); |
| 73 DECLARE_EXTENSION_FUNCTION_NAME( |
| 74 "experimental.offscreenTabs.sendKeyboardEvent") |
| 75 }; |
| 76 class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction { |
| 77 public: |
| 78 SendMouseEventOffscreenTabFunction(); |
| 79 virtual ~SendMouseEventOffscreenTabFunction(); |
| 80 virtual bool RunImpl(); |
| 81 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent") |
| 82 }; |
| 83 class ToDataUrlOffscreenTabFunction : public AsyncExtensionFunction, |
| 84 public NotificationObserver { |
| 85 public: |
| 86 ToDataUrlOffscreenTabFunction(); |
| 87 virtual ~ToDataUrlOffscreenTabFunction(); |
| 88 virtual bool RunImpl(); |
| 89 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl") |
| 90 private: |
| 91 enum ImageFormat { |
| 92 FORMAT_JPEG, |
| 93 FORMAT_PNG |
| 94 }; |
| 95 |
| 96 // The default quality setting used when encoding jpegs. |
| 97 static const int kDefaultQuality; |
| 98 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store); |
| 99 virtual void Observe(const int type, |
| 100 const NotificationSource& source, |
| 101 const NotificationDetails& details); |
| 102 virtual void SendResultFromBitmap(const SkBitmap& screen_capture); |
| 103 |
| 104 NotificationRegistrar registrar_; |
| 105 |
| 106 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
| 107 ImageFormat image_format_; |
| 108 |
| 109 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
| 110 int image_quality_; |
| 111 }; |
| 112 class UpdateOffscreenTabFunction : public AsyncExtensionFunction, |
| 113 public TabContentsObserver { |
| 114 public: |
| 115 UpdateOffscreenTabFunction(); |
| 116 virtual ~UpdateOffscreenTabFunction(); |
| 117 virtual bool RunImpl(); |
| 118 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update") |
| 119 private: |
| 120 virtual bool OnMessageReceived(const IPC::Message& message); |
| 121 void OnExecuteCodeFinished(int request_id, |
| 122 bool success, |
| 123 const std::string& error); |
| 124 }; |
| 125 |
| 126 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__ |
| 127 |
OLD | NEW |