OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 tabstrip_model_.SelectTabContentsAt(index, user_gesture); | 213 tabstrip_model_.SelectTabContentsAt(index, user_gesture); |
214 } | 214 } |
215 void CloseAllTabs() { | 215 void CloseAllTabs() { |
216 tabstrip_model_.CloseAllTabs(); | 216 tabstrip_model_.CloseAllTabs(); |
217 } | 217 } |
218 | 218 |
219 // Tab adding/showing functions ///////////////////////////////////////////// | 219 // Tab adding/showing functions ///////////////////////////////////////////// |
220 | 220 |
221 // Add a new tab with the specified URL. If instance is not null, its process | 221 // Add a new tab with the specified URL. If instance is not null, its process |
222 // will be used to render the tab. |force_index| is passed through to | 222 // will be used to render the tab. |force_index| is passed through to |
223 // TabStripModel::AddTabContents and it's meaning is documented with it's | 223 // TabStripModel::AddTabContents and its meaning is documented with its |
224 // declaration. | 224 // declaration. |
225 TabContents* AddTabWithURL( | 225 TabContents* AddTabWithURL(const GURL& url, |
226 const GURL& url, const GURL& referrer, | 226 const GURL& referrer, |
227 PageTransition::Type transition, bool foreground, int index, | 227 PageTransition::Type transition, |
228 bool force_index, SiteInstance* instance); | 228 bool foreground, |
| 229 int index, |
| 230 bool force_index, |
| 231 SiteInstance* instance); |
229 | 232 |
230 // Add a new tab, given a NavigationController. A TabContents appropriate to | 233 // Add a new tab, given a NavigationController. A TabContents appropriate to |
231 // display the last committed entry is created and returned. | 234 // display the last committed entry is created and returned. |
232 TabContents* AddTabWithNavigationController(NavigationController* ctrl, | 235 TabContents* AddTabWithNavigationController(NavigationController* ctrl, |
233 PageTransition::Type type); | 236 PageTransition::Type type); |
234 | 237 |
235 // Add a tab with its session history restored from the SessionRestore | 238 // Add a tab with its session history restored from the SessionRestore |
236 // system. If select is true, the tab is selected. |tab_index| gives the index | 239 // system. If select is true, the tab is selected. |tab_index| gives the index |
237 // to insert the tab at. |selected_navigation| is the index of the | 240 // to insert the tab at. |selected_navigation| is the index of the |
238 // TabNavigation in |navigations| to select. | 241 // TabNavigation in |navigations| to select. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 private: | 421 private: |
419 // Overridden from TabStripModelDelegate: | 422 // Overridden from TabStripModelDelegate: |
420 virtual TabContents* AddBlankTab(bool foreground); | 423 virtual TabContents* AddBlankTab(bool foreground); |
421 virtual TabContents* AddBlankTabAt(int index, bool foreground); | 424 virtual TabContents* AddBlankTabAt(int index, bool foreground); |
422 virtual Browser* CreateNewStripWithContents(TabContents* detached_contents, | 425 virtual Browser* CreateNewStripWithContents(TabContents* detached_contents, |
423 const gfx::Rect& window_bounds, | 426 const gfx::Rect& window_bounds, |
424 const DockInfo& dock_info); | 427 const DockInfo& dock_info); |
425 virtual int GetDragActions() const; | 428 virtual int GetDragActions() const; |
426 // Construct a TabContents for a given URL, profile and transition type. | 429 // Construct a TabContents for a given URL, profile and transition type. |
427 // If instance is not null, its process will be used to render the tab. | 430 // If instance is not null, its process will be used to render the tab. |
428 virtual TabContents* CreateTabContentsForURL( | 431 virtual TabContents* CreateTabContentsForURL(const GURL& url, |
429 const GURL& url, | 432 const GURL& referrer, |
430 const GURL& referrer, | 433 Profile* profile, |
431 Profile* profile, | 434 PageTransition::Type transition, |
432 PageTransition::Type transition, | 435 bool defer_load, |
433 bool defer_load, | 436 SiteInstance* instance) const; |
434 SiteInstance* instance) const; | |
435 virtual bool CanDuplicateContentsAt(int index); | 437 virtual bool CanDuplicateContentsAt(int index); |
436 virtual void DuplicateContentsAt(int index); | 438 virtual void DuplicateContentsAt(int index); |
437 virtual void CloseFrameAfterDragSession(); | 439 virtual void CloseFrameAfterDragSession(); |
438 virtual void CreateHistoricalTab(TabContents* contents); | 440 virtual void CreateHistoricalTab(TabContents* contents); |
439 virtual bool RunUnloadListenerBeforeClosing(TabContents* contents); | 441 virtual bool RunUnloadListenerBeforeClosing(TabContents* contents); |
440 virtual bool CanCloseContentsAt(int index); | 442 virtual bool CanCloseContentsAt(int index); |
441 | 443 |
442 // Overridden from TabStripModelObserver: | 444 // Overridden from TabStripModelObserver: |
443 virtual void TabInsertedAt(TabContents* contents, | 445 virtual void TabInsertedAt(TabContents* contents, |
444 int index, | 446 int index, |
445 bool foreground); | 447 bool foreground); |
446 virtual void TabClosingAt(TabContents* contents, int index); | 448 virtual void TabClosingAt(TabContents* contents, int index); |
447 virtual void TabDetachedAt(TabContents* contents, int index); | 449 virtual void TabDetachedAt(TabContents* contents, int index); |
448 virtual void TabSelectedAt(TabContents* old_contents, | 450 virtual void TabSelectedAt(TabContents* old_contents, |
449 TabContents* new_contents, | 451 TabContents* new_contents, |
450 int index, | 452 int index, |
451 bool user_gesture); | 453 bool user_gesture); |
452 virtual void TabMoved(TabContents* contents, | 454 virtual void TabMoved(TabContents* contents, |
453 int from_index, | 455 int from_index, |
454 int to_index); | 456 int to_index); |
455 virtual void TabStripEmpty(); | 457 virtual void TabStripEmpty(); |
456 | 458 |
457 // Overridden from TabContentsDelegate: | 459 // Overridden from TabContentsDelegate: |
458 virtual void OpenURLFromTab(TabContents* source, | 460 virtual void OpenURLFromTab(TabContents* source, |
459 const GURL& url, const GURL& referrer, | 461 const GURL& url, |
460 WindowOpenDisposition disposition, | 462 const GURL& referrer, |
461 PageTransition::Type transition); | 463 WindowOpenDisposition disposition, |
| 464 PageTransition::Type transition); |
462 virtual void NavigationStateChanged(const TabContents* source, | 465 virtual void NavigationStateChanged(const TabContents* source, |
463 unsigned changed_flags); | 466 unsigned changed_flags); |
464 virtual void AddNewContents(TabContents* source, | 467 virtual void AddNewContents(TabContents* source, |
465 TabContents* new_contents, | 468 TabContents* new_contents, |
466 WindowOpenDisposition disposition, | 469 WindowOpenDisposition disposition, |
467 const gfx::Rect& initial_pos, | 470 const gfx::Rect& initial_pos, |
468 bool user_gesture); | 471 bool user_gesture); |
469 virtual void ActivateContents(TabContents* contents); | 472 virtual void ActivateContents(TabContents* contents); |
470 virtual void LoadingStateChanged(TabContents* source); | 473 virtual void LoadingStateChanged(TabContents* source); |
471 virtual void CloseContents(TabContents* source); | 474 virtual void CloseContents(TabContents* source); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 // downloads should prevent it from closing. | 606 // downloads should prevent it from closing. |
604 // Returns true if the window can close, false otherwise. | 607 // Returns true if the window can close, false otherwise. |
605 bool CanCloseWithInProgressDownloads(); | 608 bool CanCloseWithInProgressDownloads(); |
606 | 609 |
607 // Assorted utility functions /////////////////////////////////////////////// | 610 // Assorted utility functions /////////////////////////////////////////////// |
608 | 611 |
609 // Retrieve the last active tabbed browser with the same profile as the | 612 // Retrieve the last active tabbed browser with the same profile as the |
610 // receiving Browser. Creates a new Browser if none are available. | 613 // receiving Browser. Creates a new Browser if none are available. |
611 Browser* GetOrCreateTabbedBrowser(); | 614 Browser* GetOrCreateTabbedBrowser(); |
612 | 615 |
| 616 // The low-level function that other OpenURL...() functions call. This |
| 617 // determines the appropriate SiteInstance to pass to AddTabWithURL(), focuses |
| 618 // the newly created tab as needed, and does other miscellaneous housekeeping. |
| 619 void OpenURLAtIndex(TabContents* source, |
| 620 const GURL& url, |
| 621 const GURL& referrer, |
| 622 WindowOpenDisposition disposition, |
| 623 PageTransition::Type transition, |
| 624 int index, |
| 625 bool force_index); |
| 626 |
613 // Creates a new popup window with its own Browser object with the | 627 // Creates a new popup window with its own Browser object with the |
614 // incoming sizing information. |initial_pos|'s origin() is the | 628 // incoming sizing information. |initial_pos|'s origin() is the |
615 // window origin, and its size() is the size of the content area. | 629 // window origin, and its size() is the size of the content area. |
616 void BuildPopupWindow(TabContents* source, | 630 void BuildPopupWindow(TabContents* source, |
617 TabContents* new_contents, | 631 TabContents* new_contents, |
618 const gfx::Rect& initial_pos); | 632 const gfx::Rect& initial_pos); |
619 | 633 |
620 // Returns what the user's home page is, or the new tab page if the home page | 634 // Returns what the user's home page is, or the new tab page if the home page |
621 // has not been set. | 635 // has not been set. |
622 GURL GetHomePage() const; | 636 GURL GetHomePage() const; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // The browser idle task helps cleanup unused memory resources when idle. | 775 // The browser idle task helps cleanup unused memory resources when idle. |
762 scoped_ptr<BrowserIdleTimer> idle_task_; | 776 scoped_ptr<BrowserIdleTimer> idle_task_; |
763 | 777 |
764 // Keep track of the encoding auto detect pref. | 778 // Keep track of the encoding auto detect pref. |
765 BooleanPrefMember encoding_auto_detect_; | 779 BooleanPrefMember encoding_auto_detect_; |
766 | 780 |
767 DISALLOW_COPY_AND_ASSIGN(Browser); | 781 DISALLOW_COPY_AND_ASSIGN(Browser); |
768 }; | 782 }; |
769 | 783 |
770 #endif // CHROME_BROWSER_BROWSER_H_ | 784 #endif // CHROME_BROWSER_BROWSER_H_ |
OLD | NEW |