Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/extensions/extension_offscreen_tabs_module.h

Issue 7720002: Chrome Extensions chrome.experimental.offscreenTabs.* API implementation, docs, and test. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 "base/values.h"
12 #include "chrome/browser/extensions/extension_function.h"
13 #include "content/browser/tab_contents/tab_contents_observer.h"
14 #include "content/common/notification_observer.h"
15 #include "content/common/notification_registrar.h"
16
17 class BackingStore;
18 class SkBitmap;
19 class TabContents;
20 class TabContentsWrapper;
21
22 namespace base {
23 class DictionaryValue;
24 class ListValue;
25 }
26
27 class CreateOffscreenTabFunction : public SyncExtensionFunction {
sky 2011/09/13 23:42:23 Add descriptions for these classes.
alexbost 2011/09/14 21:45:30 Done.
28 public:
29 CreateOffscreenTabFunction();
30 virtual ~CreateOffscreenTabFunction();
31 virtual bool RunImpl() OVERRIDE;
32
33 private:
34 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create")
35 DISALLOW_COPY_AND_ASSIGN(CreateOffscreenTabFunction);
36 };
37
38 class GetOffscreenTabFunction : public SyncExtensionFunction {
39 public:
40 GetOffscreenTabFunction();
41 virtual ~GetOffscreenTabFunction();
42 virtual bool RunImpl() OVERRIDE;
43
44 private:
45 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get")
46 DISALLOW_COPY_AND_ASSIGN(GetOffscreenTabFunction);
47 };
48
49 class GetAllOffscreenTabFunction : public SyncExtensionFunction {
50 public:
51 GetAllOffscreenTabFunction();
52 virtual ~GetAllOffscreenTabFunction();
53 virtual bool RunImpl() OVERRIDE;
54
55 private:
56 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll")
57 DISALLOW_COPY_AND_ASSIGN(GetAllOffscreenTabFunction);
58 };
59
60 class RemoveOffscreenTabFunction : public SyncExtensionFunction {
61 public:
62 RemoveOffscreenTabFunction();
63 virtual ~RemoveOffscreenTabFunction();
64 virtual bool RunImpl() OVERRIDE;
65
66 private:
67 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove")
68 DISALLOW_COPY_AND_ASSIGN(RemoveOffscreenTabFunction);
69 };
70
71 class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction {
72 public:
73 SendKeyboardEventOffscreenTabFunction();
74 virtual ~SendKeyboardEventOffscreenTabFunction();
75 virtual bool RunImpl() OVERRIDE;
76
77 private:
78 DECLARE_EXTENSION_FUNCTION_NAME(
79 "experimental.offscreenTabs.sendKeyboardEvent")
80 DISALLOW_COPY_AND_ASSIGN(SendKeyboardEventOffscreenTabFunction);
81 };
82
83 class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction {
84 public:
85 SendMouseEventOffscreenTabFunction();
86 virtual ~SendMouseEventOffscreenTabFunction();
87 virtual bool RunImpl() OVERRIDE;
88
89 private:
90 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent")
91 DISALLOW_COPY_AND_ASSIGN(SendMouseEventOffscreenTabFunction);
92 };
93
94 class ToDataUrlOffscreenTabFunction : public AsyncExtensionFunction,
95 public NotificationObserver {
96 public:
97 ToDataUrlOffscreenTabFunction();
98 virtual ~ToDataUrlOffscreenTabFunction();
99 virtual bool RunImpl() OVERRIDE;
100
101 private:
102 enum ImageFormat {
103 FORMAT_JPEG,
104 FORMAT_PNG
105 };
106
107 // The default quality setting used when encoding jpegs.
108 static const int kDefaultQuality = 90;
109 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store);
110 virtual void Observe(const int type,
111 const NotificationSource& source,
112 const NotificationDetails& details) OVERRIDE;
113 virtual void SendResultFromBitmap(const SkBitmap& screen_capture);
114
115 NotificationRegistrar registrar_;
116
117 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
118 ImageFormat image_format_;
119
120 // Quality setting to use when encoding jpegs. Set in RunImpl().
121 int image_quality_;
122
123 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl")
124 DISALLOW_COPY_AND_ASSIGN(ToDataUrlOffscreenTabFunction);
125 };
126
127 class UpdateOffscreenTabFunction : public AsyncExtensionFunction,
128 public TabContentsObserver {
129 public:
130 UpdateOffscreenTabFunction();
131 virtual ~UpdateOffscreenTabFunction();
132 virtual bool RunImpl() OVERRIDE;
133
134 private:
135 virtual bool OnMessageReceived(const IPC::Message& message);
136 void OnExecuteCodeFinished(int request_id,
137 bool success,
138 const std::string& error);
139
140 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update")
141 DISALLOW_COPY_AND_ASSIGN(UpdateOffscreenTabFunction);
142 };
143
144 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__
145
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698