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 14 matching lines...) Expand all Loading... |
25 namespace ExtensionTabUtil { | 25 namespace ExtensionTabUtil { |
26 int GetWindowId(const Browser* browser); | 26 int GetWindowId(const Browser* browser); |
27 int GetTabId(const TabContents* tab_contents); | 27 int GetTabId(const TabContents* tab_contents); |
28 std::string GetTabStatusText(bool is_loading); | 28 std::string GetTabStatusText(bool is_loading); |
29 int GetWindowIdOfTab(const TabContents* tab_contents); | 29 int GetWindowIdOfTab(const TabContents* tab_contents); |
30 ListValue* CreateTabList(const Browser* browser); | 30 ListValue* CreateTabList(const Browser* browser); |
31 DictionaryValue* CreateTabValue(const TabContents* tab_contents); | 31 DictionaryValue* CreateTabValue(const TabContents* tab_contents); |
32 DictionaryValue* CreateTabValue(const TabContents* tab_contents, | 32 DictionaryValue* CreateTabValue(const TabContents* tab_contents, |
33 TabStripModel* tab_strip, | 33 TabStripModel* tab_strip, |
34 int tab_index); | 34 int tab_index); |
| 35 // Create a tab value, overriding its kSelectedKey to the provided boolean. |
| 36 DictionaryValue* CreateTabValueActive(const TabContents* tab_contents, |
| 37 bool active); |
35 DictionaryValue* CreateWindowValue(const Browser* browser, | 38 DictionaryValue* CreateWindowValue(const Browser* browser, |
36 bool populate_tabs); | 39 bool populate_tabs); |
37 // Gets the |tab_strip_model| and |tab_index| for the given |tab_contents|. | 40 // Gets the |tab_strip_model| and |tab_index| for the given |tab_contents|. |
38 bool GetTabStripModel(const TabContents* tab_contents, | 41 bool GetTabStripModel(const TabContents* tab_contents, |
39 TabStripModel** tab_strip_model, | 42 TabStripModel** tab_strip_model, |
40 int* tab_index); | 43 int* tab_index); |
41 bool GetDefaultTab(Browser* browser, TabContentsWrapper** contents, | 44 bool GetDefaultTab(Browser* browser, |
| 45 TabContentsWrapper** contents, |
42 int* tab_id); | 46 int* tab_id); |
43 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 47 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
44 // be NULL and will not be set within the function. | 48 // be NULL and will not be set within the function. |
45 bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, | 49 bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, |
46 Browser** browser, | 50 Browser** browser, |
47 TabStripModel** tab_strip, | 51 TabStripModel** tab_strip, |
48 TabContentsWrapper** contents, | 52 TabContentsWrapper** contents, |
49 int* tab_index); | 53 int* tab_index); |
50 } | 54 } |
51 | 55 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") | 117 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") |
114 }; | 118 }; |
115 class UpdateTabFunction : public AsyncExtensionFunction, | 119 class UpdateTabFunction : public AsyncExtensionFunction, |
116 public TabContentsObserver { | 120 public TabContentsObserver { |
117 public: | 121 public: |
118 UpdateTabFunction(); | 122 UpdateTabFunction(); |
119 private: | 123 private: |
120 virtual ~UpdateTabFunction() {} | 124 virtual ~UpdateTabFunction() {} |
121 virtual bool RunImpl(); | 125 virtual bool RunImpl(); |
122 virtual bool OnMessageReceived(const IPC::Message& message); | 126 virtual bool OnMessageReceived(const IPC::Message& message); |
123 void OnExecuteCodeFinished(int request_id, bool success, | 127 void OnExecuteCodeFinished(int request_id, |
| 128 bool success, |
124 const std::string& error); | 129 const std::string& error); |
125 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") | 130 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") |
126 }; | 131 }; |
127 class MoveTabFunction : public SyncExtensionFunction { | 132 class MoveTabFunction : public SyncExtensionFunction { |
128 virtual ~MoveTabFunction() {} | 133 virtual ~MoveTabFunction() {} |
129 virtual bool RunImpl(); | 134 virtual bool RunImpl(); |
130 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") | 135 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") |
131 }; | 136 }; |
132 class RemoveTabFunction : public SyncExtensionFunction { | 137 class RemoveTabFunction : public SyncExtensionFunction { |
133 virtual ~RemoveTabFunction() {} | 138 virtual ~RemoveTabFunction() {} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 176 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
172 ImageFormat image_format_; | 177 ImageFormat image_format_; |
173 | 178 |
174 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 179 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
175 int image_quality_; | 180 int image_quality_; |
176 | 181 |
177 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") | 182 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") |
178 }; | 183 }; |
179 | 184 |
180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 185 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
OLD | NEW |