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

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

Issue 245933002: Initial implementation of chrome.browser.openTab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing. Created 6 years, 8 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/api/tabs/tabs_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
index 0b3092a3cba646622d45ed464b0e1782db5a2a9e..bbf042becab605f75203072f52d9de5610ddcdff 100644
--- a/chrome/browser/extensions/extension_tab_util.h
+++ b/chrome/browser/extensions/extension_tab_util.h
@@ -12,6 +12,7 @@
#include "ui/base/window_open_disposition.h"
class Browser;
+class ChromeAsyncExtensionFunction;
class GURL;
class Profile;
class TabStripModel;
@@ -36,6 +37,26 @@ class WindowController;
// Provides various utility functions that help manipulate tabs.
class ExtensionTabUtil {
public:
+ struct OpenTabParams {
+ OpenTabParams();
+ ~OpenTabParams();
+
+ bool create_browser_if_needed;
+ scoped_ptr<int> window_id;
+ scoped_ptr<int> opener_tab_id;
+ scoped_ptr<std::string> url;
+ scoped_ptr<bool> active;
+ scoped_ptr<bool> pinned;
+ scoped_ptr<int> index;
+ };
+
+ // Opens a new tab given an extension function |function| and creation
+ // parameters |params|. Returns a Tab object if successful, or NULL and
+ // optionally sets |error| if an error occurs.
+ static base::DictionaryValue* OpenTab(ChromeAsyncExtensionFunction* function,
+ const OpenTabParams& params,
+ std::string* error);
+
static int GetWindowId(const Browser* browser);
static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model);
static int GetTabId(const content::WebContents* web_contents);
@@ -43,6 +64,9 @@ class ExtensionTabUtil {
static int GetWindowIdOfTab(const content::WebContents* web_contents);
static base::ListValue* CreateTabList(const Browser* browser,
const Extension* extension);
+ static Browser* GetBrowserFromWindowID(ChromeAsyncExtensionFunction* function,
+ int window_id,
+ std::string* error_message);
// Creates a Tab object (see chrome/common/extensions/api/tabs.json) with
// information about the state of a browser tab. Depending on the
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_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