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