[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 1 | // 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] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 7 | |
Bret Sepulveda | ee31738 | 2019-05-09 22:04:10 | [diff] [blame] | 8 | #include "base/optional.h" |
Connie Wan | 3f77bf3 | 2019-10-28 23:03:12 | [diff] [blame] | 9 | #include "chrome/browser/ui/browser_navigator_params.h" |
Connie Wan | 866179b | 2019-12-18 21:39:33 | [diff] [blame] | 10 | #include "components/tab_groups/tab_group_id.h" |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 11 | #include "content/public/browser/navigation_controller.h" |
[email protected] | 54944cde | 2012-12-09 09:24:59 | [diff] [blame] | 12 | #include "content/public/browser/web_contents.h" |
Sylvain Defresne | c6ccc77d | 2014-09-19 10:19:35 | [diff] [blame] | 13 | #include "ui/base/page_transition_types.h" |
[email protected] | f47621b | 2013-01-22 20:50:33 | [diff] [blame] | 14 | #include "ui/base/window_open_disposition.h" |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 15 | |
| 16 | class Browser; |
| 17 | class GURL; |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 18 | |
| 19 | namespace gfx { |
| 20 | class Rect; |
| 21 | } |
| 22 | |
| 23 | namespace chrome { |
| 24 | |
[email protected] | 73765a77 | 2013-11-15 23:42:16 | [diff] [blame] | 25 | // 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 Bergquist | aa6994c0 | 2019-03-26 01:25:06 | [diff] [blame] | 28 | void AddTabAt(Browser* browser, |
| 29 | const GURL& url, |
| 30 | int index, |
| 31 | bool foreground, |
Connie Wan | 866179b | 2019-12-18 21:39:33 | [diff] [blame] | 32 | base::Optional<tab_groups::TabGroupId> group = base::nullopt); |
[email protected] | 85537005 | 2012-07-10 19:30:32 | [diff] [blame] | 33 | |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 34 | // Adds a selected tab with the specified URL and transition, returns the |
[email protected] | 371d64a | 2012-12-14 21:11:32 | [diff] [blame] | 35 | // created WebContents. |
[email protected] | 5a1a5246 | 2012-11-15 03:35:16 | [diff] [blame] | 36 | content::WebContents* AddSelectedTabWithURL(Browser* browser, |
| 37 | const GURL& url, |
Sylvain Defresne | c6ccc77d | 2014-09-19 10:19:35 | [diff] [blame] | 38 | ui::PageTransition transition); |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 39 | |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 40 | // Creates a new tab with the already-created WebContents 'new_contents'. |
| 41 | // The window for the added contents will be reparented correctly when this |
bokan | 107a47f | 2015-02-03 23:23:39 | [diff] [blame] | 42 | // method returns. If |disposition| is NEW_POPUP, |initial_rect| should hold |
Charles Harrison | aeef8749 | 2017-09-12 20:39:25 | [diff] [blame] | 43 | // the initial position and size. |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 44 | void AddWebContents(Browser* browser, |
| 45 | content::WebContents* source_contents, |
erikchen | bee5c962 | 2018-04-27 19:30:25 | [diff] [blame] | 46 | std::unique_ptr<content::WebContents> new_contents, |
Joel Hockey | 891e8806 | 2020-04-30 05:38:44 | [diff] [blame] | 47 | const GURL& target_url, |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 48 | WindowOpenDisposition disposition, |
Mustaq Ahmed | ee456c6 | 2018-05-18 20:48:50 | [diff] [blame] | 49 | const gfx::Rect& initial_rect); |
[email protected] | 81ddd340 | 2012-12-28 00:55:26 | [diff] [blame] | 50 | |
| 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. |
| 53 | void CloseWebContents(Browser* browser, |
| 54 | content::WebContents* contents, |
| 55 | bool add_to_history); |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 56 | |
Connie Wan | 3f77bf3 | 2019-10-28 23:03:12 | [diff] [blame] | 57 | // Configures |nav_params| to create a new tab group with the source, if |
| 58 | // applicable. |
| 59 | void ConfigureTabGroupForNavigation(NavigateParams* nav_params); |
| 60 | |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 61 | } // namespace chrome |
| 62 | |
| 63 | #endif // CHROME_BROWSER_UI_BROWSER_TABSTRIP_H_ |