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

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

Issue 4767001: Make TabContents own its infobar delegates.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // Returns true if the location bar should be focused by default rather than 450 // Returns true if the location bar should be focused by default rather than
451 // the page contents. The view calls this function when the tab is focused 451 // the page contents. The view calls this function when the tab is focused
452 // to see what it should do. 452 // to see what it should do.
453 virtual bool FocusLocationBarByDefault(); 453 virtual bool FocusLocationBarByDefault();
454 454
455 // Focuses the location bar. 455 // Focuses the location bar.
456 virtual void SetFocusToLocationBar(bool select_all); 456 virtual void SetFocusToLocationBar(bool select_all);
457 457
458 // Infobars ------------------------------------------------------------------ 458 // Infobars ------------------------------------------------------------------
459 459
460 // Adds an InfoBar for the specified |delegate|. 460 // Adds an InfoBar for the specified |delegate|. The TabContents takes
461 // ownership of |delegate| and will close it when it is removed or the tab is
462 // closed. If infobars are disabled for this tab or the tab already has a
463 // delegate which returns true for InfoBarDelegate::EqualsDelegate(delegate),
464 // |delegate| is closed immediately without being added.
461 virtual void AddInfoBar(InfoBarDelegate* delegate); 465 virtual void AddInfoBar(InfoBarDelegate* delegate);
462 466
463 // Removes the InfoBar for the specified |delegate|. 467 // Removes the InfoBar for the specified |delegate|. This will synchronously
468 // trigger delegate->InfoBarClosed() (which generally deletes the delegate).
469 // If infobars are disabled for this tab, this will do nothing, on the
470 // assumption that the matching AddInfoBar() call will have already closed the
471 // delegate (see above).
464 void RemoveInfoBar(InfoBarDelegate* delegate); 472 void RemoveInfoBar(InfoBarDelegate* delegate);
465 473
466 // Replaces one infobar with another, without any animation in between. 474 // Replaces one infobar with another, without any animation in between. This
475 // will synchronously close |old_delegate|. If infobars are disabled for this
476 // tab, |new_delegate| is closed immediately without being added.
477 // NOTE: This does not perform any EqualsDelegate() checks like AddInfoBar().
467 void ReplaceInfoBar(InfoBarDelegate* old_delegate, 478 void ReplaceInfoBar(InfoBarDelegate* old_delegate,
468 InfoBarDelegate* new_delegate); 479 InfoBarDelegate* new_delegate);
469 480
470 // Enumeration and access functions. 481 // Enumeration and access functions.
471 int infobar_delegate_count() const { return infobar_delegates_.size(); } 482 int infobar_delegate_count() const { return infobar_delegates_.size(); }
472 InfoBarDelegate* GetInfoBarDelegateAt(int index) { 483 InfoBarDelegate* GetInfoBarDelegateAt(int index) {
473 return infobar_delegates_.at(index); 484 return infobar_delegates_[index];
474 } 485 }
475 486
476 // Toolbars and such --------------------------------------------------------- 487 // Toolbars and such ---------------------------------------------------------
477 488
478 // Returns true if a Bookmark Bar should be shown for this tab. 489 // Returns true if a Bookmark Bar should be shown for this tab.
479 virtual bool ShouldShowBookmarkBar(); 490 virtual bool ShouldShowBookmarkBar();
480 491
481 // Notifies the delegate that a download is about to be started. 492 // Notifies the delegate that a download is about to be started.
482 // This notification is fired before a local temporary file has been created. 493 // This notification is fired before a local temporary file has been created.
483 bool CanDownload(int request_id); 494 bool CanDownload(int request_id);
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 1195
1185 // TODO(pkasting): Hack to try and fix Linux browser tests. 1196 // TODO(pkasting): Hack to try and fix Linux browser tests.
1186 bool dont_notify_render_view_; 1197 bool dont_notify_render_view_;
1187 1198
1188 // True if this is a secure page which displayed insecure content. 1199 // True if this is a secure page which displayed insecure content.
1189 bool displayed_insecure_content_; 1200 bool displayed_insecure_content_;
1190 1201
1191 // Data for shelves and stuff ------------------------------------------------ 1202 // Data for shelves and stuff ------------------------------------------------
1192 1203
1193 // Delegates for InfoBars associated with this TabContents. 1204 // Delegates for InfoBars associated with this TabContents.
1194 std::vector<InfoBarDelegate*> infobar_delegates_; 1205 typedef std::vector<InfoBarDelegate*> InfoBarDelegates;
1206 InfoBarDelegates infobar_delegates_;
1195 1207
1196 // Data for find in page ----------------------------------------------------- 1208 // Data for find in page -----------------------------------------------------
1197 1209
1198 // TODO(brettw) this should be separated into a helper class. 1210 // TODO(brettw) this should be separated into a helper class.
1199 1211
1200 // Each time a search request comes in we assign it an id before passing it 1212 // Each time a search request comes in we assign it an id before passing it
1201 // over the IPC so that when the results come in we can evaluate whether we 1213 // over the IPC so that when the results come in we can evaluate whether we
1202 // still care about the results of the search (in some cases we don't because 1214 // still care about the results of the search (in some cases we don't because
1203 // the user has issued a new search). 1215 // the user has issued a new search).
1204 static int find_request_id_counter_; 1216 static int find_request_id_counter_;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 // Content restrictions, used to disable print/copy etc based on content's 1327 // Content restrictions, used to disable print/copy etc based on content's
1316 // (full-page plugins for now only) permissions. 1328 // (full-page plugins for now only) permissions.
1317 int content_restrictions_; 1329 int content_restrictions_;
1318 1330
1319 // --------------------------------------------------------------------------- 1331 // ---------------------------------------------------------------------------
1320 1332
1321 DISALLOW_COPY_AND_ASSIGN(TabContents); 1333 DISALLOW_COPY_AND_ASSIGN(TabContents);
1322 }; 1334 };
1323 1335
1324 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 1336 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698