| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 Browser; | 14 class Browser; |
| 15 class DictionaryValue; | 15 class DictionaryValue; |
| 16 class ListValue; |
| 16 class TabContents; | 17 class TabContents; |
| 17 class TabStripModel; | 18 class TabStripModel; |
| 18 | 19 |
| 19 class ExtensionTabUtil { | 20 class ExtensionTabUtil { |
| 20 public: | 21 public: |
| 21 // Possible tab states. These states are used to calculate the "status" | 22 // Possible tab states. These states are used to calculate the "status" |
| 22 // property of the Tab object that is used in the extension tab API. | 23 // property of the Tab object that is used in the extension tab API. |
| 23 enum TabStatus { | 24 enum TabStatus { |
| 24 TAB_LOADING, // Waiting for the DOM to load. | 25 TAB_LOADING, // Waiting for the DOM to load. |
| 25 TAB_COMPLETE // Tab loading and rendering is complete. | 26 TAB_COMPLETE // Tab loading and rendering is complete. |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 static int GetWindowId(const Browser* browser); | 29 static int GetWindowId(const Browser* browser); |
| 29 static int GetTabId(const TabContents* tab_contents); | 30 static int GetTabId(const TabContents* tab_contents); |
| 30 static TabStatus GetTabStatus(const TabContents* tab_contents); | 31 static TabStatus GetTabStatus(const TabContents* tab_contents); |
| 31 static std::string GetTabStatusText(TabStatus status); | 32 static std::string GetTabStatusText(TabStatus status); |
| 32 static int GetWindowIdOfTab(const TabContents* tab_contents); | 33 static int GetWindowIdOfTab(const TabContents* tab_contents); |
| 34 static ListValue* CreateTabList(const Browser* browser); |
| 33 static DictionaryValue* CreateTabValue(const TabContents* tab_contents); | 35 static DictionaryValue* CreateTabValue(const TabContents* tab_contents); |
| 34 static DictionaryValue* CreateTabValue(const TabContents* tab_contents, | 36 static DictionaryValue* CreateTabValue(const TabContents* tab_contents, |
| 35 TabStripModel* tab_strip, | 37 TabStripModel* tab_strip, |
| 36 int tab_index); | 38 int tab_index); |
| 39 static DictionaryValue* CreateWindowValue(const Browser* browser, |
| 40 bool populate_tabs); |
| 37 | 41 |
| 38 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 42 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
| 39 // be NULL and will not be set within the function. | 43 // be NULL and will not be set within the function. |
| 40 static bool GetTabById(int tab_id, Profile* profile, Browser** browser, | 44 static bool GetTabById(int tab_id, Profile* profile, Browser** browser, |
| 41 TabStripModel** tab_strip, | 45 TabStripModel** tab_strip, |
| 42 TabContents** contents, | 46 TabContents** contents, |
| 43 int* tab_index); | 47 int* tab_index); |
| 44 }; | 48 }; |
| 45 | 49 |
| 46 // Windows | 50 // Windows |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 virtual void Observe(NotificationType type, | 100 virtual void Observe(NotificationType type, |
| 97 const NotificationSource& source, | 101 const NotificationSource& source, |
| 98 const NotificationDetails& details); | 102 const NotificationDetails& details); |
| 99 NotificationRegistrar registrar_; | 103 NotificationRegistrar registrar_; |
| 100 }; | 104 }; |
| 101 class CaptureVisibleTabFunction : public SyncExtensionFunction { | 105 class CaptureVisibleTabFunction : public SyncExtensionFunction { |
| 102 virtual bool RunImpl(); | 106 virtual bool RunImpl(); |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 109 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
| OLD | NEW |