blob: c8a5f2ecc7c5e76074472798801294d81979dc2a [file] [log] [blame]
[email protected]52877dbc62012-06-29 22:22:031// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_BROWSER_TABSTRIP_H_
6#define CHROME_BROWSER_UI_BROWSER_TABSTRIP_H_
[email protected]52877dbc62012-06-29 22:22:037
Bret Sepulvedaee317382019-05-09 22:04:108#include "base/optional.h"
Connie Wan3f77bf32019-10-28 23:03:129#include "chrome/browser/ui/browser_navigator_params.h"
Connie Wan866179b2019-12-18 21:39:3310#include "components/tab_groups/tab_group_id.h"
[email protected]d1198fd2012-08-13 22:50:1911#include "content/public/browser/navigation_controller.h"
[email protected]54944cde2012-12-09 09:24:5912#include "content/public/browser/web_contents.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3513#include "ui/base/page_transition_types.h"
[email protected]f47621b2013-01-22 20:50:3314#include "ui/base/window_open_disposition.h"
[email protected]52877dbc62012-06-29 22:22:0315
16class Browser;
17class GURL;
[email protected]52877dbc62012-06-29 22:22:0318
19namespace gfx {
20class Rect;
21}
22
23namespace chrome {
24
[email protected]73765a772013-11-15 23:42:1625// Adds a tab to the tab strip of the specified browser and loads |url| into it.
26// If |url| is an empty URL, then the new tab-page is laoded. An |index| of -1
27// means to append it to the end of the tab strip.
Taylor Bergquistaa6994c02019-03-26 01:25:0628void AddTabAt(Browser* browser,
29 const GURL& url,
30 int index,
31 bool foreground,
Connie Wan866179b2019-12-18 21:39:3332 base::Optional<tab_groups::TabGroupId> group = base::nullopt);
[email protected]855370052012-07-10 19:30:3233
[email protected]52877dbc62012-06-29 22:22:0334// Adds a selected tab with the specified URL and transition, returns the
[email protected]371d64a2012-12-14 21:11:3235// created WebContents.
[email protected]5a1a52462012-11-15 03:35:1636content::WebContents* AddSelectedTabWithURL(Browser* browser,
37 const GURL& url,
Sylvain Defresnec6ccc77d2014-09-19 10:19:3538 ui::PageTransition transition);
[email protected]52877dbc62012-06-29 22:22:0339
[email protected]52877dbc62012-06-29 22:22:0340// Creates a new tab with the already-created WebContents 'new_contents'.
41// The window for the added contents will be reparented correctly when this
bokan107a47f2015-02-03 23:23:3942// method returns. If |disposition| is NEW_POPUP, |initial_rect| should hold
Charles Harrisonaeef87492017-09-12 20:39:2543// the initial position and size.
[email protected]52877dbc62012-06-29 22:22:0344void AddWebContents(Browser* browser,
45 content::WebContents* source_contents,
erikchenbee5c9622018-04-27 19:30:2546 std::unique_ptr<content::WebContents> new_contents,
Joel Hockey891e88062020-04-30 05:38:4447 const GURL& target_url,
[email protected]52877dbc62012-06-29 22:22:0348 WindowOpenDisposition disposition,
Mustaq Ahmedee456c62018-05-18 20:48:5049 const gfx::Rect& initial_rect);
[email protected]81ddd3402012-12-28 00:55:2650
51// Closes the specified WebContents in the specified Browser. If
52// |add_to_history| is true, an entry in the historical tab database is created.
53void CloseWebContents(Browser* browser,
54 content::WebContents* contents,
55 bool add_to_history);
[email protected]52877dbc62012-06-29 22:22:0356
Connie Wan3f77bf32019-10-28 23:03:1257// Configures |nav_params| to create a new tab group with the source, if
58// applicable.
59void ConfigureTabGroupForNavigation(NavigateParams* nav_params);
60
[email protected]52877dbc62012-06-29 22:22:0361} // namespace chrome
62
63#endif // CHROME_BROWSER_UI_BROWSER_TABSTRIP_H_