| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // Tell Gears to create a shortcut for the current page. | 341 // Tell Gears to create a shortcut for the current page. |
| 342 void CreateShortcut(); | 342 void CreateShortcut(); |
| 343 | 343 |
| 344 // Shows the page info. | 344 // Shows the page info. |
| 345 void ShowPageInfo(const GURL& url, | 345 void ShowPageInfo(const GURL& url, |
| 346 const NavigationEntry::SSLStatus& ssl, | 346 const NavigationEntry::SSLStatus& ssl, |
| 347 bool show_history); | 347 bool show_history); |
| 348 | 348 |
| 349 // Window management --------------------------------------------------------- | 349 // Window management --------------------------------------------------------- |
| 350 | 350 |
| 351 // Create a new window constrained to this TabContents' clip and visibility. | |
| 352 // The window is initialized by using the supplied delegate to obtain basic | |
| 353 // window characteristics, and the supplied view for the content. The window | |
| 354 // is sized according to the preferred size of the content_view, and centered | |
| 355 // within the contents. | |
| 356 ConstrainedWindow* CreateConstrainedDialog( | |
| 357 ConstrainedWindowDelegate* delegate); | |
| 358 | |
| 359 // Adds a new tab or window with the given already-created contents | 351 // Adds a new tab or window with the given already-created contents |
| 360 void AddNewContents(TabContents* new_contents, | 352 void AddNewContents(TabContents* new_contents, |
| 361 WindowOpenDisposition disposition, | 353 WindowOpenDisposition disposition, |
| 362 const gfx::Rect& initial_pos, | 354 const gfx::Rect& initial_pos, |
| 363 bool user_gesture, | 355 bool user_gesture, |
| 364 const GURL& creator_url); | 356 const GURL& creator_url); |
| 365 | 357 |
| 366 // Closes all constrained windows that represent web popups that have not yet | 358 // Closes all constrained windows that represent web popups that have not yet |
| 367 // been activated by the user and are as such auto-positioned in the bottom | 359 // been activated by the user and are as such auto-positioned in the bottom |
| 368 // right of the screen. This is a quick way for users to "clean up" a flurry | 360 // right of the screen. This is a quick way for users to "clean up" a flurry |
| 369 // of unwanted popups. | 361 // of unwanted popups. |
| 370 void CloseAllSuppressedPopups(); | 362 void CloseAllSuppressedPopups(); |
| 371 | 363 |
| 372 // Execute code in this tab. | 364 // Execute code in this tab. |
| 373 void ExecuteCode(int request_id, const std::string& extension_id, | 365 void ExecuteCode(int request_id, const std::string& extension_id, |
| 374 bool is_js_code, const std::string& code_string); | 366 bool is_js_code, const std::string& code_string); |
| 375 | 367 |
| 376 // Called when the blocked popup notification is shown or hidden. | 368 // Called when the blocked popup notification is shown or hidden. |
| 377 virtual void PopupNotificationVisibilityChanged(bool visible); | 369 virtual void PopupNotificationVisibilityChanged(bool visible); |
| 378 | 370 |
| 379 // Returns the number of constrained windows in this tab. Used by tests. | 371 // Create a new window constrained to this TabContents' clip and visibility. |
| 372 // The window is initialized by using the supplied delegate to obtain basic |
| 373 // window characteristics, and the supplied view for the content. On Windows |
| 374 // and Linux, the window is sized according to the preferred size of the |
| 375 // content_view and centered within the contents; on Mac, it is attached as a |
| 376 // panel at the top of the tab contents area. |
| 377 ConstrainedWindow* CreateConstrainedDialog( |
| 378 ConstrainedWindowDelegate* delegate); |
| 379 |
| 380 // Determines if a constrained dialog can be created. |
| 381 // FIXME(viettrungluu@gmail.com): Can there ever be more than one constrained |
| 382 // dialog? (On Mac and on Linux, no. Possibly yes on Windows.) |
| 383 bool CanCreateConstrainedDialog() { return !child_windows_.size(); } |
| 384 |
| 385 // Gets the current modality level (maximum level of all constrained children; |
| 386 // |kModalityNone| if no children). |
| 387 ConstrainedWindow::ModalityLevel GetTabModalityLevel(); |
| 388 |
| 389 // Returns the number of constrained windows in this tab. Used by tests. |
| 380 size_t constrained_window_count() { return child_windows_.size(); } | 390 size_t constrained_window_count() { return child_windows_.size(); } |
| 381 | 391 |
| 392 // Needed below. TODO(viettrungluu@gmail.com): Make this private. |
| 382 typedef std::vector<ConstrainedWindow*> ConstrainedWindowList; | 393 typedef std::vector<ConstrainedWindow*> ConstrainedWindowList; |
| 383 | 394 |
| 384 // Return an iterator for the first constrained window in this tab contents. | 395 // Return iterators for the first and past-the-last constrained window in this |
| 396 // tab contents. |
| 397 // TODO(viettrungluu@gmail.com): Remove these or at least make them private. |
| 398 // These are currently only used by (the Objective-C, Mac class) |
| 399 // |TabStripController| (in cocoa/tab_strip_controller.mm). There must be a |
| 400 // cleaner way to provide this functionality. Please resist using these. |
| 385 ConstrainedWindowList::iterator constrained_window_begin() | 401 ConstrainedWindowList::iterator constrained_window_begin() |
| 386 { return child_windows_.begin(); } | 402 { return child_windows_.begin(); } |
| 387 | |
| 388 // Return an iterator for the last constrained window in this tab contents. | |
| 389 ConstrainedWindowList::iterator constrained_window_end() | 403 ConstrainedWindowList::iterator constrained_window_end() |
| 390 { return child_windows_.end(); } | 404 { return child_windows_.end(); } |
| 391 | 405 |
| 392 // Views and focus ----------------------------------------------------------- | 406 // Views and focus ----------------------------------------------------------- |
| 393 // TODO(brettw): Most of these should be removed and the caller should call | 407 // TODO(brettw): Most of these should be removed and the caller should call |
| 394 // the view directly. | 408 // the view directly. |
| 395 | 409 |
| 396 // Returns the actual window that is focused when this TabContents is shown. | 410 // Returns the actual window that is focused when this TabContents is shown. |
| 397 gfx::NativeView GetContentNativeView() const; | 411 gfx::NativeView GetContentNativeView() const; |
| 398 | 412 |
| 399 // Returns the NativeView associated with this TabContents. Outside of | 413 // Returns the NativeView associated with this TabContents. Outside of |
| 400 // automation in the context of the UI, this is required to be implemented. | 414 // automation in the context of the UI, this is required to be implemented. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 void set_blocked_popup_container(BlockedPopupContainer* container) { | 709 void set_blocked_popup_container(BlockedPopupContainer* container) { |
| 696 DCHECK(blocked_popups_ == NULL); | 710 DCHECK(blocked_popups_ == NULL); |
| 697 blocked_popups_ = container; | 711 blocked_popups_ = container; |
| 698 } | 712 } |
| 699 | 713 |
| 700 // Called by derived classes to indicate that we're no longer waiting for a | 714 // Called by derived classes to indicate that we're no longer waiting for a |
| 701 // response. This won't actually update the throbber, but it will get picked | 715 // response. This won't actually update the throbber, but it will get picked |
| 702 // up at the next animation step if the throbber is going. | 716 // up at the next animation step if the throbber is going. |
| 703 void SetNotWaitingForResponse() { waiting_for_response_ = false; } | 717 void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 704 | 718 |
| 705 ConstrainedWindowList child_windows_; | |
| 706 | |
| 707 // Expires InfoBars that need to be expired, according to the state carried | 719 // Expires InfoBars that need to be expired, according to the state carried |
| 708 // in |details|, in response to a new NavigationEntry being committed (the | 720 // in |details|, in response to a new NavigationEntry being committed (the |
| 709 // user navigated to another page). | 721 // user navigated to another page). |
| 710 void ExpireInfoBars( | 722 void ExpireInfoBars( |
| 711 const NavigationController::LoadCommittedDetails& details); | 723 const NavigationController::LoadCommittedDetails& details); |
| 712 | 724 |
| 713 // Called when the user dismisses the shortcut creation dialog. 'success' is | 725 // Called when the user dismisses the shortcut creation dialog. 'success' is |
| 714 // true if the shortcut was created. | 726 // true if the shortcut was created. |
| 715 void OnGearsCreateShortcutDone(const GearsShortcutData2& shortcut_data, | 727 void OnGearsCreateShortcutDone(const GearsShortcutData2& shortcut_data, |
| 716 bool success); | 728 bool success); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 | 791 |
| 780 // Helper functions for sending notifications. | 792 // Helper functions for sending notifications. |
| 781 void NotifySwapped(); | 793 void NotifySwapped(); |
| 782 void NotifyConnected(); | 794 void NotifyConnected(); |
| 783 void NotifyDisconnected(); | 795 void NotifyDisconnected(); |
| 784 | 796 |
| 785 // If params has a searchable form, this tries to create a new keyword. | 797 // If params has a searchable form, this tries to create a new keyword. |
| 786 void GenerateKeywordIfNecessary( | 798 void GenerateKeywordIfNecessary( |
| 787 const ViewHostMsg_FrameNavigate_Params& params); | 799 const ViewHostMsg_FrameNavigate_Params& params); |
| 788 | 800 |
| 801 // Used to notify child constrained windows that something will take place |
| 802 // (e.g., navigation). |
| 803 void NotifyChildrenOfPendingEvent(ConstrainedWindow::Event event); |
| 804 |
| 789 // RenderViewHostDelegate ---------------------------------------------------- | 805 // RenderViewHostDelegate ---------------------------------------------------- |
| 790 | 806 |
| 791 // RenderViewHostDelegate::BrowserIntegration implementation. | 807 // RenderViewHostDelegate::BrowserIntegration implementation. |
| 792 virtual void OnUserGesture(); | 808 virtual void OnUserGesture(); |
| 793 virtual void OnFindReply(int request_id, | 809 virtual void OnFindReply(int request_id, |
| 794 int number_of_matches, | 810 int number_of_matches, |
| 795 const gfx::Rect& selection_rect, | 811 const gfx::Rect& selection_rect, |
| 796 int active_match_ordinal, | 812 int active_match_ordinal, |
| 797 bool final_update); | 813 bool final_update); |
| 798 virtual void GoToEntryAtOffset(int offset); | 814 virtual void GoToEntryAtOffset(int offset); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1076 |
| 1061 // Data for shelves and stuff ------------------------------------------------ | 1077 // Data for shelves and stuff ------------------------------------------------ |
| 1062 | 1078 |
| 1063 // ConstrainedWindow with additional methods for managing blocked | 1079 // ConstrainedWindow with additional methods for managing blocked |
| 1064 // popups. | 1080 // popups. |
| 1065 BlockedPopupContainer* blocked_popups_; | 1081 BlockedPopupContainer* blocked_popups_; |
| 1066 | 1082 |
| 1067 // Delegates for InfoBars associated with this TabContents. | 1083 // Delegates for InfoBars associated with this TabContents. |
| 1068 std::vector<InfoBarDelegate*> infobar_delegates_; | 1084 std::vector<InfoBarDelegate*> infobar_delegates_; |
| 1069 | 1085 |
| 1086 // Data for constrained windows ---------------------------------------------- |
| 1087 |
| 1088 // List of constrained windows. Note: Currently, Mac and Linux only support a |
| 1089 // single constrained child window; conceivably, this could change in the |
| 1090 // future. |
| 1091 ConstrainedWindowList child_windows_; |
| 1092 |
| 1093 // Number of child windows requesting tab-modality; should probably never |
| 1094 // exceed 1. |
| 1095 unsigned tab_modal_count_; |
| 1096 |
| 1070 // Data for find in page ----------------------------------------------------- | 1097 // Data for find in page ----------------------------------------------------- |
| 1071 | 1098 |
| 1072 // TODO(brettw) this should be separated into a helper class. | 1099 // TODO(brettw) this should be separated into a helper class. |
| 1073 | 1100 |
| 1074 // Each time a search request comes in we assign it an id before passing it | 1101 // Each time a search request comes in we assign it an id before passing it |
| 1075 // over the IPC so that when the results come in we can evaluate whether we | 1102 // over the IPC so that when the results come in we can evaluate whether we |
| 1076 // still care about the results of the search (in some cases we don't because | 1103 // still care about the results of the search (in some cases we don't because |
| 1077 // the user has issued a new search). | 1104 // the user has issued a new search). |
| 1078 static int find_request_id_counter_; | 1105 static int find_request_id_counter_; |
| 1079 | 1106 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1186 |
| 1160 // The time that we started to create the new tab page. | 1187 // The time that we started to create the new tab page. |
| 1161 base::TimeTicks new_tab_start_time_; | 1188 base::TimeTicks new_tab_start_time_; |
| 1162 | 1189 |
| 1163 // --------------------------------------------------------------------------- | 1190 // --------------------------------------------------------------------------- |
| 1164 | 1191 |
| 1165 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1192 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 1166 }; | 1193 }; |
| 1167 | 1194 |
| 1168 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1195 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |