| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "chrome/common/notification_service.h" | 12 #include "chrome/common/notification_service.h" |
| 13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
| 14 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
| 15 | 15 |
| 16 class BackingStore; | 16 class BackingStore; |
| 17 class Browser; | 17 class Browser; |
| 18 class DictionaryValue; | 18 class DictionaryValue; |
| 19 class ListValue; | 19 class ListValue; |
| 20 class SkBitmap; | 20 class SkBitmap; |
| 21 class TabContents; | 21 class TabContents; |
| 22 class TabContentsWrapper; |
| 22 class TabStripModel; | 23 class TabStripModel; |
| 23 | 24 |
| 24 class ExtensionTabUtil { | 25 namespace ExtensionTabUtil { |
| 25 public: | 26 int GetWindowId(const Browser* browser); |
| 26 static int GetWindowId(const Browser* browser); | 27 int GetTabId(const TabContents* tab_contents); |
| 27 static int GetTabId(const TabContents* tab_contents); | 28 std::string GetTabStatusText(bool is_loading); |
| 28 static std::string GetTabStatusText(bool is_loading); | 29 int GetWindowIdOfTab(const TabContents* tab_contents); |
| 29 static int GetWindowIdOfTab(const TabContents* tab_contents); | 30 ListValue* CreateTabList(const Browser* browser); |
| 30 static ListValue* CreateTabList(const Browser* browser); | 31 DictionaryValue* CreateTabValue(const TabContents* tab_contents); |
| 31 static DictionaryValue* CreateTabValue(const TabContents* tab_contents); | 32 DictionaryValue* CreateTabValue(const TabContents* tab_contents, |
| 32 static DictionaryValue* CreateTabValue(const TabContents* tab_contents, | 33 TabStripModel* tab_strip, |
| 33 TabStripModel* tab_strip, | 34 int tab_index); |
| 34 int tab_index); | 35 DictionaryValue* CreateWindowValue(const Browser* browser, |
| 35 static DictionaryValue* CreateWindowValue(const Browser* browser, | 36 bool populate_tabs); |
| 36 bool populate_tabs); | 37 // Gets the |tab_strip_model| and |tab_index| for the given |tab_contents|. |
| 37 // Gets the |tab_strip_model| and |tab_index| for the given |tab_contents|. | 38 bool GetTabStripModel(const TabContents* tab_contents, |
| 38 static bool GetTabStripModel(const TabContents* tab_contents, | 39 TabStripModel** tab_strip_model, |
| 39 TabStripModel** tab_strip_model, | 40 int* tab_index); |
| 40 int* tab_index); | 41 bool GetDefaultTab(Browser* browser, TabContentsWrapper** contents, |
| 41 static bool GetDefaultTab(Browser* browser, TabContents** contents, | 42 int* tab_id); |
| 42 int* tab_id); | 43 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
| 43 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 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 static 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 TabContents** 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 ~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 ~GetCurrentWindowFunction() {} |
| 60 virtual bool RunImpl(); | 60 virtual bool RunImpl(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 164 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
| 165 ImageFormat image_format_; | 165 ImageFormat image_format_; |
| 166 | 166 |
| 167 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 167 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
| 168 int image_quality_; | 168 int image_quality_; |
| 169 | 169 |
| 170 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") | 170 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 173 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
| OLD | NEW |