Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.h

Issue 459008: Mac: the return of the tab-modal-sheets patch. (Closed)
Patch Set: Merged ToT. Must ... commit ... soon. Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // heap-allocated pointer is owned by the caller. 339 // heap-allocated pointer is owned by the caller.
340 virtual TabContents* Clone(); 340 virtual TabContents* Clone();
341 341
342 // Shows the page info. 342 // Shows the page info.
343 void ShowPageInfo(const GURL& url, 343 void ShowPageInfo(const GURL& url,
344 const NavigationEntry::SSLStatus& ssl, 344 const NavigationEntry::SSLStatus& ssl,
345 bool show_history); 345 bool show_history);
346 346
347 // Window management --------------------------------------------------------- 347 // Window management ---------------------------------------------------------
348 348
349 // Create a new window constrained to this TabContents' clip and visibility.
350 // The window is initialized by using the supplied delegate to obtain basic
351 // window characteristics, and the supplied view for the content. The window
352 // is sized according to the preferred size of the content_view, and centered
353 // within the contents.
354 ConstrainedWindow* CreateConstrainedDialog(
355 ConstrainedWindowDelegate* delegate);
356
357 // Adds a new tab or window with the given already-created contents 349 // Adds a new tab or window with the given already-created contents
358 void AddNewContents(TabContents* new_contents, 350 void AddNewContents(TabContents* new_contents,
359 WindowOpenDisposition disposition, 351 WindowOpenDisposition disposition,
360 const gfx::Rect& initial_pos, 352 const gfx::Rect& initial_pos,
361 bool user_gesture, 353 bool user_gesture,
362 const GURL& creator_url); 354 const GURL& creator_url);
363 355
364 // Closes all constrained windows that represent web popups that have not yet 356 // Closes all constrained windows that represent web popups that have not yet
365 // been activated by the user and are as such auto-positioned in the bottom 357 // been activated by the user and are as such auto-positioned in the bottom
366 // right of the screen. This is a quick way for users to "clean up" a flurry 358 // right of the screen. This is a quick way for users to "clean up" a flurry
367 // of unwanted popups. 359 // of unwanted popups.
368 void CloseAllSuppressedPopups(); 360 void CloseAllSuppressedPopups();
369 361
370 // Execute code in this tab. 362 // Execute code in this tab.
371 void ExecuteCode(int request_id, const std::string& extension_id, 363 void ExecuteCode(int request_id, const std::string& extension_id,
372 bool is_js_code, const std::string& code_string, 364 bool is_js_code, const std::string& code_string,
373 bool all_frames); 365 bool all_frames);
374 366
375 // Called when the blocked popup notification is shown or hidden. 367 // Called when the blocked popup notification is shown or hidden.
376 virtual void PopupNotificationVisibilityChanged(bool visible); 368 virtual void PopupNotificationVisibilityChanged(bool visible);
377 369
378 // Returns the number of constrained windows in this tab. Used by tests. 370 // Create a new window constrained to this TabContents' clip and visibility.
371 // The window is initialized by using the supplied delegate to obtain basic
372 // window characteristics, and the supplied view for the content. On Windows
373 // and Linux, the window is sized according to the preferred size of the
374 // content_view and centered within the contents; on Mac, it is attached as a
375 // panel at the top of the tab contents area.
376 ConstrainedWindow* CreateConstrainedDialog(
377 ConstrainedWindowDelegate* delegate);
378
379 // Determines if a constrained dialog can be created.
380 // TODO(viettrungluu): Can there ever be more than one constrained dialog? (On
381 // Mac and on Linux, no. Possibly yes on Windows.)
382 bool CanCreateConstrainedDialog() { return !constrained_window_count(); }
383
384 // Returns the number of constrained windows in this tab. Used by tests and
385 // internally.
379 size_t constrained_window_count() { return child_windows_.size(); } 386 size_t constrained_window_count() { return child_windows_.size(); }
380 387
388 // Needed below.
389 // TODO(viettrungluu): Make this private.
381 typedef std::vector<ConstrainedWindow*> ConstrainedWindowList; 390 typedef std::vector<ConstrainedWindow*> ConstrainedWindowList;
382 391
383 // Return an iterator for the first constrained window in this tab contents. 392 // Return iterators for the first and past-the-last constrained window in this
393 // tab contents.
394 // TODO(viettrungluu): Remove these or at least make them private. These are
395 // currently only used by (the Objective-C, Mac class) |TabStripController|
396 // (in cocoa/tab_strip_controller.mm). There must be a cleaner way to provide
397 // this functionality. Please resist using these.
384 ConstrainedWindowList::iterator constrained_window_begin() 398 ConstrainedWindowList::iterator constrained_window_begin()
385 { return child_windows_.begin(); } 399 { return child_windows_.begin(); }
386
387 // Return an iterator for the last constrained window in this tab contents.
388 ConstrainedWindowList::iterator constrained_window_end() 400 ConstrainedWindowList::iterator constrained_window_end()
389 { return child_windows_.end(); } 401 { return child_windows_.end(); }
390 402
391 // Views and focus ----------------------------------------------------------- 403 // Views and focus -----------------------------------------------------------
392 // TODO(brettw): Most of these should be removed and the caller should call 404 // TODO(brettw): Most of these should be removed and the caller should call
393 // the view directly. 405 // the view directly.
394 406
395 // Returns the actual window that is focused when this TabContents is shown. 407 // Returns the actual window that is focused when this TabContents is shown.
396 gfx::NativeView GetContentNativeView() const; 408 gfx::NativeView GetContentNativeView() const;
397 409
398 // Returns the NativeView associated with this TabContents. Outside of 410 // Returns the NativeView associated with this TabContents. Outside of
399 // automation in the context of the UI, this is required to be implemented. 411 // automation in the context of the UI, this is required to be implemented.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 void set_blocked_popup_container(BlockedPopupContainer* container) { 719 void set_blocked_popup_container(BlockedPopupContainer* container) {
708 DCHECK(blocked_popups_ == NULL); 720 DCHECK(blocked_popups_ == NULL);
709 blocked_popups_ = container; 721 blocked_popups_ = container;
710 } 722 }
711 723
712 // Called by derived classes to indicate that we're no longer waiting for a 724 // Called by derived classes to indicate that we're no longer waiting for a
713 // response. This won't actually update the throbber, but it will get picked 725 // response. This won't actually update the throbber, but it will get picked
714 // up at the next animation step if the throbber is going. 726 // up at the next animation step if the throbber is going.
715 void SetNotWaitingForResponse() { waiting_for_response_ = false; } 727 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
716 728
717 ConstrainedWindowList child_windows_;
718
719 // Expires InfoBars that need to be expired, according to the state carried 729 // Expires InfoBars that need to be expired, according to the state carried
720 // in |details|, in response to a new NavigationEntry being committed (the 730 // in |details|, in response to a new NavigationEntry being committed (the
721 // user navigated to another page). 731 // user navigated to another page).
722 void ExpireInfoBars( 732 void ExpireInfoBars(
723 const NavigationController::LoadCommittedDetails& details); 733 const NavigationController::LoadCommittedDetails& details);
724 734
725 // Returns the DOMUI for the current state of the tab. This will either be 735 // Returns the DOMUI for the current state of the tab. This will either be
726 // the pending DOMUI, the committed DOMUI, or NULL. 736 // the pending DOMUI, the committed DOMUI, or NULL.
727 DOMUI* GetDOMUIForCurrentState(); 737 DOMUI* GetDOMUIForCurrentState();
728 738
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 795
786 // Helper functions for sending notifications. 796 // Helper functions for sending notifications.
787 void NotifySwapped(); 797 void NotifySwapped();
788 void NotifyConnected(); 798 void NotifyConnected();
789 void NotifyDisconnected(); 799 void NotifyDisconnected();
790 800
791 // If params has a searchable form, this tries to create a new keyword. 801 // If params has a searchable form, this tries to create a new keyword.
792 void GenerateKeywordIfNecessary( 802 void GenerateKeywordIfNecessary(
793 const ViewHostMsg_FrameNavigate_Params& params); 803 const ViewHostMsg_FrameNavigate_Params& params);
794 804
805 // Used to notify child constrained windows that something will take place
806 // (e.g., navigation).
807 void NotifyChildrenOfPendingEvent(ConstrainedWindow::Event event);
808
795 // RenderViewHostDelegate ---------------------------------------------------- 809 // RenderViewHostDelegate ----------------------------------------------------
796 810
797 // RenderViewHostDelegate::BrowserIntegration implementation. 811 // RenderViewHostDelegate::BrowserIntegration implementation.
798 virtual void OnUserGesture(); 812 virtual void OnUserGesture();
799 virtual void OnFindReply(int request_id, 813 virtual void OnFindReply(int request_id,
800 int number_of_matches, 814 int number_of_matches,
801 const gfx::Rect& selection_rect, 815 const gfx::Rect& selection_rect,
802 int active_match_ordinal, 816 int active_match_ordinal,
803 bool final_update); 817 bool final_update);
804 virtual void GoToEntryAtOffset(int offset); 818 virtual void GoToEntryAtOffset(int offset);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1083
1070 // Data for shelves and stuff ------------------------------------------------ 1084 // Data for shelves and stuff ------------------------------------------------
1071 1085
1072 // ConstrainedWindow with additional methods for managing blocked 1086 // ConstrainedWindow with additional methods for managing blocked
1073 // popups. 1087 // popups.
1074 BlockedPopupContainer* blocked_popups_; 1088 BlockedPopupContainer* blocked_popups_;
1075 1089
1076 // Delegates for InfoBars associated with this TabContents. 1090 // Delegates for InfoBars associated with this TabContents.
1077 std::vector<InfoBarDelegate*> infobar_delegates_; 1091 std::vector<InfoBarDelegate*> infobar_delegates_;
1078 1092
1093 // Data for constrained windows ----------------------------------------------
1094
1095 // List of constrained windows. Note: Currently, Mac and Linux only support a
1096 // single constrained child window; conceivably, this could change in the
1097 // future.
1098 ConstrainedWindowList child_windows_;
1099
1079 // Data for find in page ----------------------------------------------------- 1100 // Data for find in page -----------------------------------------------------
1080 1101
1081 // TODO(brettw) this should be separated into a helper class. 1102 // TODO(brettw) this should be separated into a helper class.
1082 1103
1083 // Each time a search request comes in we assign it an id before passing it 1104 // Each time a search request comes in we assign it an id before passing it
1084 // over the IPC so that when the results come in we can evaluate whether we 1105 // over the IPC so that when the results come in we can evaluate whether we
1085 // still care about the results of the search (in some cases we don't because 1106 // still care about the results of the search (in some cases we don't because
1086 // the user has issued a new search). 1107 // the user has issued a new search).
1087 static int find_request_id_counter_; 1108 static int find_request_id_counter_;
1088 1109
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1200
1180 // Used to retrieve the language of the current page. 1201 // Used to retrieve the language of the current page.
1181 scoped_refptr<CLDHelper> cld_helper_; 1202 scoped_refptr<CLDHelper> cld_helper_;
1182 1203
1183 // --------------------------------------------------------------------------- 1204 // ---------------------------------------------------------------------------
1184 1205
1185 DISALLOW_COPY_AND_ASSIGN(TabContents); 1206 DISALLOW_COPY_AND_ASSIGN(TabContents);
1186 }; 1207 };
1187 1208
1188 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 1209 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/constrained_window.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698