Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1407)

Unified Diff: chrome/browser/extensions/extension_tab_util.h

Issue 8037005: Refactor ExtensionTabUtil-namespaced functions into their own file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updates after try runs. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_sidebar_api.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tab_util.h
diff --git a/chrome/browser/extensions/extension_tab_util.h b/chrome/browser/extensions/extension_tab_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..5dfb36f97d280909a67d607eac5a0287f3f781e5
--- /dev/null
+++ b/chrome/browser/extensions/extension_tab_util.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__
+#pragma once
+
+#include <string>
+
+class Browser;
+class Profile;
+class TabContents;
+class TabContentsWrapper;
+class TabStripModel;
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+}
+
+// Provides various utility functions that help manipulate tabs.
+class ExtensionTabUtil {
+ public:
+ static int GetWindowId(const Browser* browser);
+ static int GetTabId(const TabContents* tab_contents);
+ static bool GetTabIdFromArgument(const base::ListValue &args,
+ int argument_index,
+ int *tab_id, std::string* error_message);
+ static std::string GetTabStatusText(bool is_loading);
+ static int GetWindowIdOfTab(const TabContents* tab_contents);
+ static base::ListValue* CreateTabList(const Browser* browser);
+ static base::DictionaryValue* CreateTabValue(
+ const TabContents* tab_contents);
+ static base::DictionaryValue* CreateTabValue(const TabContents* tab_contents,
+ TabStripModel* tab_strip,
+ int tab_index);
+ // Create a tab value, overriding its kSelectedKey to the provided boolean.
+ static base::DictionaryValue* CreateTabValueActive(
+ const TabContents* tab_contents,
+ bool active);
+ static base::DictionaryValue* CreateWindowValue(const Browser* browser,
+ bool populate_tabs);
+ // Gets the |tab_strip_model| and |tab_index| for the given |tab_contents|.
+ static bool GetTabStripModel(const TabContents* tab_contents,
+ TabStripModel** tab_strip_model,
+ int* tab_index);
+ static bool GetDefaultTab(Browser* browser,
+ TabContentsWrapper** contents,
+ int* tab_id);
+ // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may
+ // be NULL and will not be set within the function.
+ static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled,
+ Browser** browser,
+ TabStripModel** tab_strip,
+ TabContentsWrapper** contents,
+ int* tab_index);
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__
« no previous file with comments | « chrome/browser/extensions/extension_sidebar_api.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698