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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // during First Run. | 646 // during First Run. |
647 static void SetNewHomePagePrefs(PrefService* prefs); | 647 static void SetNewHomePagePrefs(PrefService* prefs); |
648 | 648 |
649 static void RegisterPrefs(PrefService* prefs); | 649 static void RegisterPrefs(PrefService* prefs); |
650 static void RegisterUserPrefs(PrefService* prefs); | 650 static void RegisterUserPrefs(PrefService* prefs); |
651 | 651 |
652 // Helper function to run unload listeners on a WebContents. | 652 // Helper function to run unload listeners on a WebContents. |
653 static bool RunUnloadEventsHelper(content::WebContents* contents); | 653 static bool RunUnloadEventsHelper(content::WebContents* contents); |
654 | 654 |
655 // Helper function to handle JS out of memory notifications | 655 // Helper function to handle JS out of memory notifications |
656 static void JSOutOfMemoryHelper(content::WebContents* tab); | 656 static void JSOutOfMemoryHelper(content::WebContents* web_contents); |
657 | 657 |
658 // Helper function to register a protocol handler. | 658 // Helper function to register a protocol handler. |
659 static void RegisterProtocolHandlerHelper(content::WebContents* tab, | 659 static void RegisterProtocolHandlerHelper(content::WebContents* web_contents, |
660 const std::string& protocol, | 660 const std::string& protocol, |
661 const GURL& url, | 661 const GURL& url, |
662 const string16& title, | 662 const string16& title, |
663 bool user_gesture); | 663 bool user_gesture); |
664 | 664 |
665 // Helper function to register an intent handler. | 665 // Helper function to register an intent handler. |
666 // |data| is the registered handler data. |user_gesture| is true if the call | 666 // |data| is the registered handler data. |user_gesture| is true if the call |
667 // was made in the context of a user gesture. | 667 // was made in the context of a user gesture. |
668 static void RegisterIntentHandlerHelper( | 668 static void RegisterIntentHandlerHelper( |
669 content::WebContents* tab, | 669 content::WebContents* web_contents, |
670 const webkit_glue::WebIntentServiceData& data, | 670 const webkit_glue::WebIntentServiceData& data, |
671 bool user_gesture); | 671 bool user_gesture); |
672 | 672 |
673 // Helper function to handle find results. | 673 // Helper function to handle find results. |
674 static void FindReplyHelper(content::WebContents* tab, | 674 static void FindReplyHelper(content::WebContents* web_contents, |
675 int request_id, | 675 int request_id, |
676 int number_of_matches, | 676 int number_of_matches, |
677 const gfx::Rect& selection_rect, | 677 const gfx::Rect& selection_rect, |
678 int active_match_ordinal, | 678 int active_match_ordinal, |
679 bool final_update); | 679 bool final_update); |
680 | 680 |
681 // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. | 681 // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. |
682 void ExecuteCommand(int id); | 682 void ExecuteCommand(int id); |
683 | 683 |
684 // Calls ExecuteCommandWithDisposition with the given event flags. | 684 // Calls ExecuteCommandWithDisposition with the given event flags. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 virtual void WebContentsCreated(content::WebContents* source_contents, | 953 virtual void WebContentsCreated(content::WebContents* source_contents, |
954 int64 source_frame_id, | 954 int64 source_frame_id, |
955 const GURL& target_url, | 955 const GURL& target_url, |
956 content::WebContents* new_contents) OVERRIDE; | 956 content::WebContents* new_contents) OVERRIDE; |
957 virtual void ContentRestrictionsChanged( | 957 virtual void ContentRestrictionsChanged( |
958 content::WebContents* source) OVERRIDE; | 958 content::WebContents* source) OVERRIDE; |
959 virtual void RendererUnresponsive(content::WebContents* source) OVERRIDE; | 959 virtual void RendererUnresponsive(content::WebContents* source) OVERRIDE; |
960 virtual void RendererResponsive(content::WebContents* source) OVERRIDE; | 960 virtual void RendererResponsive(content::WebContents* source) OVERRIDE; |
961 virtual void WorkerCrashed(content::WebContents* source) OVERRIDE; | 961 virtual void WorkerCrashed(content::WebContents* source) OVERRIDE; |
962 virtual void DidNavigateMainFramePostCommit( | 962 virtual void DidNavigateMainFramePostCommit( |
963 content::WebContents* tab) OVERRIDE; | 963 content::WebContents* web_contents) OVERRIDE; |
964 virtual void DidNavigateToPendingEntry(content::WebContents* tab) OVERRIDE; | 964 virtual void DidNavigateToPendingEntry( |
| 965 content::WebContents* web_contents) OVERRIDE; |
965 virtual content::JavaScriptDialogCreator* | 966 virtual content::JavaScriptDialogCreator* |
966 GetJavaScriptDialogCreator() OVERRIDE; | 967 GetJavaScriptDialogCreator() OVERRIDE; |
967 virtual content::ColorChooser* OpenColorChooser(content::WebContents* tab, | 968 virtual content::ColorChooser* OpenColorChooser( |
968 int color_chooser_id, | 969 content::WebContents* web_contents, |
969 SkColor color) OVERRIDE; | 970 int color_chooser_id, |
| 971 SkColor color) OVERRIDE; |
970 virtual void DidEndColorChooser() OVERRIDE; | 972 virtual void DidEndColorChooser() OVERRIDE; |
971 virtual void RunFileChooser( | 973 virtual void RunFileChooser( |
972 content::WebContents* tab, | 974 content::WebContents* web_contents, |
973 const content::FileChooserParams& params) OVERRIDE; | 975 const content::FileChooserParams& params) OVERRIDE; |
974 virtual void EnumerateDirectory(content::WebContents* tab, int request_id, | 976 virtual void EnumerateDirectory(content::WebContents* web_contents, |
| 977 int request_id, |
975 const FilePath& path) OVERRIDE; | 978 const FilePath& path) OVERRIDE; |
976 virtual void ToggleFullscreenModeForTab(content::WebContents* tab, | 979 virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, |
977 bool enter_fullscreen) OVERRIDE; | 980 bool enter_fullscreen) OVERRIDE; |
978 virtual bool IsFullscreenForTabOrPending( | 981 virtual bool IsFullscreenForTabOrPending( |
979 const content::WebContents* tab) const OVERRIDE; | 982 const content::WebContents* web_contents) const OVERRIDE; |
980 virtual void JSOutOfMemory(content::WebContents* tab) OVERRIDE; | 983 virtual void JSOutOfMemory(content::WebContents* web_contents) OVERRIDE; |
981 virtual void RegisterProtocolHandler(content::WebContents* tab, | 984 virtual void RegisterProtocolHandler(content::WebContents* web_contents, |
982 const std::string& protocol, | 985 const std::string& protocol, |
983 const GURL& url, | 986 const GURL& url, |
984 const string16& title, | 987 const string16& title, |
985 bool user_gesture) OVERRIDE; | 988 bool user_gesture) OVERRIDE; |
986 virtual void RegisterIntentHandler( | 989 virtual void RegisterIntentHandler( |
987 content::WebContents* tab, | 990 content::WebContents* web_contents, |
988 const webkit_glue::WebIntentServiceData& data, | 991 const webkit_glue::WebIntentServiceData& data, |
989 bool user_gesture) OVERRIDE; | 992 bool user_gesture) OVERRIDE; |
990 virtual void WebIntentDispatch( | 993 virtual void WebIntentDispatch( |
991 content::WebContents* tab, | 994 content::WebContents* web_contents, |
992 content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE; | 995 content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE; |
993 virtual void UpdatePreferredSize(content::WebContents* source, | 996 virtual void UpdatePreferredSize(content::WebContents* source, |
994 const gfx::Size& pref_size) OVERRIDE; | 997 const gfx::Size& pref_size) OVERRIDE; |
995 virtual void ResizeDueToAutoResize(content::WebContents* source, | 998 virtual void ResizeDueToAutoResize(content::WebContents* source, |
996 const gfx::Size& new_size) OVERRIDE; | 999 const gfx::Size& new_size) OVERRIDE; |
997 | 1000 |
998 virtual void FindReply(content::WebContents* tab, | 1001 virtual void FindReply(content::WebContents* web_contents, |
999 int request_id, | 1002 int request_id, |
1000 int number_of_matches, | 1003 int number_of_matches, |
1001 const gfx::Rect& selection_rect, | 1004 const gfx::Rect& selection_rect, |
1002 int active_match_ordinal, | 1005 int active_match_ordinal, |
1003 bool final_update) OVERRIDE; | 1006 bool final_update) OVERRIDE; |
1004 | 1007 |
1005 virtual void RequestToLockMouse(content::WebContents* tab, | 1008 virtual void RequestToLockMouse(content::WebContents* web_contents, |
1006 bool user_gesture, | 1009 bool user_gesture, |
1007 bool last_unlocked_by_target) OVERRIDE; | 1010 bool last_unlocked_by_target) OVERRIDE; |
1008 virtual void LostMouseLock() OVERRIDE; | 1011 virtual void LostMouseLock() OVERRIDE; |
1009 | 1012 |
1010 // Overridden from CoreTabHelperDelegate: | 1013 // Overridden from CoreTabHelperDelegate: |
1011 // Note that the caller is responsible for deleting |old_tab_contents|. | 1014 // Note that the caller is responsible for deleting |old_tab_contents|. |
1012 virtual void SwapTabContents(TabContents* old_tab_contents, | 1015 virtual void SwapTabContents(TabContents* old_tab_contents, |
1013 TabContents* new_tab_contents) OVERRIDE; | 1016 TabContents* new_tab_contents) OVERRIDE; |
1014 | 1017 |
1015 // Overridden from SearchEngineTabHelperDelegate: | 1018 // Overridden from SearchEngineTabHelperDelegate: |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 // Processes the next tab that needs it's beforeunload/unload event fired. | 1172 // Processes the next tab that needs it's beforeunload/unload event fired. |
1170 void ProcessPendingTabs(); | 1173 void ProcessPendingTabs(); |
1171 | 1174 |
1172 // Whether we've completed firing all the tabs' beforeunload/unload events. | 1175 // Whether we've completed firing all the tabs' beforeunload/unload events. |
1173 bool HasCompletedUnloadProcessing() const; | 1176 bool HasCompletedUnloadProcessing() const; |
1174 | 1177 |
1175 // Clears all the state associated with processing tabs' beforeunload/unload | 1178 // Clears all the state associated with processing tabs' beforeunload/unload |
1176 // events since the user cancelled closing the window. | 1179 // events since the user cancelled closing the window. |
1177 void CancelWindowClose(); | 1180 void CancelWindowClose(); |
1178 | 1181 |
1179 // Removes |tab| from the passed |set|. | 1182 // Removes |web_contents| from the passed |set|. |
1180 // Returns whether the tab was in the set in the first place. | 1183 // Returns whether the tab was in the set in the first place. |
1181 // TODO(beng): this method needs a better name! | 1184 // TODO(beng): this method needs a better name! |
1182 bool RemoveFromSet(UnloadListenerSet* set, content::WebContents* tab); | 1185 bool RemoveFromSet(UnloadListenerSet* set, |
| 1186 content::WebContents* web_contents); |
1183 | 1187 |
1184 // Cleans up state appropriately when we are trying to close the browser and | 1188 // Cleans up state appropriately when we are trying to close the browser and |
1185 // the tab has finished firing its unload handler. We also use this in the | 1189 // the tab has finished firing its unload handler. We also use this in the |
1186 // cases where a tab crashes or hangs even if the beforeunload/unload haven't | 1190 // cases where a tab crashes or hangs even if the beforeunload/unload haven't |
1187 // successfully fired. If |process_now| is true |ProcessPendingTabs| is | 1191 // successfully fired. If |process_now| is true |ProcessPendingTabs| is |
1188 // invoked immediately, otherwise it is invoked after a delay (PostTask). | 1192 // invoked immediately, otherwise it is invoked after a delay (PostTask). |
1189 // | 1193 // |
1190 // Typically you'll want to pass in true for |process_now|. Passing in true | 1194 // Typically you'll want to pass in true for |process_now|. Passing in true |
1191 // may result in deleting |tab|. If you know that shouldn't happen (because of | 1195 // may result in deleting |tab|. If you know that shouldn't happen (because of |
1192 // the state of the stack), pass in false. | 1196 // the state of the stack), pass in false. |
1193 void ClearUnloadState(content::WebContents* tab, bool process_now); | 1197 void ClearUnloadState(content::WebContents* web_contents, bool process_now); |
1194 | 1198 |
1195 // In-progress download termination handling ///////////////////////////////// | 1199 // In-progress download termination handling ///////////////////////////////// |
1196 | 1200 |
1197 // Called when the window is closing to check if potential in-progress | 1201 // Called when the window is closing to check if potential in-progress |
1198 // downloads should prevent it from closing. | 1202 // downloads should prevent it from closing. |
1199 // Returns true if the window can close, false otherwise. | 1203 // Returns true if the window can close, false otherwise. |
1200 bool CanCloseWithInProgressDownloads(); | 1204 bool CanCloseWithInProgressDownloads(); |
1201 | 1205 |
1202 // Assorted utility functions /////////////////////////////////////////////// | 1206 // Assorted utility functions /////////////////////////////////////////////// |
1203 | 1207 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 bool window_has_shown_; | 1433 bool window_has_shown_; |
1430 | 1434 |
1431 // Currently open color chooser. Non-NULL after OpenColorChooser is called and | 1435 // Currently open color chooser. Non-NULL after OpenColorChooser is called and |
1432 // before DidEndColorChooser is called. | 1436 // before DidEndColorChooser is called. |
1433 scoped_ptr<content::ColorChooser> color_chooser_; | 1437 scoped_ptr<content::ColorChooser> color_chooser_; |
1434 | 1438 |
1435 DISALLOW_COPY_AND_ASSIGN(Browser); | 1439 DISALLOW_COPY_AND_ASSIGN(Browser); |
1436 }; | 1440 }; |
1437 | 1441 |
1438 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1442 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |