OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSION_TABS_MODULE_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // be NULL and will not be set within the function. | 44 // be NULL and will not be set within the function. |
45 bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, | 45 bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, |
46 Browser** browser, | 46 Browser** browser, |
47 TabStripModel** tab_strip, | 47 TabStripModel** tab_strip, |
48 TabContentsWrapper** contents, | 48 TabContentsWrapper** contents, |
49 int* tab_index); | 49 int* tab_index); |
50 } | 50 } |
51 | 51 |
52 // Windows | 52 // Windows |
53 class GetWindowFunction : public SyncExtensionFunction { | 53 class GetWindowFunction : public SyncExtensionFunction { |
54 ~GetWindowFunction() {} | 54 virtual ~GetWindowFunction() {} |
55 virtual bool RunImpl(); | 55 virtual bool RunImpl(); |
56 DECLARE_EXTENSION_FUNCTION_NAME("windows.get") | 56 DECLARE_EXTENSION_FUNCTION_NAME("windows.get") |
57 }; | 57 }; |
58 class GetCurrentWindowFunction : public SyncExtensionFunction { | 58 class GetCurrentWindowFunction : public SyncExtensionFunction { |
59 ~GetCurrentWindowFunction() {} | 59 virtual ~GetCurrentWindowFunction() {} |
60 virtual bool RunImpl(); | 60 virtual bool RunImpl(); |
61 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent") | 61 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent") |
62 }; | 62 }; |
63 class GetLastFocusedWindowFunction : public SyncExtensionFunction { | 63 class GetLastFocusedWindowFunction : public SyncExtensionFunction { |
64 ~GetLastFocusedWindowFunction() {} | 64 virtual ~GetLastFocusedWindowFunction() {} |
65 virtual bool RunImpl(); | 65 virtual bool RunImpl(); |
66 DECLARE_EXTENSION_FUNCTION_NAME("windows.getLastFocused") | 66 DECLARE_EXTENSION_FUNCTION_NAME("windows.getLastFocused") |
67 }; | 67 }; |
68 class GetAllWindowsFunction : public SyncExtensionFunction { | 68 class GetAllWindowsFunction : public SyncExtensionFunction { |
69 ~GetAllWindowsFunction() {} | 69 virtual ~GetAllWindowsFunction() {} |
70 virtual bool RunImpl(); | 70 virtual bool RunImpl(); |
71 DECLARE_EXTENSION_FUNCTION_NAME("windows.getAll") | 71 DECLARE_EXTENSION_FUNCTION_NAME("windows.getAll") |
72 }; | 72 }; |
73 class CreateWindowFunction : public SyncExtensionFunction { | 73 class CreateWindowFunction : public SyncExtensionFunction { |
74 ~CreateWindowFunction() {} | 74 virtual ~CreateWindowFunction() {} |
75 virtual bool RunImpl(); | 75 virtual bool RunImpl(); |
76 DECLARE_EXTENSION_FUNCTION_NAME("windows.create") | 76 DECLARE_EXTENSION_FUNCTION_NAME("windows.create") |
77 }; | 77 }; |
78 class UpdateWindowFunction : public SyncExtensionFunction { | 78 class UpdateWindowFunction : public SyncExtensionFunction { |
79 ~UpdateWindowFunction() {} | 79 virtual ~UpdateWindowFunction() {} |
80 virtual bool RunImpl(); | 80 virtual bool RunImpl(); |
81 DECLARE_EXTENSION_FUNCTION_NAME("windows.update") | 81 DECLARE_EXTENSION_FUNCTION_NAME("windows.update") |
82 }; | 82 }; |
83 class RemoveWindowFunction : public SyncExtensionFunction { | 83 class RemoveWindowFunction : public SyncExtensionFunction { |
84 ~RemoveWindowFunction() {} | 84 virtual ~RemoveWindowFunction() {} |
85 virtual bool RunImpl(); | 85 virtual bool RunImpl(); |
86 DECLARE_EXTENSION_FUNCTION_NAME("windows.remove") | 86 DECLARE_EXTENSION_FUNCTION_NAME("windows.remove") |
87 }; | 87 }; |
88 | 88 |
89 // Tabs | 89 // Tabs |
90 class GetTabFunction : public SyncExtensionFunction { | 90 class GetTabFunction : public SyncExtensionFunction { |
91 ~GetTabFunction() {} | 91 virtual ~GetTabFunction() {} |
92 virtual bool RunImpl(); | 92 virtual bool RunImpl(); |
93 DECLARE_EXTENSION_FUNCTION_NAME("tabs.get") | 93 DECLARE_EXTENSION_FUNCTION_NAME("tabs.get") |
94 }; | 94 }; |
95 class GetCurrentTabFunction : public SyncExtensionFunction { | 95 class GetCurrentTabFunction : public SyncExtensionFunction { |
96 ~GetCurrentTabFunction() {} | 96 virtual ~GetCurrentTabFunction() {} |
97 virtual bool RunImpl(); | 97 virtual bool RunImpl(); |
98 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getCurrent") | 98 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getCurrent") |
99 }; | 99 }; |
100 class GetSelectedTabFunction : public SyncExtensionFunction { | 100 class GetSelectedTabFunction : public SyncExtensionFunction { |
101 ~GetSelectedTabFunction() {} | 101 virtual ~GetSelectedTabFunction() {} |
102 virtual bool RunImpl(); | 102 virtual bool RunImpl(); |
103 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getSelected") | 103 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getSelected") |
104 }; | 104 }; |
105 class GetAllTabsInWindowFunction : public SyncExtensionFunction { | 105 class GetAllTabsInWindowFunction : public SyncExtensionFunction { |
106 ~GetAllTabsInWindowFunction() {} | 106 virtual ~GetAllTabsInWindowFunction() {} |
107 virtual bool RunImpl(); | 107 virtual bool RunImpl(); |
108 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getAllInWindow") | 108 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getAllInWindow") |
109 }; | 109 }; |
110 class CreateTabFunction : public SyncExtensionFunction { | 110 class CreateTabFunction : public SyncExtensionFunction { |
111 ~CreateTabFunction() {} | 111 virtual ~CreateTabFunction() {} |
112 virtual bool RunImpl(); | 112 virtual bool RunImpl(); |
113 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") | 113 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") |
114 }; | 114 }; |
115 class UpdateTabFunction : public AsyncExtensionFunction, | 115 class UpdateTabFunction : public AsyncExtensionFunction, |
116 public TabContentsObserver { | 116 public TabContentsObserver { |
117 public: | 117 public: |
118 UpdateTabFunction(); | 118 UpdateTabFunction(); |
119 private: | 119 private: |
120 ~UpdateTabFunction() {} | 120 virtual ~UpdateTabFunction() {} |
121 virtual bool RunImpl(); | 121 virtual bool RunImpl(); |
122 virtual bool OnMessageReceived(const IPC::Message& message); | 122 virtual bool OnMessageReceived(const IPC::Message& message); |
123 void OnExecuteCodeFinished(int request_id, bool success, | 123 void OnExecuteCodeFinished(int request_id, bool success, |
124 const std::string& error); | 124 const std::string& error); |
125 TabContentsObserver::Registrar registrar_; | 125 TabContentsObserver::Registrar registrar_; |
126 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") | 126 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") |
127 }; | 127 }; |
128 class MoveTabFunction : public SyncExtensionFunction { | 128 class MoveTabFunction : public SyncExtensionFunction { |
129 ~MoveTabFunction() {} | 129 virtual ~MoveTabFunction() {} |
130 virtual bool RunImpl(); | 130 virtual bool RunImpl(); |
131 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") | 131 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") |
132 }; | 132 }; |
133 class RemoveTabFunction : public SyncExtensionFunction { | 133 class RemoveTabFunction : public SyncExtensionFunction { |
134 ~RemoveTabFunction() {} | 134 virtual ~RemoveTabFunction() {} |
135 virtual bool RunImpl(); | 135 virtual bool RunImpl(); |
136 DECLARE_EXTENSION_FUNCTION_NAME("tabs.remove") | 136 DECLARE_EXTENSION_FUNCTION_NAME("tabs.remove") |
137 }; | 137 }; |
138 class DetectTabLanguageFunction : public AsyncExtensionFunction, | 138 class DetectTabLanguageFunction : public AsyncExtensionFunction, |
139 public NotificationObserver { | 139 public NotificationObserver { |
140 private: | 140 private: |
141 ~DetectTabLanguageFunction() {} | 141 virtual ~DetectTabLanguageFunction() {} |
142 virtual bool RunImpl(); | 142 virtual bool RunImpl(); |
143 | 143 |
144 virtual void Observe(NotificationType type, | 144 virtual void Observe(NotificationType type, |
145 const NotificationSource& source, | 145 const NotificationSource& source, |
146 const NotificationDetails& details); | 146 const NotificationDetails& details); |
147 void GotLanguage(const std::string& language); | 147 void GotLanguage(const std::string& language); |
148 NotificationRegistrar registrar_; | 148 NotificationRegistrar registrar_; |
149 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage") | 149 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage") |
150 }; | 150 }; |
151 class CaptureVisibleTabFunction : public AsyncExtensionFunction, | 151 class CaptureVisibleTabFunction : public AsyncExtensionFunction, |
152 public NotificationObserver { | 152 public NotificationObserver { |
153 private: | 153 private: |
154 enum ImageFormat { | 154 enum ImageFormat { |
155 FORMAT_JPEG, | 155 FORMAT_JPEG, |
156 FORMAT_PNG | 156 FORMAT_PNG |
157 }; | 157 }; |
158 | 158 |
159 // The default quality setting used when encoding jpegs. | 159 // The default quality setting used when encoding jpegs. |
160 static const int kDefaultQuality; | 160 static const int kDefaultQuality; |
161 | 161 |
162 ~CaptureVisibleTabFunction() {} | 162 virtual ~CaptureVisibleTabFunction() {} |
163 virtual bool RunImpl(); | 163 virtual bool RunImpl(); |
164 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store); | 164 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store); |
165 virtual void Observe(NotificationType type, | 165 virtual void Observe(NotificationType type, |
166 const NotificationSource& source, | 166 const NotificationSource& source, |
167 const NotificationDetails& details); | 167 const NotificationDetails& details); |
168 virtual void SendResultFromBitmap(const SkBitmap& screen_capture); | 168 virtual void SendResultFromBitmap(const SkBitmap& screen_capture); |
169 | 169 |
170 NotificationRegistrar registrar_; | 170 NotificationRegistrar registrar_; |
171 | 171 |
172 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 172 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
173 ImageFormat image_format_; | 173 ImageFormat image_format_; |
174 | 174 |
175 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 175 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
176 int image_quality_; | 176 int image_quality_; |
177 | 177 |
178 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") | 178 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") |
179 }; | 179 }; |
180 | 180 |
181 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 181 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
OLD | NEW |