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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // would be canceled if the close continued. | 344 // would be canceled if the close continued. |
345 DownloadClosePreventionType OkToCloseWithInProgressDownloads( | 345 DownloadClosePreventionType OkToCloseWithInProgressDownloads( |
346 int* num_downloads_blocking) const; | 346 int* num_downloads_blocking) const; |
347 | 347 |
348 // TabStripModel pass-thrus ///////////////////////////////////////////////// | 348 // TabStripModel pass-thrus ///////////////////////////////////////////////// |
349 | 349 |
350 TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); } | 350 TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); } |
351 | 351 |
352 int tab_count() const; | 352 int tab_count() const; |
353 int active_index() const; | 353 int active_index() const; |
354 int GetIndexOfController( | |
355 const content::NavigationController* controller) const; | |
356 | |
357 TabContents* GetActiveTabContents() const; | |
358 // A convenient version of the above which returns the TabContents's | |
359 // WebContents. | |
360 content::WebContents* GetActiveWebContents() const; | |
361 TabContents* GetTabContentsAt(int index) const; | |
362 // A convenient version of the above which returns the TabContents's | |
363 // WebContents. | |
364 content::WebContents* GetWebContentsAt(int index) const; | |
365 void ActivateTabAt(int index, bool user_gesture); | |
366 bool IsTabPinned(int index) const; | |
367 bool IsTabDiscarded(int index) const; | |
368 void CloseAllTabs(); | |
369 | |
370 // Tab adding/showing functions ///////////////////////////////////////////// | |
371 | |
372 // Returns true if the tab strip is editable (for extensions). | |
373 bool IsTabStripEditable() const; | |
374 | |
375 // Returns the index to insert a tab at during session restore and startup. | |
376 // |relative_index| gives the index of the url into the number of tabs that | |
377 // are going to be opened. For example, if three urls are passed in on the | |
378 // command line this is invoked three times with the values 0, 1 and 2. | |
379 int GetIndexForInsertionDuringRestore(int relative_index); | |
380 | |
381 // Adds a selected tab with the specified URL and transition, returns the | |
382 // created TabContents. | |
383 TabContents* AddSelectedTabWithURL(const GURL& url, | |
384 content::PageTransition transition); | |
385 | |
386 // Add a new tab, given a TabContents. A WebContents appropriate to | |
387 // display the last committed entry is created and returned. | |
388 content::WebContents* AddTab(TabContents* tab_contents, | |
389 content::PageTransition type); | |
390 | |
391 // Add a tab with its session history restored from the SessionRestore | |
392 // system. If select is true, the tab is selected. |tab_index| gives the index | |
393 // to insert the tab at. |selected_navigation| is the index of the | |
394 // TabNavigation in |navigations| to select. If |extension_app_id| is | |
395 // non-empty the tab is an app tab and |extension_app_id| is the id of the | |
396 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then | |
397 // the newly created tab is pinned. If |from_last_session| is true, | |
398 // |navigations| are from the previous session. | |
399 content::WebContents* AddRestoredTab( | |
400 const std::vector<TabNavigation>& navigations, | |
401 int tab_index, | |
402 int selected_navigation, | |
403 const std::string& extension_app_id, | |
404 bool select, | |
405 bool pin, | |
406 bool from_last_session, | |
407 content::SessionStorageNamespace* storage_namespace); | |
408 | |
409 // Creates a new tab with the already-created WebContents 'new_contents'. | |
410 // The window for the added contents will be reparented correctly when this | |
411 // method returns. If |disposition| is NEW_POPUP, |pos| should hold the | |
412 // initial position. | |
413 void AddWebContents(content::WebContents* new_contents, | |
414 WindowOpenDisposition disposition, | |
415 const gfx::Rect& initial_pos, | |
416 bool user_gesture); | |
417 void CloseTabContents(content::WebContents* contents); | |
418 | |
419 // Replaces the state of the currently selected tab with the session | |
420 // history restored from the SessionRestore system. | |
421 void ReplaceRestoredTab( | |
422 const std::vector<TabNavigation>& navigations, | |
423 int selected_navigation, | |
424 bool from_last_session, | |
425 const std::string& extension_app_id, | |
426 content::SessionStorageNamespace* session_storage_namespace); | |
427 | 354 |
428 // Invoked when the fullscreen state of the window changes. | 355 // Invoked when the fullscreen state of the window changes. |
429 // BrowserWindow::EnterFullscreen invokes this after the window has become | 356 // BrowserWindow::EnterFullscreen invokes this after the window has become |
430 // fullscreen. | 357 // fullscreen. |
431 void WindowFullscreenStateChanged(); | 358 void WindowFullscreenStateChanged(); |
432 | 359 |
433 // Assorted browser commands //////////////////////////////////////////////// | 360 // Assorted browser commands //////////////////////////////////////////////// |
434 | 361 |
435 // NOTE: Within each of the following sections, the IDs are ordered roughly by | 362 // NOTE: Within each of the following sections, the IDs are ordered roughly by |
436 // how they appear in the GUI/menus (left to right, top to bottom, etc.). | 363 // how they appear in the GUI/menus (left to right, top to bottom, etc.). |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 void UpdateUIForNavigationInTab(TabContents* contents, | 437 void UpdateUIForNavigationInTab(TabContents* contents, |
511 content::PageTransition transition, | 438 content::PageTransition transition, |
512 bool user_initiated); | 439 bool user_initiated); |
513 | 440 |
514 // Interface implementations //////////////////////////////////////////////// | 441 // Interface implementations //////////////////////////////////////////////// |
515 | 442 |
516 // Overridden from content::PageNavigator: | 443 // Overridden from content::PageNavigator: |
517 virtual content::WebContents* OpenURL( | 444 virtual content::WebContents* OpenURL( |
518 const content::OpenURLParams& params) OVERRIDE; | 445 const content::OpenURLParams& params) OVERRIDE; |
519 | 446 |
520 // Centralized method for creating a TabContents, configuring and | |
521 // installing all its supporting objects and observers. | |
522 static TabContents* TabContentsFactory( | |
523 Profile* profile, | |
524 content::SiteInstance* site_instance, | |
525 int routing_id, | |
526 const content::WebContents* base_web_contents, | |
527 content::SessionStorageNamespace* session_storage_namespace); | |
528 | |
529 // Overridden from TabStripModelDelegate: | 447 // Overridden from TabStripModelDelegate: |
530 virtual TabContents* AddBlankTab(bool foreground) OVERRIDE; | 448 virtual TabContents* AddBlankTab(bool foreground) OVERRIDE; |
531 virtual TabContents* AddBlankTabAt(int index, | 449 virtual TabContents* AddBlankTabAt(int index, |
532 bool foreground) OVERRIDE; | 450 bool foreground) OVERRIDE; |
533 virtual Browser* CreateNewStripWithContents( | 451 virtual Browser* CreateNewStripWithContents( |
534 TabContents* detached_contents, | 452 TabContents* detached_contents, |
535 const gfx::Rect& window_bounds, | 453 const gfx::Rect& window_bounds, |
536 const DockInfo& dock_info, | 454 const DockInfo& dock_info, |
537 bool maximize) OVERRIDE; | 455 bool maximize) OVERRIDE; |
538 virtual int GetDragActions() const OVERRIDE; | 456 virtual int GetDragActions() const OVERRIDE; |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 bool window_has_shown_; | 1048 bool window_has_shown_; |
1131 | 1049 |
1132 // Currently open color chooser. Non-NULL after OpenColorChooser is called and | 1050 // Currently open color chooser. Non-NULL after OpenColorChooser is called and |
1133 // before DidEndColorChooser is called. | 1051 // before DidEndColorChooser is called. |
1134 scoped_ptr<content::ColorChooser> color_chooser_; | 1052 scoped_ptr<content::ColorChooser> color_chooser_; |
1135 | 1053 |
1136 DISALLOW_COPY_AND_ASSIGN(Browser); | 1054 DISALLOW_COPY_AND_ASSIGN(Browser); |
1137 }; | 1055 }; |
1138 | 1056 |
1139 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1057 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |