| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "chrome/common/notification_service.h" | 11 #include "chrome/common/notification_service.h" |
| 12 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
| 13 | 13 |
| 14 class BackingStore; | 14 class BackingStore; |
| 15 class Browser; | 15 class Browser; |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 class ListValue; | 17 class ListValue; |
| 18 class SkBitmap; | 18 class SkBitmap; |
| 19 class TabContents; | 19 class TabContents; |
| 20 class TabStripModel; | 20 class TabStripModel; |
| 21 | 21 |
| 22 class ExtensionTabUtil { | 22 class ExtensionTabUtil { |
| 23 public: | 23 public: |
| 24 // Possible tab states. These states are used to calculate the "status" | |
| 25 // property of the Tab object that is used in the extension tab API. | |
| 26 enum TabStatus { | |
| 27 TAB_LOADING, // Waiting for the DOM to load. | |
| 28 TAB_COMPLETE // Tab loading and rendering is complete. | |
| 29 }; | |
| 30 | |
| 31 static int GetWindowId(const Browser* browser); | 24 static int GetWindowId(const Browser* browser); |
| 32 static int GetTabId(const TabContents* tab_contents); | 25 static int GetTabId(const TabContents* tab_contents); |
| 33 static TabStatus GetTabStatus(const TabContents* tab_contents); | 26 static std::string GetTabStatusText(bool is_loading); |
| 34 static std::string GetTabStatusText(TabStatus status); | |
| 35 static int GetWindowIdOfTab(const TabContents* tab_contents); | 27 static int GetWindowIdOfTab(const TabContents* tab_contents); |
| 36 static ListValue* CreateTabList(const Browser* browser); | 28 static ListValue* CreateTabList(const Browser* browser); |
| 37 static DictionaryValue* CreateTabValue(const TabContents* tab_contents); | 29 static DictionaryValue* CreateTabValue(const TabContents* tab_contents); |
| 38 static DictionaryValue* CreateTabValue(const TabContents* tab_contents, | 30 static DictionaryValue* CreateTabValue(const TabContents* tab_contents, |
| 39 TabStripModel* tab_strip, | 31 TabStripModel* tab_strip, |
| 40 int tab_index); | 32 int tab_index); |
| 41 static DictionaryValue* CreateWindowValue(const Browser* browser, | 33 static DictionaryValue* CreateWindowValue(const Browser* browser, |
| 42 bool populate_tabs); | 34 bool populate_tabs); |
| 43 | 35 |
| 44 static bool GetDefaultTab(Browser* browser, TabContents** contents, | 36 static bool GetDefaultTab(Browser* browser, TabContents** contents, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 159 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
| 168 ImageFormat image_format_; | 160 ImageFormat image_format_; |
| 169 | 161 |
| 170 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 162 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
| 171 int image_quality_; | 163 int image_quality_; |
| 172 | 164 |
| 173 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") | 165 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") |
| 174 }; | 166 }; |
| 175 | 167 |
| 176 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 168 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
| OLD | NEW |