| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "chrome/browser/command_updater.h" | |
| 21 #include "chrome/browser/debugger/devtools_toggle_action.h" | 20 #include "chrome/browser/debugger/devtools_toggle_action.h" |
| 22 #include "chrome/browser/event_disposition.h" | 21 #include "chrome/browser/event_disposition.h" |
| 23 #include "chrome/browser/extensions/extension_tab_helper_delegate.h" | 22 #include "chrome/browser/extensions/extension_tab_helper_delegate.h" |
| 24 #include "chrome/browser/instant/instant_delegate.h" | 23 #include "chrome/browser/instant/instant_delegate.h" |
| 25 #include "chrome/browser/prefs/pref_change_registrar.h" | 24 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 26 #include "chrome/browser/prefs/pref_member.h" | 25 #include "chrome/browser/prefs/pref_member.h" |
| 27 #include "chrome/browser/sessions/session_id.h" | 26 #include "chrome/browser/sessions/session_id.h" |
| 28 #include "chrome/browser/sessions/tab_restore_service_observer.h" | |
| 29 #include "chrome/browser/sync/profile_sync_service_observer.h" | |
| 30 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 27 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
| 31 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 28 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" | 29 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" |
| 33 #include "chrome/browser/ui/browser_navigator.h" | 30 #include "chrome/browser/ui/browser_navigator.h" |
| 34 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" | 31 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" |
| 35 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" | 32 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" |
| 36 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" | 33 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" |
| 37 #include "chrome/browser/ui/select_file_dialog.h" | 34 #include "chrome/browser/ui/select_file_dialog.h" |
| 38 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 35 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| 39 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 36 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 class InstantUnloadHandler; | 60 class InstantUnloadHandler; |
| 64 class PrefService; | 61 class PrefService; |
| 65 class Profile; | 62 class Profile; |
| 66 class SkBitmap; | 63 class SkBitmap; |
| 67 class StatusBubble; | 64 class StatusBubble; |
| 68 class TabNavigation; | 65 class TabNavigation; |
| 69 class TabStripModel; | 66 class TabStripModel; |
| 70 struct WebApplicationInfo; | 67 struct WebApplicationInfo; |
| 71 | 68 |
| 72 namespace chrome { | 69 namespace chrome { |
| 70 class BrowserCommandController; |
| 73 namespace search { | 71 namespace search { |
| 74 class SearchDelegate; | 72 class SearchDelegate; |
| 75 class SearchModel; | 73 class SearchModel; |
| 76 } | 74 } |
| 77 } | 75 } |
| 78 | 76 |
| 79 namespace content { | 77 namespace content { |
| 80 class NavigationController; | 78 class NavigationController; |
| 81 class SessionStorageNamespace; | 79 class SessionStorageNamespace; |
| 82 } | 80 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 101 public TabStripModelObserver, | 99 public TabStripModelObserver, |
| 102 public content::WebContentsDelegate, | 100 public content::WebContentsDelegate, |
| 103 public CoreTabHelperDelegate, | 101 public CoreTabHelperDelegate, |
| 104 public SearchEngineTabHelperDelegate, | 102 public SearchEngineTabHelperDelegate, |
| 105 public ConstrainedWindowTabHelperDelegate, | 103 public ConstrainedWindowTabHelperDelegate, |
| 106 public BlockedContentTabHelperDelegate, | 104 public BlockedContentTabHelperDelegate, |
| 107 public BookmarkTabHelperDelegate, | 105 public BookmarkTabHelperDelegate, |
| 108 public ZoomObserver, | 106 public ZoomObserver, |
| 109 public ExtensionTabHelperDelegate, | 107 public ExtensionTabHelperDelegate, |
| 110 public content::PageNavigator, | 108 public content::PageNavigator, |
| 111 public CommandUpdater::CommandUpdaterDelegate, | |
| 112 public content::NotificationObserver, | 109 public content::NotificationObserver, |
| 113 public SelectFileDialog::Listener, | 110 public SelectFileDialog::Listener, |
| 114 public TabRestoreServiceObserver, | |
| 115 public ProfileSyncServiceObserver, | |
| 116 public InstantDelegate { | 111 public InstantDelegate { |
| 117 public: | 112 public: |
| 118 // SessionService::WindowType mirrors these values. If you add to this | 113 // SessionService::WindowType mirrors these values. If you add to this |
| 119 // enum, look at SessionService::WindowType to see if it needs to be | 114 // enum, look at SessionService::WindowType to see if it needs to be |
| 120 // updated. | 115 // updated. |
| 121 enum Type { | 116 enum Type { |
| 122 // If you add a new type, consider updating the test | 117 // If you add a new type, consider updating the test |
| 123 // BrowserTest.StartMaximized. | 118 // BrowserTest.StartMaximized. |
| 124 TYPE_TABBED = 1, | 119 TYPE_TABBED = 1, |
| 125 TYPE_POPUP = 2, | 120 TYPE_POPUP = 2, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 gfx::Rect override_bounds() const { return override_bounds_; } | 259 gfx::Rect override_bounds() const { return override_bounds_; } |
| 265 | 260 |
| 266 // Returns the InstantController or NULL if there is no InstantController for | 261 // Returns the InstantController or NULL if there is no InstantController for |
| 267 // this Browser. | 262 // this Browser. |
| 268 InstantController* instant() const { return instant_.get(); } | 263 InstantController* instant() const { return instant_.get(); } |
| 269 | 264 |
| 270 // |window()| will return NULL if called before |CreateBrowserWindow()| | 265 // |window()| will return NULL if called before |CreateBrowserWindow()| |
| 271 // is done. | 266 // is done. |
| 272 BrowserWindow* window() const { return window_; } | 267 BrowserWindow* window() const { return window_; } |
| 273 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } | 268 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } |
| 269 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } |
| 270 chrome::BrowserCommandController* command_controller() { |
| 271 return command_controller_.get(); |
| 272 } |
| 274 chrome::search::SearchModel* search_model() { return search_model_.get(); } | 273 chrome::search::SearchModel* search_model() { return search_model_.get(); } |
| 275 const SessionID& session_id() const { return session_id_; } | 274 const SessionID& session_id() const { return session_id_; } |
| 276 CommandUpdater* command_updater() { return &command_updater_; } | |
| 277 bool block_command_execution() const { return block_command_execution_; } | |
| 278 BrowserContentSettingBubbleModelDelegate* | 275 BrowserContentSettingBubbleModelDelegate* |
| 279 content_setting_bubble_model_delegate() { | 276 content_setting_bubble_model_delegate() { |
| 280 return content_setting_bubble_model_delegate_.get(); | 277 return content_setting_bubble_model_delegate_.get(); |
| 281 } | 278 } |
| 282 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { | 279 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { |
| 283 return tab_restore_service_delegate_.get(); | 280 return tab_restore_service_delegate_.get(); |
| 284 } | 281 } |
| 285 BrowserSyncedWindowDelegate* synced_window_delegate() { | 282 BrowserSyncedWindowDelegate* synced_window_delegate() { |
| 286 return synced_window_delegate_.get(); | 283 return synced_window_delegate_.get(); |
| 287 } | 284 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 bool user_gesture); | 491 bool user_gesture); |
| 495 | 492 |
| 496 // Helper function to handle find results. | 493 // Helper function to handle find results. |
| 497 static void FindReplyHelper(content::WebContents* web_contents, | 494 static void FindReplyHelper(content::WebContents* web_contents, |
| 498 int request_id, | 495 int request_id, |
| 499 int number_of_matches, | 496 int number_of_matches, |
| 500 const gfx::Rect& selection_rect, | 497 const gfx::Rect& selection_rect, |
| 501 int active_match_ordinal, | 498 int active_match_ordinal, |
| 502 bool final_update); | 499 bool final_update); |
| 503 | 500 |
| 504 // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. | |
| 505 void ExecuteCommand(int id); | |
| 506 | |
| 507 // Calls ExecuteCommandWithDisposition with the given event flags. | |
| 508 void ExecuteCommand(int id, int event_flags); | |
| 509 | |
| 510 // Executes a command if it's enabled. | |
| 511 // Returns true if the command is executed. | |
| 512 bool ExecuteCommandIfEnabled(int id); | |
| 513 | |
| 514 // Returns true if |command_id| is a reserved command whose keyboard shortcuts | |
| 515 // should not be sent to the renderer or |event| was triggered by a key that | |
| 516 // we never want to send to the renderer. | |
| 517 bool IsReservedCommandOrKey(int command_id, | |
| 518 const content::NativeWebKeyboardEvent& event); | |
| 519 | |
| 520 // Sets if command execution shall be blocked. If |block| is true then | |
| 521 // following calls to ExecuteCommand() or ExecuteCommandWithDisposition() | |
| 522 // method will not execute the command, and the last blocked command will be | |
| 523 // recorded for retrieval. | |
| 524 void SetBlockCommandExecution(bool block); | |
| 525 | |
| 526 // Gets the last blocked command after calling SetBlockCommandExecution(true). | |
| 527 // Returns the command id or -1 if there is no command blocked. The | |
| 528 // disposition type of the command will be stored in |*disposition| if it's | |
| 529 // not null. | |
| 530 int GetLastBlockedCommand(WindowOpenDisposition* disposition); | |
| 531 | |
| 532 // Called by browser::Navigate() when a navigation has occurred in a tab in | 501 // Called by browser::Navigate() when a navigation has occurred in a tab in |
| 533 // this Browser. Updates the UI for the start of this navigation. | 502 // this Browser. Updates the UI for the start of this navigation. |
| 534 void UpdateUIForNavigationInTab(TabContents* contents, | 503 void UpdateUIForNavigationInTab(TabContents* contents, |
| 535 content::PageTransition transition, | 504 content::PageTransition transition, |
| 536 bool user_initiated); | 505 bool user_initiated); |
| 537 | 506 |
| 538 // Interface implementations //////////////////////////////////////////////// | 507 // Interface implementations //////////////////////////////////////////////// |
| 539 | 508 |
| 540 // Overridden from content::PageNavigator: | 509 // Overridden from content::PageNavigator: |
| 541 virtual content::WebContents* OpenURL( | 510 virtual content::WebContents* OpenURL( |
| 542 const content::OpenURLParams& params) OVERRIDE; | 511 const content::OpenURLParams& params) OVERRIDE; |
| 543 | 512 |
| 544 // Overridden from CommandUpdater::CommandUpdaterDelegate: | |
| 545 virtual void ExecuteCommandWithDisposition( | |
| 546 int id, | |
| 547 WindowOpenDisposition disposition) OVERRIDE; | |
| 548 | |
| 549 // Overridden from TabRestoreServiceObserver: | |
| 550 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | |
| 551 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; | |
| 552 | |
| 553 // Centralized method for creating a TabContents, configuring and | 513 // Centralized method for creating a TabContents, configuring and |
| 554 // installing all its supporting objects and observers. | 514 // installing all its supporting objects and observers. |
| 555 static TabContents* TabContentsFactory( | 515 static TabContents* TabContentsFactory( |
| 556 Profile* profile, | 516 Profile* profile, |
| 557 content::SiteInstance* site_instance, | 517 content::SiteInstance* site_instance, |
| 558 int routing_id, | 518 int routing_id, |
| 559 const content::WebContents* base_web_contents, | 519 const content::WebContents* base_web_contents, |
| 560 content::SessionStorageNamespace* session_storage_namespace); | 520 content::SessionStorageNamespace* session_storage_namespace); |
| 561 | 521 |
| 562 // Overridden from TabStripModelDelegate: | 522 // Overridden from TabStripModelDelegate: |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 // Change is the result of the bookmark bar pref changing. | 662 // Change is the result of the bookmark bar pref changing. |
| 703 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE, | 663 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE, |
| 704 | 664 |
| 705 // Change is the result of a state change in the active tab. | 665 // Change is the result of a state change in the active tab. |
| 706 BOOKMARK_BAR_STATE_CHANGE_TAB_STATE, | 666 BOOKMARK_BAR_STATE_CHANGE_TAB_STATE, |
| 707 | 667 |
| 708 // Change is the result of window toggling in/out of fullscreen mode. | 668 // Change is the result of window toggling in/out of fullscreen mode. |
| 709 BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN, | 669 BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN, |
| 710 }; | 670 }; |
| 711 | 671 |
| 712 enum FullScreenMode { | |
| 713 // Not in fullscreen mode. | |
| 714 FULLSCREEN_DISABLED, | |
| 715 | |
| 716 // Fullscreen mode, occupying the whole screen. | |
| 717 FULLSCREEN_NORMAL, | |
| 718 | |
| 719 // Fullscreen mode for metro snap, occupying the full height and 20% of | |
| 720 // the screen width. | |
| 721 FULLSCREEN_METRO_SNAP, | |
| 722 }; | |
| 723 | |
| 724 // Overridden from content::WebContentsDelegate: | 672 // Overridden from content::WebContentsDelegate: |
| 725 virtual content::WebContents* OpenURLFromTab( | 673 virtual content::WebContents* OpenURLFromTab( |
| 726 content::WebContents* source, | 674 content::WebContents* source, |
| 727 const content::OpenURLParams& params) OVERRIDE; | 675 const content::OpenURLParams& params) OVERRIDE; |
| 728 virtual void NavigationStateChanged(const content::WebContents* source, | 676 virtual void NavigationStateChanged(const content::WebContents* source, |
| 729 unsigned changed_flags) OVERRIDE; | 677 unsigned changed_flags) OVERRIDE; |
| 730 virtual void AddNewContents(content::WebContents* source, | 678 virtual void AddNewContents(content::WebContents* source, |
| 731 content::WebContents* new_contents, | 679 content::WebContents* new_contents, |
| 732 WindowOpenDisposition disposition, | 680 WindowOpenDisposition disposition, |
| 733 const gfx::Rect& initial_pos, | 681 const gfx::Rect& initial_pos, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 // Overridden from SelectFileDialog::Listener: | 827 // Overridden from SelectFileDialog::Listener: |
| 880 virtual void FileSelected(const FilePath& path, | 828 virtual void FileSelected(const FilePath& path, |
| 881 int index, | 829 int index, |
| 882 void* params) OVERRIDE; | 830 void* params) OVERRIDE; |
| 883 | 831 |
| 884 // Overridden from content::NotificationObserver: | 832 // Overridden from content::NotificationObserver: |
| 885 virtual void Observe(int type, | 833 virtual void Observe(int type, |
| 886 const content::NotificationSource& source, | 834 const content::NotificationSource& source, |
| 887 const content::NotificationDetails& details) OVERRIDE; | 835 const content::NotificationDetails& details) OVERRIDE; |
| 888 | 836 |
| 889 // Overridden from ProfileSyncServiceObserver: | |
| 890 virtual void OnStateChanged() OVERRIDE; | |
| 891 | |
| 892 // Overriden from InstantDelegate: | 837 // Overriden from InstantDelegate: |
| 893 virtual void ShowInstant(TabContents* preview_contents) OVERRIDE; | 838 virtual void ShowInstant(TabContents* preview_contents) OVERRIDE; |
| 894 virtual void HideInstant() OVERRIDE; | 839 virtual void HideInstant() OVERRIDE; |
| 895 virtual void CommitInstant(TabContents* preview_contents) OVERRIDE; | 840 virtual void CommitInstant(TabContents* preview_contents) OVERRIDE; |
| 896 virtual void SetSuggestedText(const string16& text, | 841 virtual void SetSuggestedText(const string16& text, |
| 897 InstantCompleteBehavior behavior) OVERRIDE; | 842 InstantCompleteBehavior behavior) OVERRIDE; |
| 898 virtual gfx::Rect GetInstantBounds() OVERRIDE; | 843 virtual gfx::Rect GetInstantBounds() OVERRIDE; |
| 899 virtual void InstantPreviewFocused() OVERRIDE; | 844 virtual void InstantPreviewFocused() OVERRIDE; |
| 900 virtual TabContents* GetInstantHostTabContents() const OVERRIDE; | 845 virtual TabContents* GetInstantHostTabContents() const OVERRIDE; |
| 901 | 846 |
| 902 // Command and state updating /////////////////////////////////////////////// | 847 // Command and state updating /////////////////////////////////////////////// |
| 903 | 848 |
| 904 // Returns true if the regular Chrome UI (not the fullscreen one and | |
| 905 // not the single-tab one) is shown. Used for updating window command states | |
| 906 // only. Consider using SupportsWindowFeature if you need the mentioned | |
| 907 // functionality anywhere else. | |
| 908 bool IsShowingMainUI(bool is_fullscreen); | |
| 909 | |
| 910 // Initialize state for all browser commands. | |
| 911 void InitCommandState(); | |
| 912 | |
| 913 // Update commands whose state depends on incognito mode availability. | |
| 914 void UpdateCommandsForIncognitoAvailability(); | |
| 915 | |
| 916 // Update commands whose state depends on the tab's state. | |
| 917 void UpdateCommandsForTabState(); | |
| 918 | |
| 919 // Updates commands when the content's restrictions change. | |
| 920 void UpdateCommandsForContentRestrictionState(); | |
| 921 | |
| 922 // Updates commands for enabling developer tools. | |
| 923 void UpdateCommandsForDevTools(); | |
| 924 | |
| 925 // Updates commands for bookmark editing. | |
| 926 void UpdateCommandsForBookmarkEditing(); | |
| 927 | |
| 928 // Updates commands that affect the bookmark bar. | |
| 929 void UpdateCommandsForBookmarkBar(); | |
| 930 | |
| 931 // Set the preference that indicates that the home page has been changed. | 849 // Set the preference that indicates that the home page has been changed. |
| 932 void MarkHomePageAsChanged(PrefService* pref_service); | 850 void MarkHomePageAsChanged(PrefService* pref_service); |
| 933 | 851 |
| 934 // Update commands whose state depends on the type of fullscreen mode the | |
| 935 // window is in. | |
| 936 void UpdateCommandsForFullscreenMode(FullScreenMode fullscreen_mode); | |
| 937 | |
| 938 // Update commands whose state depends on whether multiple profiles are | |
| 939 // allowed. | |
| 940 void UpdateCommandsForMultipleProfiles(); | |
| 941 | |
| 942 // Updates the printing command state. | |
| 943 void UpdatePrintingState(int content_restrictions); | |
| 944 | |
| 945 // Updates the save-page-as command state. | |
| 946 void UpdateSaveAsState(int content_restrictions); | |
| 947 | |
| 948 // Updates the open-file state (Mac Only). | |
| 949 void UpdateOpenFileState(); | |
| 950 | |
| 951 // Ask the Reload/Stop button to change its icon, and update the Stop command | |
| 952 // state. |is_loading| is true if the current WebContents is loading. | |
| 953 // |force| is true if the button should change its icon immediately. | |
| 954 void UpdateReloadStopState(bool is_loading, bool force); | |
| 955 | |
| 956 // UI update coalescing and handling //////////////////////////////////////// | 852 // UI update coalescing and handling //////////////////////////////////////// |
| 957 | 853 |
| 958 // Asks the toolbar (and as such the location bar) to update its state to | 854 // Asks the toolbar (and as such the location bar) to update its state to |
| 959 // reflect the current tab's current URL, security state, etc. | 855 // reflect the current tab's current URL, security state, etc. |
| 960 // If |should_restore_state| is true, we're switching (back?) to this tab and | 856 // If |should_restore_state| is true, we're switching (back?) to this tab and |
| 961 // should restore any previous location bar state (such as user editing) as | 857 // should restore any previous location bar state (such as user editing) as |
| 962 // well. | 858 // well. |
| 963 void UpdateToolbar(bool should_restore_state); | 859 void UpdateToolbar(bool should_restore_state); |
| 964 | 860 |
| 965 // Updates the browser's search model with the tab's search model. | 861 // Updates the browser's search model with the tab's search model. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If | 963 // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If |
| 1068 // |check_fullscreen| is true, the set of features reflect the actual state of | 964 // |check_fullscreen| is true, the set of features reflect the actual state of |
| 1069 // the browser, otherwise the set of features reflect the possible state of | 965 // the browser, otherwise the set of features reflect the possible state of |
| 1070 // the browser. | 966 // the browser. |
| 1071 bool SupportsWindowFeatureImpl(WindowFeature feature, | 967 bool SupportsWindowFeatureImpl(WindowFeature feature, |
| 1072 bool check_fullscreen) const; | 968 bool check_fullscreen) const; |
| 1073 | 969 |
| 1074 // If this browser should have instant one is created, otherwise does nothing. | 970 // If this browser should have instant one is created, otherwise does nothing. |
| 1075 void CreateInstantIfNecessary(); | 971 void CreateInstantIfNecessary(); |
| 1076 | 972 |
| 1077 // Retrieves the content restrictions for the currently selected tab. | |
| 1078 // Returns 0 if no tab selected, which is equivalent to no content | |
| 1079 // restrictions active. | |
| 1080 int GetContentRestrictionsForSelectedTab(); | |
| 1081 | |
| 1082 // Resets |bookmark_bar_state_| based on the active tab. Notifies the | 973 // Resets |bookmark_bar_state_| based on the active tab. Notifies the |
| 1083 // BrowserWindow if necessary. | 974 // BrowserWindow if necessary. |
| 1084 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); | 975 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); |
| 1085 | 976 |
| 1086 // Creates a BackgroundContents if appropriate; return true if one was | 977 // Creates a BackgroundContents if appropriate; return true if one was |
| 1087 // created. | 978 // created. |
| 1088 bool MaybeCreateBackgroundContents(int route_id, | 979 bool MaybeCreateBackgroundContents(int route_id, |
| 1089 content::WebContents* opener_web_contents, | 980 content::WebContents* opener_web_contents, |
| 1090 const string16& frame_name, | 981 const string16& frame_name, |
| 1091 const GURL& target_url); | 982 const GURL& target_url); |
| 1092 | 983 |
| 1093 // Data members ///////////////////////////////////////////////////////////// | 984 // Data members ///////////////////////////////////////////////////////////// |
| 1094 | 985 |
| 1095 content::NotificationRegistrar registrar_; | 986 content::NotificationRegistrar registrar_; |
| 1096 | 987 |
| 1097 PrefChangeRegistrar profile_pref_registrar_; | 988 PrefChangeRegistrar profile_pref_registrar_; |
| 1098 | 989 |
| 1099 PrefChangeRegistrar local_pref_registrar_; | |
| 1100 | |
| 1101 // This Browser's type. | 990 // This Browser's type. |
| 1102 const Type type_; | 991 const Type type_; |
| 1103 | 992 |
| 1104 // This Browser's profile. | 993 // This Browser's profile. |
| 1105 Profile* const profile_; | 994 Profile* const profile_; |
| 1106 | 995 |
| 1107 // This Browser's window. | 996 // This Browser's window. |
| 1108 BrowserWindow* window_; | 997 BrowserWindow* window_; |
| 1109 | 998 |
| 1110 scoped_ptr<TabStripModel> tab_strip_model_; | 999 scoped_ptr<TabStripModel> tab_strip_model_; |
| 1111 | 1000 |
| 1112 // The CommandUpdater that manages the browser window commands. | |
| 1113 CommandUpdater command_updater_; | |
| 1114 | |
| 1115 // The application name that is also the name of the window to the shell. | 1001 // The application name that is also the name of the window to the shell. |
| 1116 // This name should be set when: | 1002 // This name should be set when: |
| 1117 // 1) we launch an application via an application shortcut or extension API. | 1003 // 1) we launch an application via an application shortcut or extension API. |
| 1118 // 2) we launch an undocked devtool window. | 1004 // 2) we launch an undocked devtool window. |
| 1119 std::string app_name_; | 1005 std::string app_name_; |
| 1120 | 1006 |
| 1121 // Type of app (host or child). See description of AppType. | 1007 // Type of app (host or child). See description of AppType. |
| 1122 AppType app_type_; | 1008 AppType app_type_; |
| 1123 | 1009 |
| 1124 // Unique identifier of this browser for session restore. This id is only | 1010 // Unique identifier of this browser for session restore. This id is only |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 // The Find Bar. This may be NULL if there is no Find Bar, and if it is | 1082 // The Find Bar. This may be NULL if there is no Find Bar, and if it is |
| 1197 // non-NULL, it may or may not be visible. | 1083 // non-NULL, it may or may not be visible. |
| 1198 scoped_ptr<FindBarController> find_bar_controller_; | 1084 scoped_ptr<FindBarController> find_bar_controller_; |
| 1199 | 1085 |
| 1200 // Dialog box used for opening and saving files. | 1086 // Dialog box used for opening and saving files. |
| 1201 scoped_refptr<SelectFileDialog> select_file_dialog_; | 1087 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 1202 | 1088 |
| 1203 // Keep track of the encoding auto detect pref. | 1089 // Keep track of the encoding auto detect pref. |
| 1204 BooleanPrefMember encoding_auto_detect_; | 1090 BooleanPrefMember encoding_auto_detect_; |
| 1205 | 1091 |
| 1206 // Indicates if command execution is blocked. | |
| 1207 bool block_command_execution_; | |
| 1208 | |
| 1209 // Stores the last blocked command id when |block_command_execution_| is true. | |
| 1210 int last_blocked_command_id_; | |
| 1211 | |
| 1212 // Stores the disposition type of the last blocked command. | |
| 1213 WindowOpenDisposition last_blocked_command_disposition_; | |
| 1214 | |
| 1215 // Which deferred action to perform when OnDidGetApplicationInfo is notified | 1092 // Which deferred action to perform when OnDidGetApplicationInfo is notified |
| 1216 // from a WebContents. Currently, only one pending action is allowed. | 1093 // from a WebContents. Currently, only one pending action is allowed. |
| 1217 WebAppAction pending_web_app_action_; | 1094 WebAppAction pending_web_app_action_; |
| 1218 | 1095 |
| 1219 // The profile's tab restore service. The service is owned by the profile, | |
| 1220 // and we install ourselves as an observer. | |
| 1221 TabRestoreService* tab_restore_service_; | |
| 1222 | |
| 1223 // Helper which implements the ContentSettingBubbleModel interface. | 1096 // Helper which implements the ContentSettingBubbleModel interface. |
| 1224 scoped_ptr<BrowserContentSettingBubbleModelDelegate> | 1097 scoped_ptr<BrowserContentSettingBubbleModelDelegate> |
| 1225 content_setting_bubble_model_delegate_; | 1098 content_setting_bubble_model_delegate_; |
| 1226 | 1099 |
| 1227 // Helper which implements the ToolbarModelDelegate interface. | 1100 // Helper which implements the ToolbarModelDelegate interface. |
| 1228 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; | 1101 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; |
| 1229 | 1102 |
| 1230 // A delegate that handles the details of updating the "active" | 1103 // A delegate that handles the details of updating the "active" |
| 1231 // |search_model_| state with the tab's state. | 1104 // |search_model_| state with the tab's state. |
| 1232 scoped_ptr<chrome::search::SearchDelegate> search_delegate_; | 1105 scoped_ptr<chrome::search::SearchDelegate> search_delegate_; |
| 1233 | 1106 |
| 1234 // Helper which implements the TabRestoreServiceDelegate interface. | 1107 // Helper which implements the TabRestoreServiceDelegate interface. |
| 1235 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; | 1108 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; |
| 1236 | 1109 |
| 1237 // Helper which implements the SyncedWindowDelegate interface. | 1110 // Helper which implements the SyncedWindowDelegate interface. |
| 1238 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 1111 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
| 1239 | 1112 |
| 1240 scoped_ptr<InstantController> instant_; | 1113 scoped_ptr<InstantController> instant_; |
| 1241 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1114 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
| 1242 | 1115 |
| 1243 BookmarkBar::State bookmark_bar_state_; | 1116 BookmarkBar::State bookmark_bar_state_; |
| 1244 | 1117 |
| 1245 scoped_refptr<FullscreenController> fullscreen_controller_; | 1118 scoped_refptr<FullscreenController> fullscreen_controller_; |
| 1246 | 1119 |
| 1247 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 1120 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
| 1248 | 1121 |
| 1122 scoped_ptr<chrome::BrowserCommandController> command_controller_; |
| 1123 |
| 1249 // True if the browser window has been shown at least once. | 1124 // True if the browser window has been shown at least once. |
| 1250 bool window_has_shown_; | 1125 bool window_has_shown_; |
| 1251 | 1126 |
| 1252 // Currently open color chooser. Non-NULL after OpenColorChooser is called and | 1127 // Currently open color chooser. Non-NULL after OpenColorChooser is called and |
| 1253 // before DidEndColorChooser is called. | 1128 // before DidEndColorChooser is called. |
| 1254 scoped_ptr<content::ColorChooser> color_chooser_; | 1129 scoped_ptr<content::ColorChooser> color_chooser_; |
| 1255 | 1130 |
| 1256 DISALLOW_COPY_AND_ASSIGN(Browser); | 1131 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 1257 }; | 1132 }; |
| 1258 | 1133 |
| 1259 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1134 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
| OLD | NEW |