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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 4694008: Make pink's TabContentsWrapper change compile on Windows.... (Closed) Base URL: svn://svn.chromium.org/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 #include "chrome/browser/views/frame/browser_view.h" 5 #include "chrome/browser/views/frame/browser_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/ntp_background_util.h" 30 #include "chrome/browser/ntp_background_util.h"
31 #include "chrome/browser/page_info_window.h" 31 #include "chrome/browser/page_info_window.h"
32 #include "chrome/browser/prefs/pref_service.h" 32 #include "chrome/browser/prefs/pref_service.h"
33 #include "chrome/browser/profile.h" 33 #include "chrome/browser/profile.h"
34 #include "chrome/browser/renderer_host/render_widget_host_view.h" 34 #include "chrome/browser/renderer_host/render_widget_host_view.h"
35 #include "chrome/browser/sessions/tab_restore_service.h" 35 #include "chrome/browser/sessions/tab_restore_service.h"
36 #include "chrome/browser/sidebar/sidebar_container.h" 36 #include "chrome/browser/sidebar/sidebar_container.h"
37 #include "chrome/browser/sidebar/sidebar_manager.h" 37 #include "chrome/browser/sidebar/sidebar_manager.h"
38 #include "chrome/browser/tab_contents/tab_contents.h" 38 #include "chrome/browser/tab_contents/tab_contents.h"
39 #include "chrome/browser/tab_contents/tab_contents_view.h" 39 #include "chrome/browser/tab_contents/tab_contents_view.h"
40 #include "chrome/browser/tab_contents_wrapper.h"
40 #include "chrome/browser/tabs/tab_strip_model.h" 41 #include "chrome/browser/tabs/tab_strip_model.h"
41 #include "chrome/browser/themes/browser_theme_provider.h" 42 #include "chrome/browser/themes/browser_theme_provider.h"
42 #include "chrome/browser/ui/browser.h" 43 #include "chrome/browser/ui/browser.h"
43 #include "chrome/browser/view_ids.h" 44 #include "chrome/browser/view_ids.h"
44 #include "chrome/browser/views/accessible_view_helper.h" 45 #include "chrome/browser/views/accessible_view_helper.h"
45 #include "chrome/browser/views/bookmark_bar_view.h" 46 #include "chrome/browser/views/bookmark_bar_view.h"
46 #include "chrome/browser/views/browser_dialogs.h" 47 #include "chrome/browser/views/browser_dialogs.h"
47 #include "chrome/browser/views/default_search_view.h" 48 #include "chrome/browser/views/default_search_view.h"
48 #include "chrome/browser/views/download_shelf_view.h" 49 #include "chrome/browser/views/download_shelf_view.h"
49 #include "chrome/browser/views/frame/browser_view_layout.h" 50 #include "chrome/browser/views/frame/browser_view_layout.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 664
664 void BrowserView::ActivationChanged(bool activated) { 665 void BrowserView::ActivationChanged(bool activated) {
665 if (activated) 666 if (activated)
666 BrowserList::SetLastActive(browser_.get()); 667 BrowserList::SetLastActive(browser_.get());
667 } 668 }
668 669
669 TabContents* BrowserView::GetSelectedTabContents() const { 670 TabContents* BrowserView::GetSelectedTabContents() const {
670 return browser_->GetSelectedTabContents(); 671 return browser_->GetSelectedTabContents();
671 } 672 }
672 673
674 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const {
675 return browser_->GetSelectedTabContentsWrapper();
676 }
677
673 SkBitmap BrowserView::GetOTRAvatarIcon() { 678 SkBitmap BrowserView::GetOTRAvatarIcon() {
674 static SkBitmap* otr_avatar_ = new SkBitmap(); 679 static SkBitmap* otr_avatar_ = new SkBitmap();
675 680
676 if (otr_avatar_->isNull()) { 681 if (otr_avatar_->isNull()) {
677 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 682 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
678 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); 683 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON);
679 } 684 }
680 return *otr_avatar_; 685 return *otr_avatar_;
681 } 686 }
682 687
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 return this; 772 return this;
768 } 773 }
769 774
770 StatusBubble* BrowserView::GetStatusBubble() { 775 StatusBubble* BrowserView::GetStatusBubble() {
771 return status_bubble_.get(); 776 return status_bubble_.get();
772 } 777 }
773 778
774 void BrowserView::SelectedTabToolbarSizeChanged(bool is_animating) { 779 void BrowserView::SelectedTabToolbarSizeChanged(bool is_animating) {
775 if (is_animating) { 780 if (is_animating) {
776 contents_container_->SetFastResize(true); 781 contents_container_->SetFastResize(true);
777 UpdateUIForContents(browser_->GetSelectedTabContents()); 782 UpdateUIForContents(browser_->GetSelectedTabContentsWrapper());
778 contents_container_->SetFastResize(false); 783 contents_container_->SetFastResize(false);
779 } else { 784 } else {
780 UpdateUIForContents(browser_->GetSelectedTabContents()); 785 UpdateUIForContents(browser_->GetSelectedTabContentsWrapper());
781 // When transitioning from animating to not animating we need to make sure 786 // When transitioning from animating to not animating we need to make sure
782 // the contents_container_ gets layed out. If we don't do this and the 787 // the contents_container_ gets layed out. If we don't do this and the
783 // bounds haven't changed contents_container_ won't get a Layout out and 788 // bounds haven't changed contents_container_ won't get a Layout out and
784 // we'll end up with a gray rect because the clip wasn't updated. 789 // we'll end up with a gray rect because the clip wasn't updated.
785 contents_container_->InvalidateLayout(); 790 contents_container_->InvalidateLayout();
786 contents_split_->Layout(); 791 contents_split_->Layout();
787 } 792 }
788 } 793 }
789 794
790 void BrowserView::UpdateTitleBar() { 795 void BrowserView::UpdateTitleBar() {
791 frame_->GetWindow()->UpdateWindowTitle(); 796 frame_->GetWindow()->UpdateWindowTitle();
792 if (ShouldShowWindowIcon() && !loading_animation_timer_.IsRunning()) 797 if (ShouldShowWindowIcon() && !loading_animation_timer_.IsRunning())
793 frame_->GetWindow()->UpdateWindowIcon(); 798 frame_->GetWindow()->UpdateWindowIcon();
794 } 799 }
795 800
796 void BrowserView::ShelfVisibilityChanged() { 801 void BrowserView::ShelfVisibilityChanged() {
797 Layout(); 802 Layout();
798 } 803 }
799 804
800 void BrowserView::UpdateDevTools() { 805 void BrowserView::UpdateDevTools() {
801 UpdateDevToolsForContents(GetSelectedTabContents()); 806 UpdateDevToolsForContents(GetSelectedTabContentsWrapper());
802 Layout(); 807 Layout();
803 } 808 }
804 809
805 void BrowserView::UpdateLoadingAnimations(bool should_animate) { 810 void BrowserView::UpdateLoadingAnimations(bool should_animate) {
806 if (should_animate) { 811 if (should_animate) {
807 if (!loading_animation_timer_.IsRunning()) { 812 if (!loading_animation_timer_.IsRunning()) {
808 // Loads are happening, and the timer isn't running, so start it. 813 // Loads are happening, and the timer isn't running, so start it.
809 loading_animation_timer_.Start( 814 loading_animation_timer_.Start(
810 TimeDelta::FromMilliseconds(kLoadingAnimationFrameTimeMs), this, 815 TimeDelta::FromMilliseconds(kLoadingAnimationFrameTimeMs), this,
811 &BrowserView::LoadingAnimationCallback); 816 &BrowserView::LoadingAnimationCallback);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 DCHECK(focus_manager); 883 DCHECK(focus_manager);
879 focus_manager->ClearFocus(); 884 focus_manager->ClearFocus();
880 } 885 }
881 } 886 }
882 887
883 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { 888 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) {
884 toolbar_->reload_button()->ChangeMode( 889 toolbar_->reload_button()->ChangeMode(
885 is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD, force); 890 is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD, force);
886 } 891 }
887 892
888 void BrowserView::UpdateToolbar(TabContents* contents, 893 void BrowserView::UpdateToolbar(TabContentsWrapper* contents,
889 bool should_restore_state) { 894 bool should_restore_state) {
890 toolbar_->Update(contents, should_restore_state); 895 toolbar_->Update(contents->tab_contents(), should_restore_state);
891 } 896 }
892 897
893 void BrowserView::FocusToolbar() { 898 void BrowserView::FocusToolbar() {
894 // Start the traversal within the main toolbar, passing it the storage id 899 // Start the traversal within the main toolbar, passing it the storage id
895 // of the view where focus should be returned if the user exits the toolbar. 900 // of the view where focus should be returned if the user exits the toolbar.
896 SaveFocusedView(); 901 SaveFocusedView();
897 toolbar_->SetPaneFocus(last_focused_view_storage_id_, NULL); 902 toolbar_->SetPaneFocus(last_focused_view_storage_id_, NULL);
898 } 903 }
899 904
900 void BrowserView::FocusBookmarksToolbar() { 905 void BrowserView::FocusBookmarksToolbar() {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 1420
1416 /////////////////////////////////////////////////////////////////////////////// 1421 ///////////////////////////////////////////////////////////////////////////////
1417 // BrowserView, NotificationObserver implementation: 1422 // BrowserView, NotificationObserver implementation:
1418 1423
1419 void BrowserView::Observe(NotificationType type, 1424 void BrowserView::Observe(NotificationType type,
1420 const NotificationSource& source, 1425 const NotificationSource& source,
1421 const NotificationDetails& details) { 1426 const NotificationDetails& details) {
1422 switch (type.value) { 1427 switch (type.value) {
1423 case NotificationType::PREF_CHANGED: 1428 case NotificationType::PREF_CHANGED:
1424 if (*Details<std::string>(details).ptr() == prefs::kShowBookmarkBar && 1429 if (*Details<std::string>(details).ptr() == prefs::kShowBookmarkBar &&
1425 MaybeShowBookmarkBar(browser_->GetSelectedTabContents())) { 1430 MaybeShowBookmarkBar(browser_->GetSelectedTabContentsWrapper())) {
1426 Layout(); 1431 Layout();
1427 } 1432 }
1428 break; 1433 break;
1429 1434
1430 case NotificationType::SIDEBAR_CHANGED: 1435 case NotificationType::SIDEBAR_CHANGED:
1431 if (Details<SidebarContainer>(details)->tab_contents() == 1436 if (Details<SidebarContainer>(details)->tab_contents() ==
1432 browser_->GetSelectedTabContents()) { 1437 browser_->GetSelectedTabContents()) {
1433 UpdateSidebar(); 1438 UpdateSidebar();
1434 } 1439 }
1435 break; 1440 break;
1436 1441
1437 default: 1442 default:
1438 NOTREACHED() << "Got a notification we didn't register for!"; 1443 NOTREACHED() << "Got a notification we didn't register for!";
1439 break; 1444 break;
1440 } 1445 }
1441 } 1446 }
1442 1447
1443 /////////////////////////////////////////////////////////////////////////////// 1448 ///////////////////////////////////////////////////////////////////////////////
1444 // BrowserView, TabStripModelObserver implementation: 1449 // BrowserView, TabStripModelObserver implementation:
1445 1450
1446 void BrowserView::TabDetachedAt(TabContents* contents, int index) { 1451 void BrowserView::TabDetachedAt(TabContentsWrapper* contents, int index) {
1447 // We use index here rather than comparing |contents| because by this time 1452 // We use index here rather than comparing |contents| because by this time
1448 // the model has already removed |contents| from its list, so 1453 // the model has already removed |contents| from its list, so
1449 // browser_->GetSelectedTabContents() will return NULL or something else. 1454 // browser_->GetSelectedTabContents() will return NULL or something else.
1450 if (index == browser_->tabstrip_model()->selected_index()) { 1455 if (index == browser_->tabstrip_model()->selected_index()) {
1451 // We need to reset the current tab contents to NULL before it gets 1456 // We need to reset the current tab contents to NULL before it gets
1452 // freed. This is because the focus manager performs some operations 1457 // freed. This is because the focus manager performs some operations
1453 // on the selected TabContents when it is removed. 1458 // on the selected TabContents when it is removed.
1454 contents_container_->ChangeTabContents(NULL); 1459 contents_container_->ChangeTabContents(NULL);
1455 infobar_container_->ChangeTabContents(NULL); 1460 infobar_container_->ChangeTabContents(NULL);
1456 UpdateSidebarForContents(NULL); 1461 UpdateSidebarForContents(NULL);
1457 UpdateDevToolsForContents(NULL); 1462 UpdateDevToolsForContents(NULL);
1458 } 1463 }
1459 } 1464 }
1460 1465
1461 void BrowserView::TabDeselectedAt(TabContents* contents, int index) { 1466 void BrowserView::TabDeselectedAt(TabContentsWrapper* contents, int index) {
1462 // We do not store the focus when closing the tab to work-around bug 4633. 1467 // We do not store the focus when closing the tab to work-around bug 4633.
1463 // Some reports seem to show that the focus manager and/or focused view can 1468 // Some reports seem to show that the focus manager and/or focused view can
1464 // be garbage at that point, it is not clear why. 1469 // be garbage at that point, it is not clear why.
1465 if (!contents->is_being_destroyed()) 1470 if (!contents->tab_contents()->is_being_destroyed())
1466 contents->view()->StoreFocus(); 1471 contents->view()->StoreFocus();
1467 } 1472 }
1468 1473
1469 void BrowserView::TabSelectedAt(TabContents* old_contents, 1474 void BrowserView::TabSelectedAt(TabContentsWrapper* old_contents,
1470 TabContents* new_contents, 1475 TabContentsWrapper* new_contents,
1471 int index, 1476 int index,
1472 bool user_gesture) { 1477 bool user_gesture) {
1473 DCHECK(old_contents != new_contents); 1478 DCHECK(old_contents != new_contents);
1474 1479
1475 ProcessTabSelected(new_contents, true); 1480 ProcessTabSelected(new_contents, true);
1476 } 1481 }
1477 1482
1478 void BrowserView::TabReplacedAt(TabContents* old_contents, 1483 void BrowserView::TabReplacedAt(TabContentsWrapper* old_contents,
1479 TabContents* new_contents, 1484 TabContentsWrapper* new_contents,
1480 int index) { 1485 int index) {
1481 if (index != browser_->tabstrip_model()->selected_index()) 1486 if (index != browser_->tabstrip_model()->selected_index())
1482 return; 1487 return;
1483 1488
1484 // Swap the 'active' and 'preview' and delete what was the active. 1489 // Swap the 'active' and 'preview' and delete what was the active.
1485 contents_->MakePreviewContentsActiveContents(); 1490 contents_->MakePreviewContentsActiveContents();
1486 TabContentsContainer* old_container = contents_container_; 1491 TabContentsContainer* old_container = contents_container_;
1487 contents_container_ = preview_container_; 1492 contents_container_ = preview_container_;
1488 old_container->ChangeTabContents(NULL); 1493 old_container->ChangeTabContents(NULL);
1489 delete old_container; 1494 delete old_container;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 (IsMaximized() ? 0 : views::NonClientFrameView::kClientEdgeThickness); 2012 (IsMaximized() ? 0 : views::NonClientFrameView::kClientEdgeThickness);
2008 int x = -overlap; 2013 int x = -overlap;
2009 if (UseVerticalTabs() && IsTabStripVisible()) 2014 if (UseVerticalTabs() && IsTabStripVisible())
2010 x += tabstrip_->bounds().right(); 2015 x += tabstrip_->bounds().right();
2011 int height = status_bubble_->GetPreferredSize().height(); 2016 int height = status_bubble_->GetPreferredSize().height();
2012 int contents_height = status_bubble_->base_view()->bounds().height(); 2017 int contents_height = status_bubble_->base_view()->bounds().height();
2013 gfx::Point origin(-overlap, contents_height - height + overlap); 2018 gfx::Point origin(-overlap, contents_height - height + overlap);
2014 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height); 2019 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height);
2015 } 2020 }
2016 2021
2017 bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) { 2022 bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) {
2018 views::View* new_bookmark_bar_view = NULL; 2023 views::View* new_bookmark_bar_view = NULL;
2019 if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) 2024 if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)
2020 && contents) { 2025 && contents) {
2021 if (!bookmark_bar_view_.get()) { 2026 if (!bookmark_bar_view_.get()) {
2022 bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(), 2027 bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(),
2023 browser_.get())); 2028 browser_.get()));
2024 bookmark_bar_view_->set_parent_owned(false); 2029 bookmark_bar_view_->set_parent_owned(false);
2025 bookmark_bar_view_->set_background( 2030 bookmark_bar_view_->set_background(
2026 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), 2031 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(),
2027 browser_.get())); 2032 browser_.get()));
2028 } else { 2033 } else {
2029 bookmark_bar_view_->SetProfile(contents->profile()); 2034 bookmark_bar_view_->SetProfile(contents->profile());
2030 } 2035 }
2031 bookmark_bar_view_->SetPageNavigator(contents); 2036 bookmark_bar_view_->SetPageNavigator(contents->tab_contents());
2032 bookmark_bar_view_-> 2037 bookmark_bar_view_->
2033 SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BOOKMARKS)); 2038 SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BOOKMARKS));
2034 new_bookmark_bar_view = bookmark_bar_view_.get(); 2039 new_bookmark_bar_view = bookmark_bar_view_.get();
2035 } 2040 }
2036 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); 2041 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_);
2037 } 2042 }
2038 2043
2039 bool BrowserView::MaybeShowInfoBar(TabContents* contents) { 2044 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) {
2040 // TODO(beng): Remove this function once the interface between 2045 // TODO(beng): Remove this function once the interface between
2041 // InfoBarContainer, DownloadShelfView and TabContents and this 2046 // InfoBarContainer, DownloadShelfView and TabContents and this
2042 // view is sorted out. 2047 // view is sorted out.
2043 return true; 2048 return true;
2044 } 2049 }
2045 2050
2046 void BrowserView::UpdateSidebar() { 2051 void BrowserView::UpdateSidebar() {
2047 UpdateSidebarForContents(GetSelectedTabContents()); 2052 UpdateSidebarForContents(GetSelectedTabContentsWrapper());
2048 Layout(); 2053 Layout();
2049 } 2054 }
2050 2055
2051 void BrowserView::UpdateSidebarForContents(TabContents* tab_contents) { 2056 void BrowserView::UpdateSidebarForContents(TabContentsWrapper* tab_contents) {
2052 if (!sidebar_container_) 2057 if (!sidebar_container_)
2053 return; // Happens when sidebar is not allowed. 2058 return; // Happens when sidebar is not allowed.
2054 if (!SidebarManager::GetInstance()) 2059 if (!SidebarManager::GetInstance())
2055 return; // Happens only in tests. 2060 return; // Happens only in tests.
2056 2061
2057 TabContents* sidebar_contents = NULL; 2062 TabContents* sidebar_contents = NULL;
2058 if (tab_contents) { 2063 if (tab_contents) {
2059 SidebarContainer* client_host = SidebarManager::GetInstance()-> 2064 SidebarContainer* client_host = SidebarManager::GetInstance()->
2060 GetActiveSidebarContainerFor(tab_contents); 2065 GetActiveSidebarContainerFor(tab_contents->tab_contents());
2061 if (client_host) 2066 if (client_host)
2062 sidebar_contents = client_host->sidebar_contents(); 2067 sidebar_contents = client_host->sidebar_contents();
2063 } 2068 }
2064 2069
2065 bool visible = NULL != sidebar_contents && 2070 bool visible = NULL != sidebar_contents &&
2066 browser_->SupportsWindowFeature(Browser::FEATURE_SIDEBAR); 2071 browser_->SupportsWindowFeature(Browser::FEATURE_SIDEBAR);
2067 2072
2068 bool should_show = visible && !sidebar_container_->IsVisible(); 2073 bool should_show = visible && !sidebar_container_->IsVisible();
2069 bool should_hide = !visible && sidebar_container_->IsVisible(); 2074 bool should_hide = !visible && sidebar_container_->IsVisible();
2070 2075
(...skipping 26 matching lines...) Expand all
2097 // Store split offset when hiding sidebar only. 2102 // Store split offset when hiding sidebar only.
2098 g_browser_process->local_state()->SetInteger( 2103 g_browser_process->local_state()->SetInteger(
2099 prefs::kExtensionSidebarWidth, 2104 prefs::kExtensionSidebarWidth,
2100 sidebar_split_->width() - sidebar_split_->divider_offset()); 2105 sidebar_split_->width() - sidebar_split_->divider_offset());
2101 2106
2102 sidebar_container_->SetVisible(false); 2107 sidebar_container_->SetVisible(false);
2103 sidebar_split_->Layout(); 2108 sidebar_split_->Layout();
2104 } 2109 }
2105 } 2110 }
2106 2111
2107 void BrowserView::UpdateDevToolsForContents(TabContents* tab_contents) { 2112 void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) {
2113 TabContents* tab_contents = wrapper ? wrapper->tab_contents() : NULL;
2108 TabContents* devtools_contents = 2114 TabContents* devtools_contents =
2109 DevToolsWindow::GetDevToolsContents(tab_contents); 2115 DevToolsWindow::GetDevToolsContents(tab_contents);
2110 2116
2111 bool should_show = devtools_contents && !devtools_container_->IsVisible(); 2117 bool should_show = devtools_contents && !devtools_container_->IsVisible();
2112 bool should_hide = !devtools_contents && devtools_container_->IsVisible(); 2118 bool should_hide = !devtools_contents && devtools_container_->IsVisible();
2113 2119
2114 devtools_container_->ChangeTabContents(devtools_contents); 2120 devtools_container_->ChangeTabContents(devtools_contents);
2115 2121
2116 if (should_show) { 2122 if (should_show) {
2117 if (!devtools_focus_tracker_.get()) { 2123 if (!devtools_focus_tracker_.get()) {
(...skipping 25 matching lines...) Expand all
2143 prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); 2149 prefs::kDevToolsSplitLocation, contents_split_->divider_offset());
2144 2150
2145 // Restore focus to the last focused view when hiding devtools window. 2151 // Restore focus to the last focused view when hiding devtools window.
2146 devtools_focus_tracker_->FocusLastFocusedExternalView(); 2152 devtools_focus_tracker_->FocusLastFocusedExternalView();
2147 2153
2148 devtools_container_->SetVisible(false); 2154 devtools_container_->SetVisible(false);
2149 contents_split_->Layout(); 2155 contents_split_->Layout();
2150 } 2156 }
2151 } 2157 }
2152 2158
2153 void BrowserView::UpdateUIForContents(TabContents* contents) { 2159 void BrowserView::UpdateUIForContents(TabContentsWrapper* contents) {
2154 bool needs_layout = MaybeShowBookmarkBar(contents); 2160 bool needs_layout = MaybeShowBookmarkBar(contents);
2155 needs_layout |= MaybeShowInfoBar(contents); 2161 needs_layout |= MaybeShowInfoBar(contents);
2156 if (needs_layout) 2162 if (needs_layout)
2157 Layout(); 2163 Layout();
2158 } 2164 }
2159 2165
2160 bool BrowserView::UpdateChildViewAndLayout(views::View* new_view, 2166 bool BrowserView::UpdateChildViewAndLayout(views::View* new_view,
2161 views::View** old_view) { 2167 views::View** old_view) {
2162 DCHECK(old_view); 2168 DCHECK(old_view);
2163 if (*old_view == new_view) { 2169 if (*old_view == new_view) {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 ticker_.Start(); 2459 ticker_.Start();
2454 2460
2455 pref_service->SetInteger(prefs::kPluginMessageResponseTimeout, 2461 pref_service->SetInteger(prefs::kPluginMessageResponseTimeout,
2456 plugin_message_response_timeout); 2462 plugin_message_response_timeout);
2457 pref_service->SetInteger(prefs::kHungPluginDetectFrequency, 2463 pref_service->SetInteger(prefs::kHungPluginDetectFrequency,
2458 hung_plugin_detect_freq); 2464 hung_plugin_detect_freq);
2459 } 2465 }
2460 #endif 2466 #endif
2461 } 2467 }
2462 2468
2463 void BrowserView::ProcessTabSelected(TabContents* new_contents, 2469 void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents,
2464 bool change_tab_contents) { 2470 bool change_tab_contents) {
2465 // Update various elements that are interested in knowing the current 2471 // Update various elements that are interested in knowing the current
2466 // TabContents. 2472 // TabContents.
2467 2473
2468 // When we toggle the NTP floating bookmarks bar and/or the info bar, 2474 // When we toggle the NTP floating bookmarks bar and/or the info bar,
2469 // we don't want any TabContents to be attached, so that we 2475 // we don't want any TabContents to be attached, so that we
2470 // avoid an unnecessary resize and re-layout of a TabContents. 2476 // avoid an unnecessary resize and re-layout of a TabContents.
2471 if (change_tab_contents) 2477 if (change_tab_contents)
2472 contents_container_->ChangeTabContents(NULL); 2478 contents_container_->ChangeTabContents(NULL);
2473 infobar_container_->ChangeTabContents(new_contents); 2479 infobar_container_->ChangeTabContents(new_contents->tab_contents());
2474 UpdateUIForContents(new_contents); 2480 UpdateUIForContents(new_contents);
2475 if (change_tab_contents) 2481 if (change_tab_contents)
2476 contents_container_->ChangeTabContents(new_contents); 2482 contents_container_->ChangeTabContents(new_contents->tab_contents());
2477 UpdateSidebarForContents(new_contents); 2483 UpdateSidebarForContents(new_contents);
2478 2484
2479 UpdateDevToolsForContents(new_contents); 2485 UpdateDevToolsForContents(new_contents);
2480 // TODO(beng): This should be called automatically by ChangeTabContents, but I 2486 // TODO(beng): This should be called automatically by ChangeTabContents, but I
2481 // am striving for parity now rather than cleanliness. This is 2487 // am striving for parity now rather than cleanliness. This is
2482 // required to make features like Duplicate Tab, Undo Close Tab, 2488 // required to make features like Duplicate Tab, Undo Close Tab,
2483 // etc not result in sad tab. 2489 // etc not result in sad tab.
2484 new_contents->DidBecomeSelected(); 2490 new_contents->tab_contents()->DidBecomeSelected();
2485 if (BrowserList::GetLastActive() == browser_ && 2491 if (BrowserList::GetLastActive() == browser_ &&
2486 !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) { 2492 !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) {
2487 // We only restore focus if our window is visible, to avoid invoking blur 2493 // We only restore focus if our window is visible, to avoid invoking blur
2488 // handlers when we are eventually shown. 2494 // handlers when we are eventually shown.
2489 new_contents->view()->RestoreFocus(); 2495 new_contents->view()->RestoreFocus();
2490 } 2496 }
2491 2497
2492 // Update all the UI bits. 2498 // Update all the UI bits.
2493 UpdateTitleBar(); 2499 UpdateTitleBar();
2494 UpdateToolbar(new_contents, true); 2500 UpdateToolbar(new_contents, true);
(...skipping 12 matching lines...) Expand all
2507 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); 2513 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
2508 2514
2509 return view; 2515 return view;
2510 } 2516 }
2511 #endif 2517 #endif
2512 2518
2513 // static 2519 // static
2514 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { 2520 FindBar* BrowserWindow::CreateFindBar(Browser* browser) {
2515 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); 2521 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window()));
2516 } 2522 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698