OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_H_ |
6 #define CHROME_BROWSER_BROWSER_H_ | 6 #define CHROME_BROWSER_BROWSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // |relative_index| gives the index of the url into the number of tabs that | 336 // |relative_index| gives the index of the url into the number of tabs that |
337 // are going to be opened. For example, if three urls are passed in on the | 337 // are going to be opened. For example, if three urls are passed in on the |
338 // command line this is invoked three times with the values 0, 1 and 2. | 338 // command line this is invoked three times with the values 0, 1 and 2. |
339 int GetIndexForInsertionDuringRestore(int relative_index); | 339 int GetIndexForInsertionDuringRestore(int relative_index); |
340 | 340 |
341 // Adds a selected tab with the specified URL and transition, returns the | 341 // Adds a selected tab with the specified URL and transition, returns the |
342 // created TabContents. | 342 // created TabContents. |
343 TabContents* AddSelectedTabWithURL(const GURL& url, | 343 TabContents* AddSelectedTabWithURL(const GURL& url, |
344 PageTransition::Type transition); | 344 PageTransition::Type transition); |
345 | 345 |
346 // Parameters for AddTabWithURL. | |
347 struct AddTabWithURLParams { | |
348 AddTabWithURLParams(const GURL& a_url, PageTransition::Type a_transition); | |
349 ~AddTabWithURLParams(); | |
350 | |
351 // Basic configuration. | |
352 GURL url; | |
353 GURL referrer; | |
354 PageTransition::Type transition; | |
355 | |
356 // The index to open the tab at. This could be ignored by the tabstrip | |
357 // depending on the combination of |add_types| specified. | |
358 int index; | |
359 | |
360 // A bitmask of values defined in TabStripModel::AddTabTypes. | |
361 // The default is ADD_SELECTED. | |
362 int add_types; | |
363 | |
364 // If non-NULL, used to render the tab. | |
365 SiteInstance* instance; | |
366 | |
367 // If non-empty, the new tab is an app tab. | |
368 std::string extension_app_id; | |
369 | |
370 // The browser where the tab was added. | |
371 Browser* target; | |
372 | |
373 private: | |
374 AddTabWithURLParams(); | |
375 }; | |
376 | |
377 // Adds a tab to the browser (or another) and returns the created TabContents. | |
378 TabContents* AddTabWithURL(AddTabWithURLParams* params); | |
379 | |
380 // Add a new tab, given a TabContents. A TabContents appropriate to | 346 // Add a new tab, given a TabContents. A TabContents appropriate to |
381 // display the last committed entry is created and returned. | 347 // display the last committed entry is created and returned. |
382 TabContents* AddTab(TabContents* tab_contents, PageTransition::Type type); | 348 TabContents* AddTab(TabContents* tab_contents, PageTransition::Type type); |
383 | 349 |
384 // Add a tab with its session history restored from the SessionRestore | 350 // Add a tab with its session history restored from the SessionRestore |
385 // system. If select is true, the tab is selected. |tab_index| gives the index | 351 // system. If select is true, the tab is selected. |tab_index| gives the index |
386 // to insert the tab at. |selected_navigation| is the index of the | 352 // to insert the tab at. |selected_navigation| is the index of the |
387 // TabNavigation in |navigations| to select. If |extension_app_id| is | 353 // TabNavigation in |navigations| to select. If |extension_app_id| is |
388 // non-empty the tab is an app tab and |extension_app_id| is the id of the | 354 // non-empty the tab is an app tab and |extension_app_id| is the id of the |
389 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then | 355 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 // browser. | 887 // browser. |
922 // | 888 // |
923 // Returns false if it was not handled. In this case, the method may also | 889 // Returns false if it was not handled. In this case, the method may also |
924 // modify |disposition| to a more suitable value. | 890 // modify |disposition| to a more suitable value. |
925 bool HandleCrossAppNavigation(TabContents* source, | 891 bool HandleCrossAppNavigation(TabContents* source, |
926 const GURL& url, | 892 const GURL& url, |
927 const GURL& referrer, | 893 const GURL& referrer, |
928 WindowOpenDisposition *disposition, | 894 WindowOpenDisposition *disposition, |
929 PageTransition::Type transition); | 895 PageTransition::Type transition); |
930 | 896 |
931 // The low-level function that other OpenURL...() functions call. This | |
932 // determines the appropriate SiteInstance to pass to AddTabWithURL(), focuses | |
933 // the newly created tab as needed, and does other miscellaneous housekeeping. | |
934 // |add_types| is a bitmask of TabStripModel::AddTabTypes and may be used to | |
935 // pass specific flags to the TabStripModel. |add_types| is only used if | |
936 // the disposition is NEW_WINDOW or SUPPRESS_OPEN. | |
937 void OpenURLAtIndex(TabContents* source, | |
938 const GURL& url, | |
939 const GURL& referrer, | |
940 WindowOpenDisposition disposition, | |
941 PageTransition::Type transition, | |
942 int index, | |
943 int add_types); | |
944 | |
945 // Shows the Find Bar, optionally selecting the next entry that matches the | 897 // Shows the Find Bar, optionally selecting the next entry that matches the |
946 // existing search string for that Tab. |forward_direction| controls the | 898 // existing search string for that Tab. |forward_direction| controls the |
947 // search direction. | 899 // search direction. |
948 void FindInPage(bool find_next, bool forward_direction); | 900 void FindInPage(bool find_next, bool forward_direction); |
949 | 901 |
950 // Closes the frame. | 902 // Closes the frame. |
951 // TODO(beng): figure out if we need this now that the frame itself closes | 903 // TODO(beng): figure out if we need this now that the frame itself closes |
952 // after a return to the message loop. | 904 // after a return to the message loop. |
953 void CloseFrame(); | 905 void CloseFrame(); |
954 | 906 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 // The profile's tab restore service. The service is owned by the profile, | 1084 // The profile's tab restore service. The service is owned by the profile, |
1133 // and we install ourselves as an observer. | 1085 // and we install ourselves as an observer. |
1134 TabRestoreService* tab_restore_service_; | 1086 TabRestoreService* tab_restore_service_; |
1135 | 1087 |
1136 scoped_ptr<InstantController> instant_; | 1088 scoped_ptr<InstantController> instant_; |
1137 | 1089 |
1138 DISALLOW_COPY_AND_ASSIGN(Browser); | 1090 DISALLOW_COPY_AND_ASSIGN(Browser); |
1139 }; | 1091 }; |
1140 | 1092 |
1141 #endif // CHROME_BROWSER_BROWSER_H_ | 1093 #endif // CHROME_BROWSER_BROWSER_H_ |
OLD | NEW |