OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #include "chrome/browser/views/frame/browser_view.h" | 7 #include "chrome/browser/views/frame/browser_view.h" |
8 | 8 |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
41 #include "chrome/common/drag_drop_types.h" | 41 #include "chrome/common/drag_drop_types.h" |
42 #include "chrome/common/l10n_util.h" | 42 #include "chrome/common/l10n_util.h" |
43 #include "chrome/common/notification_service.h" | 43 #include "chrome/common/notification_service.h" |
44 #include "chrome/common/os_exchange_data.h" | 44 #include "chrome/common/os_exchange_data.h" |
45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
46 #include "chrome/common/pref_service.h" | 46 #include "chrome/common/pref_service.h" |
47 #include "chrome/common/resource_bundle.h" | 47 #include "chrome/common/resource_bundle.h" |
48 #include "chrome/common/win_util.h" | 48 #include "chrome/common/win_util.h" |
49 #include "chrome/views/hwnd_notification_source.h" | 49 #include "chrome/views/hwnd_notification_source.h" |
| 50 #include "chrome/views/native_scroll_bar.h" |
50 #include "chrome/views/non_client_view.h" | 51 #include "chrome/views/non_client_view.h" |
51 #include "chrome/views/view.h" | 52 #include "chrome/views/view.h" |
52 #include "chrome/views/window.h" | 53 #include "chrome/views/window.h" |
53 | 54 |
54 #include "chromium_strings.h" | 55 #include "chromium_strings.h" |
55 #include "generated_resources.h" | 56 #include "generated_resources.h" |
| 57 #include "webkit_resources.h" |
| 58 |
56 | 59 |
57 using base::TimeDelta; | 60 using base::TimeDelta; |
58 | 61 |
59 // static | 62 // static |
60 SkBitmap BrowserView::default_favicon_; | 63 SkBitmap BrowserView::default_favicon_; |
61 SkBitmap BrowserView::otr_avatar_; | 64 SkBitmap BrowserView::otr_avatar_; |
62 // The vertical overlap between the TabStrip and the Toolbar. | 65 // The vertical overlap between the TabStrip and the Toolbar. |
63 static const int kToolbarTabStripVerticalOverlap = 3; | 66 static const int kToolbarTabStripVerticalOverlap = 3; |
64 // The visible height of the shadow above the tabs. Clicks in this area are | 67 // The visible height of the shadow above the tabs. Clicks in this area are |
65 // treated as clicks to the frame, rather than clicks to the tab. | 68 // treated as clicks to the frame, rather than clicks to the tab. |
(...skipping 13 matching lines...) Expand all Loading... |
79 // How frequently we check for hung plugin windows. | 82 // How frequently we check for hung plugin windows. |
80 static const int kDefaultHungPluginDetectFrequency = 2000; | 83 static const int kDefaultHungPluginDetectFrequency = 2000; |
81 // How long do we wait before we consider a window hung (in ms). | 84 // How long do we wait before we consider a window hung (in ms). |
82 static const int kDefaultPluginMessageResponseTimeout = 30000; | 85 static const int kDefaultPluginMessageResponseTimeout = 30000; |
83 // The number of milliseconds between loading animation frames. | 86 // The number of milliseconds between loading animation frames. |
84 static const int kLoadingAnimationFrameTimeMs = 30; | 87 static const int kLoadingAnimationFrameTimeMs = 30; |
85 | 88 |
86 // If not -1, windows are shown with this state. | 89 // If not -1, windows are shown with this state. |
87 static int explicit_show_state = -1; | 90 static int explicit_show_state = -1; |
88 | 91 |
89 static const struct { bool separator; int command; int label; } kMenuLayout[] =
{ | 92 static const struct { |
| 93 bool separator; |
| 94 int command; |
| 95 int label; |
| 96 } kMenuLayout[] = { |
90 { true, 0, 0 }, | 97 { true, 0, 0 }, |
91 { false, IDC_TASK_MANAGER, IDS_TASK_MANAGER }, | 98 { false, IDC_TASK_MANAGER, IDS_TASK_MANAGER }, |
92 { true, 0, 0 }, | 99 { true, 0, 0 }, |
93 { false, IDC_ENCODING_MENU, IDS_ENCODING_MENU }, | 100 { false, IDC_ENCODING_MENU, IDS_ENCODING_MENU }, |
94 { false, IDC_ZOOM_MENU, IDS_ZOOM_MENU }, | 101 { false, IDC_ZOOM_MENU, IDS_ZOOM_MENU }, |
95 { false, IDC_PRINT, IDS_PRINT }, | 102 { false, IDC_PRINT, IDS_PRINT }, |
96 { false, IDC_SAVE_PAGE, IDS_SAVE_PAGE }, | 103 { false, IDC_SAVE_PAGE, IDS_SAVE_PAGE }, |
97 { false, IDC_FIND, IDS_FIND }, | 104 { false, IDC_FIND, IDS_FIND }, |
98 { true, 0, 0 }, | 105 { true, 0, 0 }, |
99 { false, IDC_PASTE, IDS_PASTE }, | 106 { false, IDC_PASTE, IDS_PASTE }, |
100 { false, IDC_COPY, IDS_COPY }, | 107 { false, IDC_COPY, IDS_COPY }, |
101 { false, IDC_CUT, IDS_CUT }, | 108 { false, IDC_CUT, IDS_CUT }, |
102 { true, 0, 0 }, | 109 { true, 0, 0 }, |
103 { false, IDC_NEW_TAB, IDS_APP_MENU_NEW_WEB_PAGE }, | 110 { false, IDC_NEW_TAB, IDS_APP_MENU_NEW_WEB_PAGE }, |
104 { false, IDC_SHOW_AS_TAB, IDS_SHOW_AS_TAB }, | 111 { false, IDC_SHOW_AS_TAB, IDS_SHOW_AS_TAB }, |
105 { false, IDC_COPY_URL, IDS_APP_MENU_COPY_URL }, | 112 { false, IDC_COPY_URL, IDS_APP_MENU_COPY_URL }, |
106 { false, IDC_DUPLICATE_TAB, IDS_APP_MENU_DUPLICATE_APP_WINDOW }, | 113 { false, IDC_DUPLICATE_TAB, IDS_APP_MENU_DUPLICATE_APP_WINDOW }, |
107 { true, 0, 0 }, | 114 { true, 0, 0 }, |
108 { false, IDC_RELOAD, IDS_APP_MENU_RELOAD }, | 115 { false, IDC_RELOAD, IDS_APP_MENU_RELOAD }, |
109 { false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD }, | 116 { false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD }, |
110 { false, IDC_BACK, IDS_CONTENT_CONTEXT_BACK } | 117 { false, IDC_BACK, IDS_CONTENT_CONTEXT_BACK } |
111 }; | 118 }; |
112 | 119 |
113 /////////////////////////////////////////////////////////////////////////////// | 120 /////////////////////////////////////////////////////////////////////////////// |
| 121 // ResizeCorner, private: |
| 122 |
| 123 class ResizeCorner : public views::View { |
| 124 public: |
| 125 ResizeCorner() {} |
| 126 virtual void Paint(ChromeCanvas* canvas) { |
| 127 SkBitmap * bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 128 IDR_TEXTAREA_RESIZER); |
| 129 bitmap->buildMipMap(false); |
| 130 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); |
| 131 if (rtl_dir) { |
| 132 canvas->TranslateInt(width(), 0); |
| 133 canvas->ScaleInt(-1, 1); |
| 134 canvas->save(); |
| 135 } |
| 136 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), |
| 137 height() - bitmap->height()); |
| 138 if (rtl_dir) |
| 139 canvas->restore(); |
| 140 } |
| 141 |
| 142 static gfx::Size GetSize() { |
| 143 return gfx::Size(views::NativeScrollBar::GetVerticalScrollBarWidth(), |
| 144 views::NativeScrollBar::GetHorizontalScrollBarHeight()); |
| 145 } |
| 146 |
| 147 virtual gfx::Size GetPreferredSize() { |
| 148 return GetSize(); |
| 149 } |
| 150 |
| 151 virtual void Layout() { |
| 152 views::View* parent_view = GetParent(); |
| 153 if (parent_view) { |
| 154 gfx::Size ps = GetPreferredSize(); |
| 155 // No need to handle Right to left text direction here, |
| 156 // our parent must take care of it for us... |
| 157 SetBounds(parent_view->width() - ps.width(), |
| 158 parent_view->height() - ps.height(), ps.width(), ps.height()); |
| 159 } |
| 160 } |
| 161 |
| 162 private: |
| 163 DISALLOW_COPY_AND_ASSIGN(ResizeCorner); |
| 164 }; |
| 165 |
| 166 |
| 167 /////////////////////////////////////////////////////////////////////////////// |
114 // BrowserView, public: | 168 // BrowserView, public: |
115 | 169 |
116 // static | 170 // static |
117 void BrowserView::SetShowState(int state) { | 171 void BrowserView::SetShowState(int state) { |
118 explicit_show_state = state; | 172 explicit_show_state = state; |
119 } | 173 } |
120 | 174 |
121 BrowserView::BrowserView(Browser* browser) | 175 BrowserView::BrowserView(Browser* browser) |
122 : ClientView(NULL, NULL), | 176 : views::ClientView(NULL, NULL), |
123 frame_(NULL), | 177 frame_(NULL), |
124 browser_(browser), | 178 browser_(browser), |
125 active_bookmark_bar_(NULL), | 179 active_bookmark_bar_(NULL), |
126 active_info_bar_(NULL), | 180 active_info_bar_(NULL), |
127 active_download_shelf_(NULL), | 181 active_download_shelf_(NULL), |
128 toolbar_(NULL), | 182 toolbar_(NULL), |
129 contents_container_(NULL), | 183 contents_container_(NULL), |
130 initialized_(false), | 184 initialized_(false), |
131 can_drop_(false), | 185 can_drop_(false), |
132 hung_window_detector_(&hung_plugin_action_), | 186 hung_window_detector_(&hung_plugin_action_), |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 GetStartupInfo(&si); | 224 GetStartupInfo(&si); |
171 // When launched from bash, for some reason si.wShowWindow is set to SW_HIDE, | 225 // When launched from bash, for some reason si.wShowWindow is set to SW_HIDE, |
172 // so we need to correct that condition. | 226 // so we need to correct that condition. |
173 return si.wShowWindow == SW_HIDE ? SW_SHOWNORMAL : si.wShowWindow; | 227 return si.wShowWindow == SW_HIDE ? SW_SHOWNORMAL : si.wShowWindow; |
174 } | 228 } |
175 | 229 |
176 void BrowserView::WindowMoved() { | 230 void BrowserView::WindowMoved() { |
177 // Cancel any tabstrip animations, some of them may be invalidated by the | 231 // Cancel any tabstrip animations, some of them may be invalidated by the |
178 // window being repositioned. | 232 // window being repositioned. |
179 // Comment out for one cycle to see if this fixes dist tests. | 233 // Comment out for one cycle to see if this fixes dist tests. |
180 //tabstrip_->DestroyDragController(); | 234 // tabstrip_->DestroyDragController(); |
181 | 235 |
182 status_bubble_->Reposition(); | 236 status_bubble_->Reposition(); |
183 | 237 |
184 // Close the omnibox popup, if any. | 238 // Close the omnibox popup, if any. |
185 if (toolbar_->GetLocationBarView()) | 239 if (toolbar_->GetLocationBarView()) |
186 toolbar_->GetLocationBarView()->location_entry()->ClosePopup(); | 240 toolbar_->GetLocationBarView()->location_entry()->ClosePopup(); |
187 } | 241 } |
188 | 242 |
189 gfx::Rect BrowserView::GetToolbarBounds() const { | 243 gfx::Rect BrowserView::GetToolbarBounds() const { |
190 return toolbar_->bounds(); | 244 return toolbar_->bounds(); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 538 } |
485 | 539 |
486 gfx::Rect BrowserView::GetNormalBounds() const { | 540 gfx::Rect BrowserView::GetNormalBounds() const { |
487 WINDOWPLACEMENT wp; | 541 WINDOWPLACEMENT wp; |
488 wp.length = sizeof(wp); | 542 wp.length = sizeof(wp); |
489 const bool ret = !!GetWindowPlacement(frame_->GetWindow()->GetHWND(), &wp); | 543 const bool ret = !!GetWindowPlacement(frame_->GetWindow()->GetHWND(), &wp); |
490 DCHECK(ret); | 544 DCHECK(ret); |
491 return gfx::Rect(wp.rcNormalPosition); | 545 return gfx::Rect(wp.rcNormalPosition); |
492 } | 546 } |
493 | 547 |
494 bool BrowserView::IsMaximized() { | 548 bool BrowserView::IsMaximized() const { |
495 return frame_->GetWindow()->IsMaximized(); | 549 return frame_->GetWindow()->IsMaximized(); |
496 } | 550 } |
497 | 551 |
498 LocationBar* BrowserView::GetLocationBar() const { | 552 LocationBar* BrowserView::GetLocationBar() const { |
499 return toolbar_->GetLocationBarView(); | 553 return toolbar_->GetLocationBarView(); |
500 } | 554 } |
501 | 555 |
502 void BrowserView::UpdateStopGoState(bool is_loading) { | 556 void BrowserView::UpdateStopGoState(bool is_loading) { |
503 toolbar_->GetGoButton()->ChangeMode( | 557 toolbar_->GetGoButton()->ChangeMode( |
504 is_loading ? GoButton::MODE_STOP : GoButton::MODE_GO); | 558 is_loading ? GoButton::MODE_STOP : GoButton::MODE_GO); |
(...skipping 23 matching lines...) Expand all Loading... |
528 if (!bookmark_bar_view_.get()) | 582 if (!bookmark_bar_view_.get()) |
529 return false; | 583 return false; |
530 | 584 |
531 if (bookmark_bar_view_->OnNewTabPage() || bookmark_bar_view_->IsAnimating()) | 585 if (bookmark_bar_view_->OnNewTabPage() || bookmark_bar_view_->IsAnimating()) |
532 return true; | 586 return true; |
533 | 587 |
534 // 1 is the minimum in GetPreferredSize for the bookmark bar. | 588 // 1 is the minimum in GetPreferredSize for the bookmark bar. |
535 return bookmark_bar_view_->GetPreferredSize().height() > 1; | 589 return bookmark_bar_view_->GetPreferredSize().height() > 1; |
536 } | 590 } |
537 | 591 |
| 592 gfx::Rect BrowserView::GetRootWindowResizerRect() const { |
| 593 // There is no resize corner when we are maximized |
| 594 if (IsMaximized()) |
| 595 return gfx::Rect(); |
| 596 |
| 597 // We don't specify a resize corner size if we have a bottom shelf either. |
| 598 // This is because we take care of drawing the resize corner on top of that |
| 599 // shelf, so we don't want others to do it for us in this case. |
| 600 // Currently, the only visible bottom shelf is the download shelf. |
| 601 // Other tests should be added here if we add more bottom shelves. |
| 602 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 603 if (current_tab && current_tab->IsDownloadShelfVisible()) { |
| 604 DownloadShelfView* download_shelf = current_tab->GetDownloadShelfView(); |
| 605 if (download_shelf && download_shelf->IsShowing()) |
| 606 return gfx::Rect(); |
| 607 } |
| 608 |
| 609 gfx::Rect client_rect = contents_container_->bounds(); |
| 610 gfx::Size resize_corner_size = ResizeCorner::GetSize(); |
| 611 int x = client_rect.width() - resize_corner_size.width(); |
| 612 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) |
| 613 x = 0; |
| 614 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(), |
| 615 resize_corner_size.width(), resize_corner_size.height()); |
| 616 } |
| 617 |
538 void BrowserView::ToggleBookmarkBar() { | 618 void BrowserView::ToggleBookmarkBar() { |
539 BookmarkBarView::ToggleWhenVisible(browser_->profile()); | 619 BookmarkBarView::ToggleWhenVisible(browser_->profile()); |
540 } | 620 } |
541 | 621 |
542 void BrowserView::ShowAboutChromeDialog() { | 622 void BrowserView::ShowAboutChromeDialog() { |
543 views::Window::CreateChromeWindow( | 623 views::Window::CreateChromeWindow( |
544 GetWidget()->GetHWND(), gfx::Rect(), | 624 GetWidget()->GetHWND(), gfx::Rect(), |
545 new AboutChromeView(browser_->profile()))->Show(); | 625 new AboutChromeView(browser_->profile()))->Show(); |
546 } | 626 } |
547 | 627 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 NotificationService::NoDetails()); | 960 NotificationService::NoDetails()); |
881 return true; | 961 return true; |
882 } | 962 } |
883 | 963 |
884 int BrowserView::NonClientHitTest(const gfx::Point& point) { | 964 int BrowserView::NonClientHitTest(const gfx::Point& point) { |
885 // Since the TabStrip only renders in some parts of the top of the window, | 965 // Since the TabStrip only renders in some parts of the top of the window, |
886 // the un-obscured area is considered to be part of the non-client caption | 966 // the un-obscured area is considered to be part of the non-client caption |
887 // area of the window. So we need to treat hit-tests in these regions as | 967 // area of the window. So we need to treat hit-tests in these regions as |
888 // hit-tests of the titlebar. | 968 // hit-tests of the titlebar. |
889 | 969 |
| 970 // There is not resize corner when we are maximised |
| 971 if (!IsMaximized()) { |
| 972 CRect client_rect; |
| 973 ::GetClientRect(frame_->GetWindow()->GetHWND(), &client_rect); |
| 974 gfx::Size resize_corner_size = ResizeCorner::GetSize(); |
| 975 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), |
| 976 client_rect.bottom - resize_corner_size.height(), |
| 977 resize_corner_size.width(), resize_corner_size.height()); |
| 978 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); |
| 979 if (rtl_dir) |
| 980 resize_corner_rect.set_x(0); |
| 981 if (resize_corner_rect.Contains(point)) { |
| 982 if (rtl_dir) |
| 983 return HTBOTTOMLEFT; |
| 984 return HTBOTTOMRIGHT; |
| 985 } |
| 986 } |
| 987 |
890 // Determine if the TabStrip exists and is capable of being clicked on. We | 988 // Determine if the TabStrip exists and is capable of being clicked on. We |
891 // might be a popup window without a TabStrip, or the TabStrip could be | 989 // might be a popup window without a TabStrip, or the TabStrip could be |
892 // animating. | 990 // animating. |
893 if (IsTabStripVisible() && tabstrip_->CanProcessInputEvents()) { | 991 if (IsTabStripVisible() && tabstrip_->CanProcessInputEvents()) { |
894 gfx::Point point_in_view_coords(point); | 992 gfx::Point point_in_view_coords(point); |
895 View::ConvertPointToView(GetParent(), this, &point_in_view_coords); | 993 View::ConvertPointToView(GetParent(), this, &point_in_view_coords); |
896 | 994 |
897 // See if the mouse pointer is within the bounds of the TabStrip. | 995 // See if the mouse pointer is within the bounds of the TabStrip. |
898 gfx::Point point_in_tabstrip_coords(point); | 996 gfx::Point point_in_tabstrip_coords(point); |
899 View::ConvertPointToView(GetParent(), tabstrip_, &point_in_tabstrip_coords); | 997 View::ConvertPointToView(GetParent(), tabstrip_, &point_in_tabstrip_coords); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 // of the window at that point), and the HTCAPTION value will cause the | 1031 // of the window at that point), and the HTCAPTION value will cause the |
934 // window controls not to work. So we return HTNOWHERE so that the caller | 1032 // window controls not to work. So we return HTNOWHERE so that the caller |
935 // will hit-test the window controls before finally falling back to | 1033 // will hit-test the window controls before finally falling back to |
936 // HTCAPTION. | 1034 // HTCAPTION. |
937 bv_bounds = bounds(); | 1035 bv_bounds = bounds(); |
938 bv_bounds.set_height(toolbar_->y()); | 1036 bv_bounds.set_height(toolbar_->y()); |
939 if (bv_bounds.Contains(point)) | 1037 if (bv_bounds.Contains(point)) |
940 return HTNOWHERE; | 1038 return HTNOWHERE; |
941 | 1039 |
942 // If the point is somewhere else, delegate to the default implementation. | 1040 // If the point is somewhere else, delegate to the default implementation. |
943 return ClientView::NonClientHitTest(point); | 1041 return views::ClientView::NonClientHitTest(point); |
944 } | 1042 } |
945 | 1043 |
946 /////////////////////////////////////////////////////////////////////////////// | 1044 /////////////////////////////////////////////////////////////////////////////// |
947 // BrowserView, views::View overrides: | 1045 // BrowserView, views::View overrides: |
948 | 1046 |
949 void BrowserView::Layout() { | 1047 void BrowserView::Layout() { |
950 int top = LayoutTabStrip(); | 1048 int top = LayoutTabStrip(); |
951 top = LayoutToolbar(top); | 1049 top = LayoutToolbar(top); |
952 top = LayoutBookmarkAndInfoBars(top); | 1050 top = LayoutBookmarkAndInfoBars(top); |
953 int bottom = LayoutDownloadShelf(); | 1051 int bottom = LayoutDownloadShelf(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // the Bookmark bar isn't visible on all tabs, then we need to show the | 1210 // the Bookmark bar isn't visible on all tabs, then we need to show the |
1113 // Info bar _above_ the Bookmark bar, since the Bookmark bar is styled to | 1211 // Info bar _above_ the Bookmark bar, since the Bookmark bar is styled to |
1114 // look like it's part of the New Tab Page... | 1212 // look like it's part of the New Tab Page... |
1115 if (active_bookmark_bar_ && | 1213 if (active_bookmark_bar_ && |
1116 bookmark_bar_view_->OnNewTabPage() && | 1214 bookmark_bar_view_->OnNewTabPage() && |
1117 !bookmark_bar_view_->IsAlwaysShown()) { | 1215 !bookmark_bar_view_->IsAlwaysShown()) { |
1118 top = LayoutInfoBar(top); | 1216 top = LayoutInfoBar(top); |
1119 return LayoutBookmarkBar(top); | 1217 return LayoutBookmarkBar(top); |
1120 } | 1218 } |
1121 | 1219 |
1122 // If we're showing a regular bookmark bar and it's not below an infobar, | 1220 // If we're showing a regular bookmark bar and it's not below an infobar, |
1123 // make it overlap the toolbar so that the bar items can be drawn higher. | 1221 // make it overlap the toolbar so that the bar items can be drawn higher. |
1124 if (active_bookmark_bar_) | 1222 if (active_bookmark_bar_) |
1125 top -= bookmark_bar_view_->GetToolbarOverlap(); | 1223 top -= bookmark_bar_view_->GetToolbarOverlap(); |
1126 | 1224 |
1127 // Otherwise, Bookmark bar first, Info bar second. | 1225 // Otherwise, Bookmark bar first, Info bar second. |
1128 top = LayoutBookmarkBar(top); | 1226 top = LayoutBookmarkBar(top); |
1129 } | 1227 } |
1130 return LayoutInfoBar(top); | 1228 return LayoutInfoBar(top); |
1131 } | 1229 } |
1132 | 1230 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1291 |
1194 bool BrowserView::MaybeShowInfoBar(TabContents* contents) { | 1292 bool BrowserView::MaybeShowInfoBar(TabContents* contents) { |
1195 // TODO(beng): Remove this function once the interface between | 1293 // TODO(beng): Remove this function once the interface between |
1196 // InfoBarContainer, DownloadShelfView and TabContents and this | 1294 // InfoBarContainer, DownloadShelfView and TabContents and this |
1197 // view is sorted out. | 1295 // view is sorted out. |
1198 return true; | 1296 return true; |
1199 } | 1297 } |
1200 | 1298 |
1201 bool BrowserView::MaybeShowDownloadShelf(TabContents* contents) { | 1299 bool BrowserView::MaybeShowDownloadShelf(TabContents* contents) { |
1202 views::View* new_shelf = NULL; | 1300 views::View* new_shelf = NULL; |
1203 if (contents && contents->IsDownloadShelfVisible()) | 1301 if (contents && contents->IsDownloadShelfVisible()) { |
1204 new_shelf = contents->GetDownloadShelfView(); | 1302 new_shelf = contents->GetDownloadShelfView(); |
| 1303 if (new_shelf != active_download_shelf_) |
| 1304 new_shelf->AddChildView(new ResizeCorner()); |
| 1305 } |
1205 return UpdateChildViewAndLayout(new_shelf, &active_download_shelf_); | 1306 return UpdateChildViewAndLayout(new_shelf, &active_download_shelf_); |
1206 } | 1307 } |
1207 | 1308 |
1208 void BrowserView::UpdateUIForContents(TabContents* contents) { | 1309 void BrowserView::UpdateUIForContents(TabContents* contents) { |
1209 bool needs_layout = MaybeShowBookmarkBar(contents); | 1310 bool needs_layout = MaybeShowBookmarkBar(contents); |
1210 needs_layout |= MaybeShowInfoBar(contents); | 1311 needs_layout |= MaybeShowInfoBar(contents); |
1211 needs_layout |= MaybeShowDownloadShelf(contents); | 1312 needs_layout |= MaybeShowDownloadShelf(contents); |
1212 if (needs_layout) | 1313 if (needs_layout) |
1213 Layout(); | 1314 Layout(); |
1214 } | 1315 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 | 1501 |
1401 // static | 1502 // static |
1402 void BrowserView::InitClass() { | 1503 void BrowserView::InitClass() { |
1403 static bool initialized = false; | 1504 static bool initialized = false; |
1404 if (!initialized) { | 1505 if (!initialized) { |
1405 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1506 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
1406 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 1507 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
1407 initialized = true; | 1508 initialized = true; |
1408 } | 1509 } |
1409 } | 1510 } |
OLD | NEW |