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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/instant/instant_delegate.h" | 24 #include "chrome/browser/instant/instant_delegate.h" |
25 #include "chrome/browser/prefs/pref_change_registrar.h" | 25 #include "chrome/browser/prefs/pref_change_registrar.h" |
26 #include "chrome/browser/prefs/pref_member.h" | 26 #include "chrome/browser/prefs/pref_member.h" |
27 #include "chrome/browser/sessions/session_id.h" | 27 #include "chrome/browser/sessions/session_id.h" |
28 #include "chrome/browser/sessions/tab_restore_service_observer.h" | 28 #include "chrome/browser/sessions/tab_restore_service_observer.h" |
29 #include "chrome/browser/sync/profile_sync_service_observer.h" | 29 #include "chrome/browser/sync/profile_sync_service_observer.h" |
30 #include "chrome/browser/tabs/tab_handler.h" | 30 #include "chrome/browser/tabs/tab_handler.h" |
31 #include "chrome/browser/tabs/tab_strip_model_delegate.h" // TODO(beng): remove | 31 #include "chrome/browser/tabs/tab_strip_model_delegate.h" // TODO(beng): remove |
32 #include "chrome/browser/tabs/tab_strip_model_observer.h" // TODO(beng): remove | 32 #include "chrome/browser/tabs/tab_strip_model_observer.h" // TODO(beng): remove |
33 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 33 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
| 34 #include "chrome/browser/ui/browser_show_actions.h" |
34 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 35 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
35 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" | 36 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" |
36 #include "chrome/browser/ui/browser_navigator.h" | 37 #include "chrome/browser/ui/browser_navigator.h" |
37 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" | 38 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" |
38 #include "chrome/browser/ui/dialog_style.h" | 39 #include "chrome/browser/ui/dialog_style.h" |
39 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" | 40 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" |
40 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" | 41 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" |
41 #include "chrome/browser/ui/select_file_dialog.h" | 42 #include "chrome/browser/ui/select_file_dialog.h" |
42 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 43 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| 44 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_container.h" |
43 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 45 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
44 #include "chrome/common/content_settings.h" | 46 #include "chrome/common/content_settings.h" |
45 #include "chrome/common/content_settings_types.h" | 47 #include "chrome/common/content_settings_types.h" |
46 #include "chrome/common/extensions/extension_constants.h" | 48 #include "chrome/common/extensions/extension_constants.h" |
47 #include "content/public/browser/notification_registrar.h" | 49 #include "content/public/browser/notification_registrar.h" |
48 #include "content/public/browser/page_navigator.h" | 50 #include "content/public/browser/page_navigator.h" |
49 #include "content/public/browser/web_contents_delegate.h" | 51 #include "content/public/browser/web_contents_delegate.h" |
50 #include "content/public/common/page_transition_types.h" | 52 #include "content/public/common/page_transition_types.h" |
51 #include "content/public/common/page_zoom.h" | 53 #include "content/public/common/page_zoom.h" |
52 #include "ui/base/ui_base_types.h" | 54 #include "ui/base/ui_base_types.h" |
(...skipping 19 matching lines...) Expand all Loading... |
72 | 74 |
73 namespace content { | 75 namespace content { |
74 class NavigationController; | 76 class NavigationController; |
75 class SessionStorageNamespace; | 77 class SessionStorageNamespace; |
76 } | 78 } |
77 | 79 |
78 namespace gfx { | 80 namespace gfx { |
79 class Point; | 81 class Point; |
80 } | 82 } |
81 | 83 |
82 class Browser : public TabHandlerDelegate, | 84 class Browser : public BrowserShowActions, |
| 85 public TabHandlerDelegate, |
83 public content::WebContentsDelegate, | 86 public content::WebContentsDelegate, |
84 public CoreTabHelperDelegate, | 87 public CoreTabHelperDelegate, |
85 public SearchEngineTabHelperDelegate, | 88 public SearchEngineTabHelperDelegate, |
86 public ConstrainedWindowTabHelperDelegate, | 89 public ConstrainedWindowTabHelperDelegate, |
87 public BlockedContentTabHelperDelegate, | 90 public BlockedContentTabHelperDelegate, |
88 public BookmarkTabHelperDelegate, | 91 public BookmarkTabHelperDelegate, |
89 public ExtensionTabHelperDelegate, | 92 public ExtensionTabHelperDelegate, |
90 public content::PageNavigator, | 93 public content::PageNavigator, |
91 public CommandUpdater::CommandUpdaterDelegate, | 94 public CommandUpdater::CommandUpdaterDelegate, |
92 public content::NotificationObserver, | 95 public content::NotificationObserver, |
93 public SelectFileDialog::Listener, | 96 public SelectFileDialog::Listener, |
| 97 public TabContentsWrapperContainer, |
94 public TabRestoreServiceObserver, | 98 public TabRestoreServiceObserver, |
95 public ProfileSyncServiceObserver, | 99 public ProfileSyncServiceObserver, |
96 public InstantDelegate { | 100 public InstantDelegate { |
97 public: | 101 public: |
98 // SessionService::WindowType mirrors these values. If you add to this | 102 // SessionService::WindowType mirrors these values. If you add to this |
99 // enum, look at SessionService::WindowType to see if it needs to be | 103 // enum, look at SessionService::WindowType to see if it needs to be |
100 // updated. | 104 // updated. |
101 enum Type { | 105 enum Type { |
102 // If you add a new type, consider updating the test | 106 // If you add a new type, consider updating the test |
103 // BrowserTest.StartMaximized. | 107 // BrowserTest.StartMaximized. |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 DownloadClosePreventionType OkToCloseWithInProgressDownloads( | 400 DownloadClosePreventionType OkToCloseWithInProgressDownloads( |
397 int* num_downloads_blocking) const; | 401 int* num_downloads_blocking) const; |
398 | 402 |
399 // TabStripModel pass-thrus ///////////////////////////////////////////////// | 403 // TabStripModel pass-thrus ///////////////////////////////////////////////// |
400 | 404 |
401 TabStripModel* tabstrip_model() const { | 405 TabStripModel* tabstrip_model() const { |
402 // TODO(beng): remove this accessor. It violates google style. | 406 // TODO(beng): remove this accessor. It violates google style. |
403 return tab_handler_->GetTabStripModel(); | 407 return tab_handler_->GetTabStripModel(); |
404 } | 408 } |
405 | 409 |
406 int tab_count() const; | |
407 int active_index() const; | |
408 int GetIndexOfController( | |
409 const content::NavigationController* controller) const; | |
410 | |
411 // TODO(dpapad): Rename to GetActiveTabContentsWrapper(). | |
412 TabContentsWrapper* GetSelectedTabContentsWrapper() const; | |
413 // A convenient version of the above which returns the TCW's WebContents. | |
414 content::WebContents* GetSelectedWebContents() const; | |
415 TabContentsWrapper* GetTabContentsWrapperAt(int index) const; | |
416 // A convenient version of the above which returns the TCW's WebContents. | |
417 content::WebContents* GetWebContentsAt(int index) const; | |
418 void ActivateTabAt(int index, bool user_gesture); | 410 void ActivateTabAt(int index, bool user_gesture); |
419 bool IsTabPinned(int index) const; | 411 bool IsTabPinned(int index) const; |
420 bool IsTabDiscarded(int index) const; | 412 bool IsTabDiscarded(int index) const; |
421 void CloseAllTabs(); | 413 void CloseAllTabs(); |
422 | 414 |
423 // Tab adding/showing functions ///////////////////////////////////////////// | 415 // Tab adding/showing functions ///////////////////////////////////////////// |
424 | 416 |
425 // Returns true if the tab strip is editable (for extensions). | 417 // Returns true if the tab strip is editable (for extensions). |
426 bool IsTabStripEditable() const; | 418 bool IsTabStripEditable() const; |
427 | 419 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 #if defined(OS_CHROMEOS) | 557 #if defined(OS_CHROMEOS) |
566 void Search(); | 558 void Search(); |
567 void ShowKeyboardOverlay(); | 559 void ShowKeyboardOverlay(); |
568 #endif | 560 #endif |
569 | 561 |
570 // Page-related commands | 562 // Page-related commands |
571 void BookmarkCurrentPage(); | 563 void BookmarkCurrentPage(); |
572 void SavePage(); | 564 void SavePage(); |
573 void ViewSelectedSource(); | 565 void ViewSelectedSource(); |
574 void ShowFindBar(); | 566 void ShowFindBar(); |
575 void ShowPageInfo(content::WebContents* web_contents, | 567 // Also see ShowPageInfo method (part of BrowserShowActions interface). |
576 const GURL& url, | |
577 const content::SSLStatus& ssl, | |
578 bool show_history); | |
579 | 568 |
580 // Returns true if the Browser supports the specified feature. The value of | 569 // Returns true if the Browser supports the specified feature. The value of |
581 // this varies during the lifetime of the browser. For example, if the window | 570 // this varies during the lifetime of the browser. For example, if the window |
582 // is fullscreen this may return a different value. If you only care about | 571 // is fullscreen this may return a different value. If you only care about |
583 // whether or not it's possible for the browser to support a particular | 572 // whether or not it's possible for the browser to support a particular |
584 // feature use |CanSupportWindowFeature|. | 573 // feature use |CanSupportWindowFeature|. |
585 bool SupportsWindowFeature(WindowFeature feature) const; | 574 bool SupportsWindowFeature(WindowFeature feature) const; |
586 | 575 |
587 // Returns true if the Browser can support the specified feature. See comment | 576 // Returns true if the Browser can support the specified feature. See comment |
588 // in |SupportsWindowFeature| for details on this. | 577 // in |SupportsWindowFeature| for details on this. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 void OpenBookmarkManagerEditNode(int64 node_id); | 622 void OpenBookmarkManagerEditNode(int64 node_id); |
634 void OpenBookmarkManagerAddNodeIn(int64 node_id); | 623 void OpenBookmarkManagerAddNodeIn(int64 node_id); |
635 void ShowAppMenu(); | 624 void ShowAppMenu(); |
636 void ShowAvatarMenu(); | 625 void ShowAvatarMenu(); |
637 void ShowHistoryTab(); | 626 void ShowHistoryTab(); |
638 void ShowDownloadsTab(); | 627 void ShowDownloadsTab(); |
639 void ShowExtensionsTab(); | 628 void ShowExtensionsTab(); |
640 void ShowAboutConflictsTab(); | 629 void ShowAboutConflictsTab(); |
641 void ShowBrokenPageTab(content::WebContents* contents); | 630 void ShowBrokenPageTab(content::WebContents* contents); |
642 void ShowOptionsTab(const std::string& sub_page); | 631 void ShowOptionsTab(const std::string& sub_page); |
643 // Shows the Content Settings page for a given content type. | |
644 void ShowContentSettingsPage(ContentSettingsType content_type); | |
645 void OpenClearBrowsingDataDialog(); | 632 void OpenClearBrowsingDataDialog(); |
646 void OpenOptionsDialog(); | 633 void OpenOptionsDialog(); |
647 void OpenPasswordManager(); | 634 void OpenPasswordManager(); |
648 void OpenSyncMyBookmarksDialog(); | 635 void OpenSyncMyBookmarksDialog(); |
649 void OpenImportSettingsDialog(); | 636 void OpenImportSettingsDialog(); |
650 void OpenInstantConfirmDialog(); | 637 void OpenInstantConfirmDialog(); |
651 void OpenAboutChromeDialog(); | 638 void OpenAboutChromeDialog(); |
652 void OpenUpdateChromeDialog(); | 639 void OpenUpdateChromeDialog(); |
653 void ShowHelpTab(); | 640 void ShowHelpTab(); |
654 void OpenAutofillHelpTabAndActivate(); | 641 void OpenAutofillHelpTabAndActivate(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 // disposition type of the command will be stored in |*disposition| if it's | 762 // disposition type of the command will be stored in |*disposition| if it's |
776 // not null. | 763 // not null. |
777 int GetLastBlockedCommand(WindowOpenDisposition* disposition); | 764 int GetLastBlockedCommand(WindowOpenDisposition* disposition); |
778 | 765 |
779 // Called by browser::Navigate() when a navigation has occurred in a tab in | 766 // Called by browser::Navigate() when a navigation has occurred in a tab in |
780 // this Browser. Updates the UI for the start of this navigation. | 767 // this Browser. Updates the UI for the start of this navigation. |
781 void UpdateUIForNavigationInTab(TabContentsWrapper* contents, | 768 void UpdateUIForNavigationInTab(TabContentsWrapper* contents, |
782 content::PageTransition transition, | 769 content::PageTransition transition, |
783 bool user_initiated); | 770 bool user_initiated); |
784 | 771 |
785 // Shows the cookies collected in the tab contents wrapper. | 772 // Interface implementations //////////////////////////////////////////////// |
786 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); | |
787 | 773 |
788 // Interface implementations //////////////////////////////////////////////// | 774 // Overridden from BrowserShowActions: |
| 775 virtual void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) OVERRIDE; |
| 776 virtual void ShowContentSettingsPage( |
| 777 ContentSettingsType content_type) OVERRIDE; |
| 778 virtual void ShowPageInfo(content::WebContents* web_contents, |
| 779 const GURL& url, |
| 780 const content::SSLStatus& ssl, |
| 781 bool show_history) OVERRIDE; |
| 782 |
| 783 // Overriddent from TabContentsWrapperContainer: |
| 784 virtual int tab_count() const OVERRIDE; |
| 785 virtual int active_index() const OVERRIDE; |
| 786 virtual int GetIndexOfController( |
| 787 const content::NavigationController* controller) const OVERRIDE; |
| 788 virtual TabContentsWrapper* GetSelectedTabContentsWrapper() const OVERRIDE; |
| 789 virtual content::WebContents* GetSelectedWebContents() const OVERRIDE; |
| 790 virtual TabContentsWrapper* GetTabContentsWrapperAt(int index) const OVERRIDE; |
| 791 virtual content::WebContents* GetWebContentsAt(int index) const OVERRIDE; |
789 | 792 |
790 // Overridden from content::PageNavigator: | 793 // Overridden from content::PageNavigator: |
791 virtual content::WebContents* OpenURL( | 794 virtual content::WebContents* OpenURL( |
792 const content::OpenURLParams& params) OVERRIDE; | 795 const content::OpenURLParams& params) OVERRIDE; |
793 | 796 |
794 // Overridden from CommandUpdater::CommandUpdaterDelegate: | 797 // Overridden from CommandUpdater::CommandUpdaterDelegate: |
795 virtual void ExecuteCommand(int id) OVERRIDE; | 798 virtual void ExecuteCommand(int id) OVERRIDE; |
796 | 799 |
797 // Overridden from TabRestoreServiceObserver: | 800 // Overridden from TabRestoreServiceObserver: |
798 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | 801 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1471 |
1469 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 1472 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
1470 | 1473 |
1471 // True if the browser window has been shown at least once. | 1474 // True if the browser window has been shown at least once. |
1472 bool window_has_shown_; | 1475 bool window_has_shown_; |
1473 | 1476 |
1474 DISALLOW_COPY_AND_ASSIGN(Browser); | 1477 DISALLOW_COPY_AND_ASSIGN(Browser); |
1475 }; | 1478 }; |
1476 | 1479 |
1477 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1480 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |