Chromium Code Reviews
|
| 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 TabsEventManager : public NotificationObserver { | |
|
jstritar
2011/09/08 16:58:20
Can you put a little comment above TabsEventManage
jstritar
2011/09/08 16:58:20
It's a little difficult to follow the life cycle o
alexbost
2011/09/10 04:47:53
Done.
alexbost
2011/09/10 04:47:53
Done.
| |
| 29 public: | |
| 30 TabsEventManager(); | |
| 31 virtual ~TabsEventManager(); | |
| 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); | |
|
sky
2011/09/08 18:12:26
Use OVERRIDE where appropriate.
alexbost
2011/09/10 04:47:53
Done.
| |
| 38 NotificationRegistrar registrar_; | |
| 39 }; | |
| 40 class OffscreenTabsEventManager : public NotificationObserver { | |
|
sky
2011/09/08 18:12:26
newlines between each class, DISALLOW_COPY_AND_ASS
alexbost
2011/09/10 04:47:53
Done.
| |
| 41 public: | |
| 42 OffscreenTabsEventManager(); | |
| 43 virtual ~OffscreenTabsEventManager(); | |
| 44 void RegisterForTabNotifications(const TabContents* contents); | |
| 45 void UnregisterForTabNotifications(const TabContents* contents); | |
| 46 private: | |
| 47 virtual void Observe(const int type, | |
| 48 const NotificationSource& source, | |
| 49 const NotificationDetails& details); | |
| 50 NotificationRegistrar registrar_; | |
| 51 }; | |
| 52 class CreateOffscreenTabFunction : public SyncExtensionFunction { | |
| 53 public: | |
| 54 CreateOffscreenTabFunction(); | |
| 55 virtual ~CreateOffscreenTabFunction(); | |
| 56 virtual bool RunImpl(); | |
| 57 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create") | |
|
sky
2011/09/08 18:12:26
Should the DECLARE macro be in the private section
alexbost
2011/09/10 04:47:53
Done.
| |
| 58 }; | |
| 59 class GetOffscreenTabFunction : public SyncExtensionFunction { | |
| 60 public: | |
| 61 GetOffscreenTabFunction(); | |
| 62 virtual ~GetOffscreenTabFunction(); | |
| 63 virtual bool RunImpl(); | |
| 64 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get") | |
| 65 }; | |
| 66 class GetAllOffscreenTabFunction : public SyncExtensionFunction { | |
| 67 public: | |
| 68 GetAllOffscreenTabFunction(); | |
| 69 virtual ~GetAllOffscreenTabFunction(); | |
| 70 virtual bool RunImpl(); | |
| 71 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll") | |
| 72 }; | |
| 73 class RemoveOffscreenTabFunction : public SyncExtensionFunction { | |
| 74 public: | |
| 75 RemoveOffscreenTabFunction(); | |
| 76 virtual ~RemoveOffscreenTabFunction(); | |
| 77 virtual bool RunImpl(); | |
| 78 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove") | |
| 79 }; | |
| 80 class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction { | |
| 81 public: | |
| 82 SendKeyboardEventOffscreenTabFunction(); | |
| 83 virtual ~SendKeyboardEventOffscreenTabFunction(); | |
| 84 virtual bool RunImpl(); | |
| 85 DECLARE_EXTENSION_FUNCTION_NAME( | |
| 86 "experimental.offscreenTabs.sendKeyboardEvent") | |
| 87 }; | |
| 88 class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction { | |
| 89 public: | |
| 90 SendMouseEventOffscreenTabFunction(); | |
| 91 virtual ~SendMouseEventOffscreenTabFunction(); | |
| 92 virtual bool RunImpl(); | |
| 93 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent") | |
| 94 }; | |
| 95 class ToDataUrlOffscreenTabFunction : public AsyncExtensionFunction, | |
| 96 public NotificationObserver { | |
| 97 public: | |
| 98 ToDataUrlOffscreenTabFunction(); | |
| 99 virtual ~ToDataUrlOffscreenTabFunction(); | |
| 100 virtual bool RunImpl(); | |
| 101 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl") | |
| 102 private: | |
| 103 enum ImageFormat { | |
| 104 FORMAT_JPEG, | |
| 105 FORMAT_PNG | |
| 106 }; | |
| 107 | |
| 108 // The default quality setting used when encoding jpegs. | |
| 109 static const int kDefaultQuality; | |
| 110 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store); | |
| 111 virtual void Observe(const int type, | |
| 112 const NotificationSource& source, | |
| 113 const NotificationDetails& details); | |
| 114 virtual void SendResultFromBitmap(const SkBitmap& screen_capture); | |
| 115 | |
| 116 NotificationRegistrar registrar_; | |
| 117 | |
| 118 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | |
| 119 ImageFormat image_format_; | |
| 120 | |
| 121 // Quality setting to use when encoding jpegs. Set in RunImpl(). | |
| 122 int image_quality_; | |
| 123 }; | |
| 124 class UpdateOffscreenTabFunction : public AsyncExtensionFunction, | |
| 125 public TabContentsObserver { | |
| 126 public: | |
| 127 UpdateOffscreenTabFunction(); | |
| 128 virtual ~UpdateOffscreenTabFunction(); | |
| 129 virtual bool RunImpl(); | |
| 130 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update") | |
| 131 private: | |
| 132 virtual bool OnMessageReceived(const IPC::Message& message); | |
| 133 void OnExecuteCodeFinished(int request_id, | |
| 134 bool success, | |
| 135 const std::string& error); | |
| 136 }; | |
| 137 | |
| 138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__ | |
| 139 | |
| OLD | NEW |