| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_UI_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 // TabStripModel pass-thrus ///////////////////////////////////////////////// | 383 // TabStripModel pass-thrus ///////////////////////////////////////////////// |
| 384 | 384 |
| 385 TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); } | 385 TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); } |
| 386 | 386 |
| 387 int tab_count() const; | 387 int tab_count() const; |
| 388 int active_index() const; | 388 int active_index() const; |
| 389 int GetIndexOfController( | 389 int GetIndexOfController( |
| 390 const content::NavigationController* controller) const; | 390 const content::NavigationController* controller) const; |
| 391 | 391 |
| 392 // TODO(dpapad): Rename to GetActiveTabContentsWrapper(). | 392 TabContents* GetSelectedTabContentsWrapper() const; // DEPRECATED |
| 393 TabContentsWrapper* GetSelectedTabContentsWrapper() const; | 393 TabContents* GetActiveTabContents() const; |
| 394 // A convenient version of the above which returns the TCW's WebContents. | 394 // A convenient version of the above which returns the TabContents's |
| 395 content::WebContents* GetSelectedWebContents() const; | 395 // WebContents. |
| 396 TabContentsWrapper* GetTabContentsWrapperAt(int index) const; | 396 content::WebContents* GetSelectedWebContents() const; // DEPRECATED |
| 397 // A convenient version of the above which returns the TCW's WebContents. | 397 content::WebContents* GetActiveWebContents() const; |
| 398 TabContents* GetTabContentsWrapperAt(int index) const; // DEPRECATED |
| 399 TabContents* GetTabContentsAt(int index) const; |
| 400 // A convenient version of the above which returns the TabContents's |
| 401 // WebContents. |
| 398 content::WebContents* GetWebContentsAt(int index) const; | 402 content::WebContents* GetWebContentsAt(int index) const; |
| 399 void ActivateTabAt(int index, bool user_gesture); | 403 void ActivateTabAt(int index, bool user_gesture); |
| 400 bool IsTabPinned(int index) const; | 404 bool IsTabPinned(int index) const; |
| 401 bool IsTabDiscarded(int index) const; | 405 bool IsTabDiscarded(int index) const; |
| 402 void CloseAllTabs(); | 406 void CloseAllTabs(); |
| 403 | 407 |
| 404 // Tab adding/showing functions ///////////////////////////////////////////// | 408 // Tab adding/showing functions ///////////////////////////////////////////// |
| 405 | 409 |
| 406 // Returns true if the tab strip is editable (for extensions). | 410 // Returns true if the tab strip is editable (for extensions). |
| 407 bool IsTabStripEditable() const; | 411 bool IsTabStripEditable() const; |
| 408 | 412 |
| 409 // Returns the index to insert a tab at during session restore and startup. | 413 // Returns the index to insert a tab at during session restore and startup. |
| 410 // |relative_index| gives the index of the url into the number of tabs that | 414 // |relative_index| gives the index of the url into the number of tabs that |
| 411 // are going to be opened. For example, if three urls are passed in on the | 415 // are going to be opened. For example, if three urls are passed in on the |
| 412 // command line this is invoked three times with the values 0, 1 and 2. | 416 // command line this is invoked three times with the values 0, 1 and 2. |
| 413 int GetIndexForInsertionDuringRestore(int relative_index); | 417 int GetIndexForInsertionDuringRestore(int relative_index); |
| 414 | 418 |
| 415 // Adds a selected tab with the specified URL and transition, returns the | 419 // Adds a selected tab with the specified URL and transition, returns the |
| 416 // created TabContentsWrapper. | 420 // created TabContents. |
| 417 TabContentsWrapper* AddSelectedTabWithURL( | 421 TabContents* AddSelectedTabWithURL(const GURL& url, |
| 418 const GURL& url, | 422 content::PageTransition transition); |
| 419 content::PageTransition transition); | |
| 420 | 423 |
| 421 // Add a new tab, given a TabContentsWrapper. A WebContents appropriate to | 424 // Add a new tab, given a TabContents. A WebContents appropriate to |
| 422 // display the last committed entry is created and returned. | 425 // display the last committed entry is created and returned. |
| 423 content::WebContents* AddTab(TabContentsWrapper* tab_contents, | 426 content::WebContents* AddTab(TabContents* tab_contents, |
| 424 content::PageTransition type); | 427 content::PageTransition type); |
| 425 | 428 |
| 426 // Add a tab with its session history restored from the SessionRestore | 429 // Add a tab with its session history restored from the SessionRestore |
| 427 // system. If select is true, the tab is selected. |tab_index| gives the index | 430 // system. If select is true, the tab is selected. |tab_index| gives the index |
| 428 // to insert the tab at. |selected_navigation| is the index of the | 431 // to insert the tab at. |selected_navigation| is the index of the |
| 429 // TabNavigation in |navigations| to select. If |extension_app_id| is | 432 // TabNavigation in |navigations| to select. If |extension_app_id| is |
| 430 // non-empty the tab is an app tab and |extension_app_id| is the id of the | 433 // non-empty the tab is an app tab and |extension_app_id| is the id of the |
| 431 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then | 434 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then |
| 432 // the newly created tab is pinned. If |from_last_session| is true, | 435 // the newly created tab is pinned. If |from_last_session| is true, |
| 433 // |navigations| are from the previous session. | 436 // |navigations| are from the previous session. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 void SetBlockCommandExecution(bool block); | 700 void SetBlockCommandExecution(bool block); |
| 698 | 701 |
| 699 // Gets the last blocked command after calling SetBlockCommandExecution(true). | 702 // Gets the last blocked command after calling SetBlockCommandExecution(true). |
| 700 // Returns the command id or -1 if there is no command blocked. The | 703 // Returns the command id or -1 if there is no command blocked. The |
| 701 // disposition type of the command will be stored in |*disposition| if it's | 704 // disposition type of the command will be stored in |*disposition| if it's |
| 702 // not null. | 705 // not null. |
| 703 int GetLastBlockedCommand(WindowOpenDisposition* disposition); | 706 int GetLastBlockedCommand(WindowOpenDisposition* disposition); |
| 704 | 707 |
| 705 // Called by browser::Navigate() when a navigation has occurred in a tab in | 708 // Called by browser::Navigate() when a navigation has occurred in a tab in |
| 706 // this Browser. Updates the UI for the start of this navigation. | 709 // this Browser. Updates the UI for the start of this navigation. |
| 707 void UpdateUIForNavigationInTab(TabContentsWrapper* contents, | 710 void UpdateUIForNavigationInTab(TabContents* contents, |
| 708 content::PageTransition transition, | 711 content::PageTransition transition, |
| 709 bool user_initiated); | 712 bool user_initiated); |
| 710 | 713 |
| 711 // Shows the cookies collected in the tab contents wrapper. | 714 // Shows the cookies collected in the tab contents. |
| 712 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); | 715 void ShowCollectedCookiesDialog(TabContents* tab_contents); |
| 713 | 716 |
| 714 // Interface implementations //////////////////////////////////////////////// | 717 // Interface implementations //////////////////////////////////////////////// |
| 715 | 718 |
| 716 // Overridden from content::PageNavigator: | 719 // Overridden from content::PageNavigator: |
| 717 virtual content::WebContents* OpenURL( | 720 virtual content::WebContents* OpenURL( |
| 718 const content::OpenURLParams& params) OVERRIDE; | 721 const content::OpenURLParams& params) OVERRIDE; |
| 719 | 722 |
| 720 // Overridden from CommandUpdater::CommandUpdaterDelegate: | 723 // Overridden from CommandUpdater::CommandUpdaterDelegate: |
| 721 virtual void ExecuteCommandWithDisposition( | 724 virtual void ExecuteCommandWithDisposition( |
| 722 int id, | 725 int id, |
| 723 WindowOpenDisposition disposition) OVERRIDE; | 726 WindowOpenDisposition disposition) OVERRIDE; |
| 724 | 727 |
| 725 // Overridden from TabRestoreServiceObserver: | 728 // Overridden from TabRestoreServiceObserver: |
| 726 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | 729 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; |
| 727 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; | 730 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; |
| 728 | 731 |
| 729 // Centralized method for creating a TabContentsWrapper, configuring and | 732 // Centralized method for creating a TabContents, configuring and |
| 730 // installing all its supporting objects and observers. | 733 // installing all its supporting objects and observers. |
| 731 static TabContentsWrapper* TabContentsFactory( | 734 static TabContents* TabContentsFactory( |
| 732 Profile* profile, | 735 Profile* profile, |
| 733 content::SiteInstance* site_instance, | 736 content::SiteInstance* site_instance, |
| 734 int routing_id, | 737 int routing_id, |
| 735 const content::WebContents* base_web_contents, | 738 const content::WebContents* base_web_contents, |
| 736 content::SessionStorageNamespace* session_storage_namespace); | 739 content::SessionStorageNamespace* session_storage_namespace); |
| 737 | 740 |
| 738 // Overridden from TabStripModelDelegate: | 741 // Overridden from TabStripModelDelegate: |
| 739 virtual TabContentsWrapper* AddBlankTab(bool foreground) OVERRIDE; | 742 virtual TabContents* AddBlankTab(bool foreground) OVERRIDE; |
| 740 virtual TabContentsWrapper* AddBlankTabAt(int index, | 743 virtual TabContents* AddBlankTabAt(int index, |
| 741 bool foreground) OVERRIDE; | 744 bool foreground) OVERRIDE; |
| 742 virtual Browser* CreateNewStripWithContents( | 745 virtual Browser* CreateNewStripWithContents( |
| 743 TabContentsWrapper* detached_contents, | 746 TabContents* detached_contents, |
| 744 const gfx::Rect& window_bounds, | 747 const gfx::Rect& window_bounds, |
| 745 const DockInfo& dock_info, | 748 const DockInfo& dock_info, |
| 746 bool maximize) OVERRIDE; | 749 bool maximize) OVERRIDE; |
| 747 virtual int GetDragActions() const OVERRIDE; | 750 virtual int GetDragActions() const OVERRIDE; |
| 748 // Construct a TabContentsWrapper for a given URL, profile and transition | 751 // Construct a TabContents for a given URL, profile and transition type. If |
| 749 // type. If instance is not null, its process will be used to render the tab. | 752 // instance is not null, its process will be used to render the tab. |
| 750 virtual TabContentsWrapper* CreateTabContentsForURL( | 753 virtual TabContents* CreateTabContentsForURL( |
| 751 const GURL& url, | 754 const GURL& url, |
| 752 const content::Referrer& referrer, | 755 const content::Referrer& referrer, |
| 753 Profile* profile, | 756 Profile* profile, |
| 754 content::PageTransition transition, | 757 content::PageTransition transition, |
| 755 bool defer_load, | 758 bool defer_load, |
| 756 content::SiteInstance* instance) const OVERRIDE; | 759 content::SiteInstance* instance) const OVERRIDE; |
| 757 virtual bool CanDuplicateContentsAt(int index) OVERRIDE; | 760 virtual bool CanDuplicateContentsAt(int index) OVERRIDE; |
| 758 virtual void DuplicateContentsAt(int index) OVERRIDE; | 761 virtual void DuplicateContentsAt(int index) OVERRIDE; |
| 759 virtual void CloseFrameAfterDragSession() OVERRIDE; | 762 virtual void CloseFrameAfterDragSession() OVERRIDE; |
| 760 virtual void CreateHistoricalTab(TabContentsWrapper* contents) OVERRIDE; | 763 virtual void CreateHistoricalTab(TabContents* contents) OVERRIDE; |
| 761 virtual bool RunUnloadListenerBeforeClosing( | 764 virtual bool RunUnloadListenerBeforeClosing(TabContents* contents) OVERRIDE; |
| 762 TabContentsWrapper* contents) OVERRIDE; | |
| 763 virtual bool CanCloseContents(std::vector<int>* indices) OVERRIDE; | 765 virtual bool CanCloseContents(std::vector<int>* indices) OVERRIDE; |
| 764 virtual bool CanBookmarkAllTabs() const OVERRIDE; | 766 virtual bool CanBookmarkAllTabs() const OVERRIDE; |
| 765 virtual void BookmarkAllTabs() OVERRIDE; | 767 virtual void BookmarkAllTabs() OVERRIDE; |
| 766 virtual bool CanCloseTab() const OVERRIDE; | 768 virtual bool CanCloseTab() const OVERRIDE; |
| 767 virtual bool CanRestoreTab() OVERRIDE; | 769 virtual bool CanRestoreTab() OVERRIDE; |
| 768 virtual void RestoreTab() OVERRIDE; | 770 virtual void RestoreTab() OVERRIDE; |
| 769 virtual bool LargeIconsPermitted() const OVERRIDE; | 771 virtual bool LargeIconsPermitted() const OVERRIDE; |
| 770 | 772 |
| 771 // Overridden from TabStripModelObserver: | 773 // Overridden from TabStripModelObserver: |
| 772 virtual void TabInsertedAt(TabContentsWrapper* contents, | 774 virtual void TabInsertedAt(TabContents* contents, |
| 773 int index, | 775 int index, |
| 774 bool foreground) OVERRIDE; | 776 bool foreground) OVERRIDE; |
| 775 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 777 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
| 776 TabContentsWrapper* contents, | 778 TabContents* contents, |
| 777 int index) OVERRIDE; | 779 int index) OVERRIDE; |
| 778 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; | 780 virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; |
| 779 virtual void TabDeactivated(TabContentsWrapper* contents) OVERRIDE; | 781 virtual void TabDeactivated(TabContents* contents) OVERRIDE; |
| 780 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 782 virtual void ActiveTabChanged(TabContents* old_contents, |
| 781 TabContentsWrapper* new_contents, | 783 TabContents* new_contents, |
| 782 int index, | 784 int index, |
| 783 bool user_gesture) OVERRIDE; | 785 bool user_gesture) OVERRIDE; |
| 784 virtual void TabMoved(TabContentsWrapper* contents, | 786 virtual void TabMoved(TabContents* contents, |
| 785 int from_index, | 787 int from_index, |
| 786 int to_index) OVERRIDE; | 788 int to_index) OVERRIDE; |
| 787 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 789 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 788 TabContentsWrapper* old_contents, | 790 TabContents* old_contents, |
| 789 TabContentsWrapper* new_contents, | 791 TabContents* new_contents, |
| 790 int index) OVERRIDE; | 792 int index) OVERRIDE; |
| 791 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, | 793 virtual void TabPinnedStateChanged(TabContents* contents, |
| 792 int index) OVERRIDE; | 794 int index) OVERRIDE; |
| 793 virtual void TabStripEmpty() OVERRIDE; | 795 virtual void TabStripEmpty() OVERRIDE; |
| 794 | 796 |
| 795 // Fullscreen permission infobar callbacks. | 797 // Fullscreen permission infobar callbacks. |
| 796 // TODO(koz): Remove this and have callers call FullscreenController directly. | 798 // TODO(koz): Remove this and have callers call FullscreenController directly. |
| 797 void OnAcceptFullscreenPermission(const GURL& url, | 799 void OnAcceptFullscreenPermission(const GURL& url, |
| 798 FullscreenExitBubbleType bubble_type); | 800 FullscreenExitBubbleType bubble_type); |
| 799 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); | 801 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); |
| 800 | 802 |
| 801 // Figure out if there are tabs that have beforeunload handlers. | 803 // Figure out if there are tabs that have beforeunload handlers. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 822 | 824 |
| 823 void set_pending_web_app_action(WebAppAction action) { | 825 void set_pending_web_app_action(WebAppAction action) { |
| 824 pending_web_app_action_ = action; | 826 pending_web_app_action_ = action; |
| 825 } | 827 } |
| 826 | 828 |
| 827 ExtensionWindowController* extension_window_controller() const { | 829 ExtensionWindowController* extension_window_controller() const { |
| 828 return extension_window_controller_.get(); | 830 return extension_window_controller_.get(); |
| 829 } | 831 } |
| 830 | 832 |
| 831 protected: | 833 protected: |
| 832 // Wrapper for the factory method in BrowserWindow. This allows subclasses to | 834 // Funnel for the factory method in BrowserWindow. This allows subclasses to |
| 833 // set their own window. | 835 // set their own window. |
| 834 virtual BrowserWindow* CreateBrowserWindow(); | 836 virtual BrowserWindow* CreateBrowserWindow(); |
| 835 | 837 |
| 836 private: | 838 private: |
| 837 friend class BrowserTest; | 839 friend class BrowserTest; |
| 838 friend class FullscreenControllerTest; | 840 friend class FullscreenControllerTest; |
| 839 FRIEND_TEST_ALL_PREFIXES(AppModeTest, EnableAppModeTest); | 841 FRIEND_TEST_ALL_PREFIXES(AppModeTest, EnableAppModeTest); |
| 840 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); | 842 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); |
| 841 FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut); | 843 FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut); |
| 842 FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp); | 844 FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 int active_match_ordinal, | 999 int active_match_ordinal, |
| 998 bool final_update) OVERRIDE; | 1000 bool final_update) OVERRIDE; |
| 999 | 1001 |
| 1000 virtual void RequestToLockMouse(content::WebContents* tab, | 1002 virtual void RequestToLockMouse(content::WebContents* tab, |
| 1001 bool user_gesture, | 1003 bool user_gesture, |
| 1002 bool last_unlocked_by_target) OVERRIDE; | 1004 bool last_unlocked_by_target) OVERRIDE; |
| 1003 virtual void LostMouseLock() OVERRIDE; | 1005 virtual void LostMouseLock() OVERRIDE; |
| 1004 | 1006 |
| 1005 // Overridden from CoreTabHelperDelegate: | 1007 // Overridden from CoreTabHelperDelegate: |
| 1006 // Note that the caller is responsible for deleting |old_tab_contents|. | 1008 // Note that the caller is responsible for deleting |old_tab_contents|. |
| 1007 virtual void SwapTabContents(TabContentsWrapper* old_tab_contents, | 1009 virtual void SwapTabContents(TabContents* old_tab_contents, |
| 1008 TabContentsWrapper* new_tab_contents) OVERRIDE; | 1010 TabContents* new_tab_contents) OVERRIDE; |
| 1009 | 1011 |
| 1010 // Overridden from SearchEngineTabHelperDelegate: | 1012 // Overridden from SearchEngineTabHelperDelegate: |
| 1011 virtual void ConfirmAddSearchProvider(TemplateURL* template_url, | 1013 virtual void ConfirmAddSearchProvider(TemplateURL* template_url, |
| 1012 Profile* profile) OVERRIDE; | 1014 Profile* profile) OVERRIDE; |
| 1013 | 1015 |
| 1014 // Overridden from ConstrainedWindowTabHelperDelegate: | 1016 // Overridden from ConstrainedWindowTabHelperDelegate: |
| 1015 virtual void SetTabContentBlocked(TabContentsWrapper* contents, | 1017 virtual void SetTabContentBlocked(TabContents* contents, |
| 1016 bool blocked) OVERRIDE; | 1018 bool blocked) OVERRIDE; |
| 1017 | 1019 |
| 1018 // Overridden from BlockedContentTabHelperDelegate: | 1020 // Overridden from BlockedContentTabHelperDelegate: |
| 1019 virtual TabContentsWrapper* GetConstrainingContentsWrapper( | 1021 virtual TabContents* GetConstrainingContentsWrapper( |
| 1020 TabContentsWrapper* source) OVERRIDE; | 1022 TabContents* source) OVERRIDE; |
| 1021 | 1023 |
| 1022 // Overridden from BookmarkTabHelperDelegate: | 1024 // Overridden from BookmarkTabHelperDelegate: |
| 1023 virtual void URLStarredChanged(TabContentsWrapper* source, | 1025 virtual void URLStarredChanged(TabContents* source, |
| 1024 bool starred) OVERRIDE; | 1026 bool starred) OVERRIDE; |
| 1025 | 1027 |
| 1026 // Overridden from ZoomObserver: | 1028 // Overridden from ZoomObserver: |
| 1027 virtual void OnZoomIconChanged(TabContentsWrapper* source, | 1029 virtual void OnZoomIconChanged(TabContents* source, |
| 1028 ZoomController::ZoomIconState state) OVERRIDE; | 1030 ZoomController::ZoomIconState state) OVERRIDE; |
| 1029 virtual void OnZoomChanged(TabContentsWrapper* source, | 1031 virtual void OnZoomChanged(TabContents* source, |
| 1030 int zoom_percent, | 1032 int zoom_percent, |
| 1031 bool can_show_bubble) OVERRIDE; | 1033 bool can_show_bubble) OVERRIDE; |
| 1032 | 1034 |
| 1033 // Overridden from ExtensionTabHelperDelegate: | 1035 // Overridden from ExtensionTabHelperDelegate: |
| 1034 virtual void OnDidGetApplicationInfo(TabContentsWrapper* source, | 1036 virtual void OnDidGetApplicationInfo(TabContents* source, |
| 1035 int32 page_id) OVERRIDE; | 1037 int32 page_id) OVERRIDE; |
| 1036 virtual void OnInstallApplication( | 1038 virtual void OnInstallApplication( |
| 1037 TabContentsWrapper* source, | 1039 TabContents* source, |
| 1038 const WebApplicationInfo& app_info) OVERRIDE; | 1040 const WebApplicationInfo& app_info) OVERRIDE; |
| 1039 | 1041 |
| 1040 // Overridden from SelectFileDialog::Listener: | 1042 // Overridden from SelectFileDialog::Listener: |
| 1041 virtual void FileSelected(const FilePath& path, | 1043 virtual void FileSelected(const FilePath& path, |
| 1042 int index, | 1044 int index, |
| 1043 void* params) OVERRIDE; | 1045 void* params) OVERRIDE; |
| 1044 | 1046 |
| 1045 // Overridden from content::NotificationObserver: | 1047 // Overridden from content::NotificationObserver: |
| 1046 virtual void Observe(int type, | 1048 virtual void Observe(int type, |
| 1047 const content::NotificationSource& source, | 1049 const content::NotificationSource& source, |
| 1048 const content::NotificationDetails& details) OVERRIDE; | 1050 const content::NotificationDetails& details) OVERRIDE; |
| 1049 | 1051 |
| 1050 // Overridden from ProfileSyncServiceObserver: | 1052 // Overridden from ProfileSyncServiceObserver: |
| 1051 virtual void OnStateChanged() OVERRIDE; | 1053 virtual void OnStateChanged() OVERRIDE; |
| 1052 | 1054 |
| 1053 // Overriden from InstantDelegate: | 1055 // Overriden from InstantDelegate: |
| 1054 virtual void ShowInstant(TabContentsWrapper* preview_contents) OVERRIDE; | 1056 virtual void ShowInstant(TabContents* preview_contents) OVERRIDE; |
| 1055 virtual void HideInstant() OVERRIDE; | 1057 virtual void HideInstant() OVERRIDE; |
| 1056 virtual void CommitInstant(TabContentsWrapper* preview_contents) OVERRIDE; | 1058 virtual void CommitInstant(TabContents* preview_contents) OVERRIDE; |
| 1057 virtual void SetSuggestedText(const string16& text, | 1059 virtual void SetSuggestedText(const string16& text, |
| 1058 InstantCompleteBehavior behavior) OVERRIDE; | 1060 InstantCompleteBehavior behavior) OVERRIDE; |
| 1059 virtual gfx::Rect GetInstantBounds() OVERRIDE; | 1061 virtual gfx::Rect GetInstantBounds() OVERRIDE; |
| 1060 virtual void InstantPreviewFocused() OVERRIDE; | 1062 virtual void InstantPreviewFocused() OVERRIDE; |
| 1061 virtual TabContentsWrapper* GetInstantHostTabContents() const OVERRIDE; | 1063 virtual TabContents* GetInstantHostTabContents() const OVERRIDE; |
| 1062 | 1064 |
| 1063 // Command and state updating /////////////////////////////////////////////// | 1065 // Command and state updating /////////////////////////////////////////////// |
| 1064 | 1066 |
| 1065 // Returns true if the regular Chrome UI (not the fullscreen one and | 1067 // Returns true if the regular Chrome UI (not the fullscreen one and |
| 1066 // not the single-tab one) is shown. Used for updating window command states | 1068 // not the single-tab one) is shown. Used for updating window command states |
| 1067 // only. Consider using SupportsWindowFeature if you need the mentioned | 1069 // only. Consider using SupportsWindowFeature if you need the mentioned |
| 1068 // functionality anywhere else. | 1070 // functionality anywhere else. |
| 1069 bool IsShowingMainUI(bool is_fullscreen); | 1071 bool IsShowingMainUI(bool is_fullscreen); |
| 1070 | 1072 |
| 1071 // Initialize state for all browser commands. | 1073 // Initialize state for all browser commands. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 | 1192 |
| 1191 // In-progress download termination handling ///////////////////////////////// | 1193 // In-progress download termination handling ///////////////////////////////// |
| 1192 | 1194 |
| 1193 // Called when the window is closing to check if potential in-progress | 1195 // Called when the window is closing to check if potential in-progress |
| 1194 // downloads should prevent it from closing. | 1196 // downloads should prevent it from closing. |
| 1195 // Returns true if the window can close, false otherwise. | 1197 // Returns true if the window can close, false otherwise. |
| 1196 bool CanCloseWithInProgressDownloads(); | 1198 bool CanCloseWithInProgressDownloads(); |
| 1197 | 1199 |
| 1198 // Assorted utility functions /////////////////////////////////////////////// | 1200 // Assorted utility functions /////////////////////////////////////////////// |
| 1199 | 1201 |
| 1200 // Sets the delegate of all the parts of the |TabContentsWrapper| that | 1202 // Sets the delegate of all the parts of the TabContents that |
| 1201 // are needed. | 1203 // are needed. |
| 1202 void SetAsDelegate(TabContentsWrapper* tab, Browser* delegate); | 1204 void SetAsDelegate(TabContents* tab, Browser* delegate); |
| 1203 | 1205 |
| 1204 // Shows the Find Bar, optionally selecting the next entry that matches the | 1206 // Shows the Find Bar, optionally selecting the next entry that matches the |
| 1205 // existing search string for that Tab. |forward_direction| controls the | 1207 // existing search string for that Tab. |forward_direction| controls the |
| 1206 // search direction. | 1208 // search direction. |
| 1207 void FindInPage(bool find_next, bool forward_direction); | 1209 void FindInPage(bool find_next, bool forward_direction); |
| 1208 | 1210 |
| 1209 // Closes the frame. | 1211 // Closes the frame. |
| 1210 // TODO(beng): figure out if we need this now that the frame itself closes | 1212 // TODO(beng): figure out if we need this now that the frame itself closes |
| 1211 // after a return to the message loop. | 1213 // after a return to the message loop. |
| 1212 void CloseFrame(); | 1214 void CloseFrame(); |
| 1213 | 1215 |
| 1214 void TabDetachedAtImpl(TabContentsWrapper* contents, | 1216 void TabDetachedAtImpl(TabContents* contents, int index, DetachType type); |
| 1215 int index, DetachType type); | |
| 1216 | 1217 |
| 1217 // Create a preference dictionary for the provided application name, in the | 1218 // Create a preference dictionary for the provided application name, in the |
| 1218 // given user profile. This is done only once per application name / per | 1219 // given user profile. This is done only once per application name / per |
| 1219 // session / per user profile. | 1220 // session / per user profile. |
| 1220 static void RegisterAppPrefs(const std::string& app_name, Profile* profile); | 1221 static void RegisterAppPrefs(const std::string& app_name, Profile* profile); |
| 1221 | 1222 |
| 1222 // Shared code between Reload() and ReloadIgnoringCache(). | 1223 // Shared code between Reload() and ReloadIgnoringCache(). |
| 1223 void ReloadInternal(WindowOpenDisposition disposition, bool ignore_cache); | 1224 void ReloadInternal(WindowOpenDisposition disposition, bool ignore_cache); |
| 1224 | 1225 |
| 1225 // Depending on the disposition, return the current tab or a clone of the | 1226 // Depending on the disposition, return the current tab or a clone of the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1244 bool IsClosingPermitted(); | 1245 bool IsClosingPermitted(); |
| 1245 | 1246 |
| 1246 // Commits the current instant, returning true on success. This is intended | 1247 // Commits the current instant, returning true on success. This is intended |
| 1247 // for use from OpenCurrentURL. | 1248 // for use from OpenCurrentURL. |
| 1248 bool OpenInstant(WindowOpenDisposition disposition); | 1249 bool OpenInstant(WindowOpenDisposition disposition); |
| 1249 | 1250 |
| 1250 // If this browser should have instant one is created, otherwise does nothing. | 1251 // If this browser should have instant one is created, otherwise does nothing. |
| 1251 void CreateInstantIfNecessary(); | 1252 void CreateInstantIfNecessary(); |
| 1252 | 1253 |
| 1253 // Opens view-source tab for given tab contents. | 1254 // Opens view-source tab for given tab contents. |
| 1254 void ViewSource(TabContentsWrapper* tab); | 1255 void ViewSource(TabContents* tab); |
| 1255 | 1256 |
| 1256 // Opens view-source tab for any frame within given tab contents. | 1257 // Opens view-source tab for any frame within given tab contents. |
| 1257 void ViewSource(TabContentsWrapper* tab, | 1258 void ViewSource(TabContents* tab, |
| 1258 const GURL& url, | 1259 const GURL& url, |
| 1259 const std::string& content_state); | 1260 const std::string& content_state); |
| 1260 | 1261 |
| 1261 // Retrieves the content restrictions for the currently selected tab. | 1262 // Retrieves the content restrictions for the currently selected tab. |
| 1262 // Returns 0 if no tab selected, which is equivalent to no content | 1263 // Returns 0 if no tab selected, which is equivalent to no content |
| 1263 // restrictions active. | 1264 // restrictions active. |
| 1264 int GetContentRestrictionsForSelectedTab(); | 1265 int GetContentRestrictionsForSelectedTab(); |
| 1265 | 1266 |
| 1266 // Resets |bookmark_bar_state_| based on the active tab. Notifies the | 1267 // Resets |bookmark_bar_state_| based on the active tab. Notifies the |
| 1267 // BrowserWindow if necessary. | 1268 // BrowserWindow if necessary. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 bool window_has_shown_; | 1427 bool window_has_shown_; |
| 1427 | 1428 |
| 1428 // Currently open color chooser. Non-NULL after OpenColorChooser is called and | 1429 // Currently open color chooser. Non-NULL after OpenColorChooser is called and |
| 1429 // before DidEndColorChooser is called. | 1430 // before DidEndColorChooser is called. |
| 1430 scoped_ptr<content::ColorChooser> color_chooser_; | 1431 scoped_ptr<content::ColorChooser> color_chooser_; |
| 1431 | 1432 |
| 1432 DISALLOW_COPY_AND_ASSIGN(Browser); | 1433 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 1433 }; | 1434 }; |
| 1434 | 1435 |
| 1435 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1436 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
| OLD | NEW |