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

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, 4 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 "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 virtual ~OffscreenTabsEventManager() {}
31 void RegisterForTabNotifications(const TabContents* contents);
32 void UnregisterForTabNotifications(const TabContents* contents);
33 private:
34 virtual void Observe(const int type,
35 const NotificationSource& source,
36 const NotificationDetails& details);
37 NotificationRegistrar registrar_;
38 };
39 class CreateOffscreenTabFunction : public SyncExtensionFunction {
40 virtual ~CreateOffscreenTabFunction() {}
Ken Russell (switch to Gerrit) 2011/08/23 22:46:53 Virtual function definitions in headers, in partic
alexbost 2011/08/24 20:06:21 Done.
41 virtual bool RunImpl();
42 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create")
43 };
44 class GetOffscreenTabFunction : public SyncExtensionFunction {
45 virtual ~GetOffscreenTabFunction() {}
46 virtual bool RunImpl();
47 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get")
48 };
49 class GetAllOffscreenTabFunction : public SyncExtensionFunction {
50 virtual ~GetAllOffscreenTabFunction() {}
51 virtual bool RunImpl();
52 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll")
53 };
54 class RemoveOffscreenTabFunction : public SyncExtensionFunction {
55 virtual ~RemoveOffscreenTabFunction() {}
56 virtual bool RunImpl();
57 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove")
58 };
59 class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction {
60 virtual ~SendKeyboardEventOffscreenTabFunction() {}
61 virtual bool RunImpl();
62 DECLARE_EXTENSION_FUNCTION_NAME(
63 "experimental.offscreenTabs.sendKeyboardEvent")
64 };
65 class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction {
66 virtual ~SendMouseEventOffscreenTabFunction() {}
67 virtual bool RunImpl();
68 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent")
69 };
70 class ToDataUrlOffscreenTabFunction : public AsyncExtensionFunction,
71 public NotificationObserver {
72 private:
73 enum ImageFormat {
74 FORMAT_JPEG,
75 FORMAT_PNG
76 };
77
78 // The default quality setting used when encoding jpegs.
79 static const int kDefaultQuality;
80
81 virtual ~ToDataUrlOffscreenTabFunction() {}
82 virtual bool RunImpl();
83 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store);
84 virtual void Observe(const int type,
85 const NotificationSource& source,
86 const NotificationDetails& details);
87 virtual void SendResultFromBitmap(const SkBitmap& screen_capture);
88
89 NotificationRegistrar registrar_;
90
91 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
92 ImageFormat image_format_;
93
94 // Quality setting to use when encoding jpegs. Set in RunImpl().
95 int image_quality_;
96
97 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl")
98 };
99 class UpdateOffscreenTabFunction : public AsyncExtensionFunction,
100 public TabContentsObserver {
101 public:
102 UpdateOffscreenTabFunction();
103 private:
104 virtual ~UpdateOffscreenTabFunction() {}
105 virtual bool RunImpl();
106 virtual bool OnMessageReceived(const IPC::Message& message);
107 void OnExecuteCodeFinished(int request_id,
108 bool success,
109 const std::string& error);
110 DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update")
111 };
112
113 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__
114
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698