| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 #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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/views/browser_bubble.h" | 32 #include "chrome/browser/views/browser_bubble.h" |
| 33 #include "chrome/browser/views/browser_dialogs.h" | 33 #include "chrome/browser/views/browser_dialogs.h" |
| 34 #include "chrome/browser/views/chrome_views_delegate.h" | 34 #include "chrome/browser/views/chrome_views_delegate.h" |
| 35 #include "chrome/browser/views/download_shelf_view.h" | 35 #include "chrome/browser/views/download_shelf_view.h" |
| 36 #include "chrome/browser/views/extensions/extension_shelf.h" | 36 #include "chrome/browser/views/extensions/extension_shelf.h" |
| 37 #include "chrome/browser/views/frame/browser_frame.h" | 37 #include "chrome/browser/views/frame/browser_frame.h" |
| 38 #include "chrome/browser/views/fullscreen_exit_bubble.h" | 38 #include "chrome/browser/views/fullscreen_exit_bubble.h" |
| 39 #include "chrome/browser/views/infobars/infobar_container.h" | 39 #include "chrome/browser/views/infobars/infobar_container.h" |
| 40 #include "chrome/browser/views/status_bubble_views.h" | 40 #include "chrome/browser/views/status_bubble_views.h" |
| 41 #include "chrome/browser/views/tab_contents/tab_contents_container.h" | 41 #include "chrome/browser/views/tab_contents/tab_contents_container.h" |
| 42 #include "chrome/browser/views/tabs/browser_tab_strip.h" |
| 42 #include "chrome/browser/views/tabs/tab_strip.h" | 43 #include "chrome/browser/views/tabs/tab_strip.h" |
| 43 #include "chrome/browser/views/toolbar_star_toggle.h" | 44 #include "chrome/browser/views/toolbar_star_toggle.h" |
| 44 #include "chrome/browser/views/toolbar_view.h" | 45 #include "chrome/browser/views/toolbar_view.h" |
| 45 #include "chrome/browser/sessions/tab_restore_service.h" | 46 #include "chrome/browser/sessions/tab_restore_service.h" |
| 46 #include "chrome/browser/tab_contents/navigation_entry.h" | 47 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 47 #include "chrome/browser/tab_contents/tab_contents.h" | 48 #include "chrome/browser/tab_contents/tab_contents.h" |
| 48 #include "chrome/browser/tab_contents/tab_contents_view.h" | 49 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 49 #include "chrome/browser/window_sizer.h" | 50 #include "chrome/browser/window_sizer.h" |
| 50 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
| 51 #include "chrome/common/native_window_notification_source.h" | 52 #include "chrome/common/native_window_notification_source.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 if (UILayoutIsRightToLeft()) | 424 if (UILayoutIsRightToLeft()) |
| 424 bounding_box.set_x(bounding_box.x() + scrollbar_width); | 425 bounding_box.set_x(bounding_box.x() + scrollbar_width); |
| 425 | 426 |
| 426 return bounding_box; | 427 return bounding_box; |
| 427 } | 428 } |
| 428 | 429 |
| 429 int BrowserView::GetTabStripHeight() const { | 430 int BrowserView::GetTabStripHeight() const { |
| 430 // We want to return tabstrip_->height(), but we might be called in the midst | 431 // We want to return tabstrip_->height(), but we might be called in the midst |
| 431 // of layout, when that hasn't yet been updated to reflect the current state. | 432 // of layout, when that hasn't yet been updated to reflect the current state. |
| 432 // So return what the tabstrip height _ought_ to be right now. | 433 // So return what the tabstrip height _ought_ to be right now. |
| 433 return IsTabStripVisible() ? tabstrip_->GetPreferredSize().height() : 0; | 434 views::View* tabstrip = |
| 435 TabStrip2::Enabled() ? static_cast<views::View*>(bts_) |
| 436 : static_cast<views::View*>(tabstrip_); |
| 437 return IsTabStripVisible() ? tabstrip->GetPreferredSize().height() : 0; |
| 434 } | 438 } |
| 435 | 439 |
| 436 gfx::Rect BrowserView::GetTabStripBounds() const { | 440 gfx::Rect BrowserView::GetTabStripBounds() const { |
| 437 return frame_->GetBoundsForTabStrip(tabstrip_); | 441 return frame_->GetBoundsForTabStrip(tabstrip_); |
| 438 } | 442 } |
| 439 | 443 |
| 440 bool BrowserView::IsToolbarVisible() const { | 444 bool BrowserView::IsToolbarVisible() const { |
| 441 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || | 445 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || |
| 442 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); | 446 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); |
| 443 } | 447 } |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 } | 940 } |
| 937 | 941 |
| 938 void BrowserView::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, | 942 void BrowserView::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, |
| 939 gfx::NativeWindow parent_window) { | 943 gfx::NativeWindow parent_window) { |
| 940 // Default to using our window as the parent if the argument is not specified. | 944 // Default to using our window as the parent if the argument is not specified. |
| 941 gfx::NativeWindow parent = parent_window ? parent_window | 945 gfx::NativeWindow parent = parent_window ? parent_window |
| 942 : GetNativeHandle(); | 946 : GetNativeHandle(); |
| 943 browser::ShowHtmlDialogView(parent, browser_.get(), delegate); | 947 browser::ShowHtmlDialogView(parent, browser_.get(), delegate); |
| 944 } | 948 } |
| 945 | 949 |
| 950 void BrowserView::ContinueDraggingDetachedTab(const gfx::Rect& tab_bounds) { |
| 951 DCHECK(TabStrip2::Enabled()); |
| 952 bts_->SetDraggedTabBounds(0, tab_bounds); |
| 953 frame_->ContinueDraggingDetachedTab(); |
| 954 } |
| 955 |
| 946 void BrowserView::UserChangedTheme() { | 956 void BrowserView::UserChangedTheme() { |
| 947 frame_->GetWindow()->FrameTypeChanged(); | 957 frame_->GetWindow()->FrameTypeChanged(); |
| 948 GetRootView()->ThemeChanged(); | 958 GetRootView()->ThemeChanged(); |
| 949 GetRootView()->SchedulePaint(); | 959 GetRootView()->SchedulePaint(); |
| 950 } | 960 } |
| 951 | 961 |
| 952 int BrowserView::GetExtraRenderViewHeight() const { | 962 int BrowserView::GetExtraRenderViewHeight() const { |
| 953 // Currently this is only used on linux. | 963 // Currently this is only used on linux. |
| 954 return 0; | 964 return 0; |
| 955 } | 965 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 set_window(window); | 1224 set_window(window); |
| 1215 return this; | 1225 return this; |
| 1216 } | 1226 } |
| 1217 | 1227 |
| 1218 /////////////////////////////////////////////////////////////////////////////// | 1228 /////////////////////////////////////////////////////////////////////////////// |
| 1219 // BrowserView, views::ClientView overrides: | 1229 // BrowserView, views::ClientView overrides: |
| 1220 | 1230 |
| 1221 bool BrowserView::CanClose() const { | 1231 bool BrowserView::CanClose() const { |
| 1222 // You cannot close a frame for which there is an active originating drag | 1232 // You cannot close a frame for which there is an active originating drag |
| 1223 // session. | 1233 // session. |
| 1224 if (tabstrip_->IsDragSessionActive()) | 1234 if (!TabStrip2::Enabled() && tabstrip_->IsDragSessionActive()) |
| 1225 return false; | 1235 return false; |
| 1226 | 1236 |
| 1227 // Give beforeunload handlers the chance to cancel the close before we hide | 1237 // Give beforeunload handlers the chance to cancel the close before we hide |
| 1228 // the window below. | 1238 // the window below. |
| 1229 if (!browser_->ShouldCloseWindow()) | 1239 if (!browser_->ShouldCloseWindow()) |
| 1230 return false; | 1240 return false; |
| 1231 | 1241 |
| 1232 if (!browser_->tabstrip_model()->empty()) { | 1242 if (!browser_->tabstrip_model()->empty()) { |
| 1233 // Tab strip isn't empty. Hide the frame (so it appears to have closed | 1243 // Tab strip isn't empty. Hide the frame (so it appears to have closed |
| 1234 // immediately) and close all the tabs, allowing the renderers to shut | 1244 // immediately) and close all the tabs, allowing the renderers to shut |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 #endif | 1282 #endif |
| 1273 } | 1283 } |
| 1274 | 1284 |
| 1275 // Determine if the TabStrip exists and is capable of being clicked on. We | 1285 // Determine if the TabStrip exists and is capable of being clicked on. We |
| 1276 // might be a popup window without a TabStrip. | 1286 // might be a popup window without a TabStrip. |
| 1277 if (IsTabStripVisible()) { | 1287 if (IsTabStripVisible()) { |
| 1278 gfx::Point point_in_view_coords(point); | 1288 gfx::Point point_in_view_coords(point); |
| 1279 View::ConvertPointToView(GetParent(), this, &point_in_view_coords); | 1289 View::ConvertPointToView(GetParent(), this, &point_in_view_coords); |
| 1280 | 1290 |
| 1281 // See if the mouse pointer is within the bounds of the TabStrip. | 1291 // See if the mouse pointer is within the bounds of the TabStrip. |
| 1282 gfx::Point point_in_tabstrip_coords(point); | 1292 if (!TabStrip2::Enabled()) { |
| 1283 View::ConvertPointToView(GetParent(), tabstrip_, &point_in_tabstrip_coords); | 1293 gfx::Point point_in_tabstrip_coords(point); |
| 1284 if (tabstrip_->HitTest(point_in_tabstrip_coords)) { | 1294 View::ConvertPointToView(GetParent(), tabstrip_, &point_in_tabstrip_coords
); |
| 1285 if (tabstrip_->PointIsWithinWindowCaption(point_in_tabstrip_coords)) | 1295 if (tabstrip_->HitTest(point_in_tabstrip_coords)) { |
| 1286 return HTCAPTION; | 1296 if (tabstrip_->PointIsWithinWindowCaption(point_in_tabstrip_coords)) |
| 1287 return HTCLIENT; | 1297 return HTCAPTION; |
| 1298 return HTCLIENT; |
| 1299 } |
| 1288 } | 1300 } |
| 1289 | 1301 |
| 1290 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty | 1302 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty |
| 1291 // starved of dragable area, let's give it to window dragging (this also | 1303 // starved of dragable area, let's give it to window dragging (this also |
| 1292 // makes sense visually). | 1304 // makes sense visually). |
| 1293 if (!IsMaximized() && | 1305 if (!TabStrip2::Enabled() && !IsMaximized() && |
| 1294 (point_in_view_coords.y() < tabstrip_->y() + kTabShadowSize)) { | 1306 (point_in_view_coords.y() < tabstrip_->y() + kTabShadowSize)) { |
| 1295 // We return HTNOWHERE as this is a signal to our containing | 1307 // We return HTNOWHERE as this is a signal to our containing |
| 1296 // NonClientView that it should figure out what the correct hit-test | 1308 // NonClientView that it should figure out what the correct hit-test |
| 1297 // code is given the mouse position... | 1309 // code is given the mouse position... |
| 1298 return HTNOWHERE; | 1310 return HTNOWHERE; |
| 1299 } | 1311 } |
| 1300 } | 1312 } |
| 1301 | 1313 |
| 1302 // If the point's y coordinate is below the top of the toolbar and otherwise | 1314 // If the point's y coordinate is below the top of the toolbar and otherwise |
| 1303 // within the bounds of this view, the point is considered to be within the | 1315 // within the bounds of this view, the point is considered to be within the |
| 1304 // client area. | 1316 // client area. |
| 1305 gfx::Rect bv_bounds = bounds(); | 1317 gfx::Rect bv_bounds = bounds(); |
| 1306 bv_bounds.Offset(0, toolbar_->y()); | 1318 if (TabStrip2::Enabled()) { |
| 1307 bv_bounds.set_height(bv_bounds.height() - toolbar_->y()); | 1319 bv_bounds.Offset(0, bts_->y()); |
| 1320 bv_bounds.set_height(bv_bounds.height() - bts_->y()); |
| 1321 } else { |
| 1322 bv_bounds.Offset(0, toolbar_->y()); |
| 1323 bv_bounds.set_height(bv_bounds.height() - toolbar_->y()); |
| 1324 } |
| 1308 if (bv_bounds.Contains(point)) | 1325 if (bv_bounds.Contains(point)) |
| 1309 return HTCLIENT; | 1326 return HTCLIENT; |
| 1310 | 1327 |
| 1311 // If the point's y coordinate is above the top of the toolbar, but not in | 1328 // If the point's y coordinate is above the top of the toolbar, but not in |
| 1312 // the tabstrip (per previous checking in this function), then we consider it | 1329 // the tabstrip (per previous checking in this function), then we consider it |
| 1313 // in the window caption (e.g. the area to the right of the tabstrip | 1330 // in the window caption (e.g. the area to the right of the tabstrip |
| 1314 // underneath the window controls). However, note that we DO NOT return | 1331 // underneath the window controls). However, note that we DO NOT return |
| 1315 // HTCAPTION here, because when the window is maximized the window controls | 1332 // HTCAPTION here, because when the window is maximized the window controls |
| 1316 // will fall into this space (since the BrowserView is sized to entire size | 1333 // will fall into this space (since the BrowserView is sized to entire size |
| 1317 // of the window at that point), and the HTCAPTION value will cause the | 1334 // of the window at that point), and the HTCAPTION value will cause the |
| 1318 // window controls not to work. So we return HTNOWHERE so that the caller | 1335 // window controls not to work. So we return HTNOWHERE so that the caller |
| 1319 // will hit-test the window controls before finally falling back to | 1336 // will hit-test the window controls before finally falling back to |
| 1320 // HTCAPTION. | 1337 // HTCAPTION. |
| 1321 bv_bounds = bounds(); | 1338 bv_bounds = bounds(); |
| 1322 bv_bounds.set_height(toolbar_->y()); | 1339 bv_bounds.set_height(toolbar_->y()); |
| 1323 if (bv_bounds.Contains(point)) | 1340 if (bv_bounds.Contains(point)) |
| 1324 return HTNOWHERE; | 1341 return HTNOWHERE; |
| 1325 | 1342 |
| 1326 // If the point is somewhere else, delegate to the default implementation. | 1343 // If the point is somewhere else, delegate to the default implementation. |
| 1327 return views::ClientView::NonClientHitTest(point); | 1344 return views::ClientView::NonClientHitTest(point); |
| 1328 } | 1345 } |
| 1329 | 1346 |
| 1330 gfx::Size BrowserView::GetMinimumSize() { | 1347 gfx::Size BrowserView::GetMinimumSize() { |
| 1348 views::View* tabstrip = |
| 1349 TabStrip2::Enabled() ? static_cast<views::View*>(bts_) |
| 1350 : static_cast<views::View*>(tabstrip_); |
| 1331 // TODO(noname): In theory the tabstrip width should probably be | 1351 // TODO(noname): In theory the tabstrip width should probably be |
| 1332 // (OTR + tabstrip + caption buttons) width. | 1352 // (OTR + tabstrip + caption buttons) width. |
| 1333 gfx::Size tabstrip_size( | 1353 gfx::Size tabstrip_size( |
| 1334 browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? | 1354 browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? |
| 1335 tabstrip_->GetMinimumSize() : gfx::Size()); | 1355 tabstrip->GetMinimumSize() : gfx::Size()); |
| 1336 gfx::Size toolbar_size( | 1356 gfx::Size toolbar_size( |
| 1337 (browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || | 1357 (browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || |
| 1338 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) ? | 1358 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) ? |
| 1339 toolbar_->GetMinimumSize() : gfx::Size()); | 1359 toolbar_->GetMinimumSize() : gfx::Size()); |
| 1340 if (tabstrip_size.height() && toolbar_size.height()) | 1360 if (tabstrip_size.height() && toolbar_size.height()) |
| 1341 toolbar_size.Enlarge(0, -kToolbarTabStripVerticalOverlap); | 1361 toolbar_size.Enlarge(0, -kToolbarTabStripVerticalOverlap); |
| 1342 gfx::Size bookmark_bar_size; | 1362 gfx::Size bookmark_bar_size; |
| 1343 if (active_bookmark_bar_ && | 1363 if (active_bookmark_bar_ && |
| 1344 browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) { | 1364 browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) { |
| 1345 bookmark_bar_size = active_bookmark_bar_->GetMinimumSize(); | 1365 bookmark_bar_size = active_bookmark_bar_->GetMinimumSize(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 // Start a hung plugin window detector for this browser object (as long as | 1433 // Start a hung plugin window detector for this browser object (as long as |
| 1414 // hang detection is not disabled). | 1434 // hang detection is not disabled). |
| 1415 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1435 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 1416 switches::kDisableHangMonitor)) { | 1436 switches::kDisableHangMonitor)) { |
| 1417 InitHangMonitor(); | 1437 InitHangMonitor(); |
| 1418 } | 1438 } |
| 1419 | 1439 |
| 1420 LoadAccelerators(); | 1440 LoadAccelerators(); |
| 1421 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); | 1441 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); |
| 1422 | 1442 |
| 1423 tabstrip_ = new TabStrip(browser_->tabstrip_model()); | 1443 if (TabStrip2::Enabled()) { |
| 1424 tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP)); | 1444 bts_ = new BrowserTabStrip(browser_->tabstrip_model()); |
| 1425 AddChildView(tabstrip_); | 1445 AddChildView(bts_); |
| 1426 frame_->TabStripCreated(tabstrip_); | 1446 } else { |
| 1447 tabstrip_ = new TabStrip(browser_->tabstrip_model()); |
| 1448 tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP)); |
| 1449 AddChildView(tabstrip_); |
| 1450 frame_->TabStripCreated(tabstrip_); |
| 1451 } |
| 1427 | 1452 |
| 1428 toolbar_ = new ToolbarView(browser_.get()); | 1453 toolbar_ = new ToolbarView(browser_.get()); |
| 1429 AddChildView(toolbar_); | 1454 AddChildView(toolbar_); |
| 1430 toolbar_->SetID(VIEW_ID_TOOLBAR); | 1455 toolbar_->SetID(VIEW_ID_TOOLBAR); |
| 1431 toolbar_->Init(browser_->profile()); | 1456 toolbar_->Init(browser_->profile()); |
| 1432 toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR)); | 1457 toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR)); |
| 1433 | 1458 |
| 1434 infobar_container_ = new InfoBarContainer(this); | 1459 infobar_container_ = new InfoBarContainer(this); |
| 1435 AddChildView(infobar_container_); | 1460 AddChildView(infobar_container_); |
| 1436 | 1461 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1465 else | 1490 else |
| 1466 BuildSystemMenuForPopupWindow(); | 1491 BuildSystemMenuForPopupWindow(); |
| 1467 system_menu_.reset( | 1492 system_menu_.reset( |
| 1468 new views::NativeMenuWin(system_menu_contents_.get(), | 1493 new views::NativeMenuWin(system_menu_contents_.get(), |
| 1469 frame_->GetWindow()->GetNativeWindow())); | 1494 frame_->GetWindow()->GetNativeWindow())); |
| 1470 system_menu_->Rebuild(); | 1495 system_menu_->Rebuild(); |
| 1471 } | 1496 } |
| 1472 #endif | 1497 #endif |
| 1473 | 1498 |
| 1474 int BrowserView::LayoutTabStrip() { | 1499 int BrowserView::LayoutTabStrip() { |
| 1475 gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_); | 1500 gfx::Rect tabstrip_bounds; |
| 1476 tabstrip_->SetBackgroundOffset( | 1501 if (TabStrip2::Enabled()) { |
| 1477 gfx::Point(tabstrip_bounds.x(), tabstrip_bounds.y())); | 1502 tabstrip_bounds = gfx::Rect(0, 0, width(), |
| 1503 bts_->GetPreferredSize().height()); |
| 1504 } else { |
| 1505 tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_); |
| 1506 tabstrip_->SetBackgroundOffset( |
| 1507 gfx::Point(tabstrip_bounds.x(), tabstrip_bounds.y())); |
| 1508 } |
| 1478 gfx::Point tabstrip_origin = tabstrip_bounds.origin(); | 1509 gfx::Point tabstrip_origin = tabstrip_bounds.origin(); |
| 1479 ConvertPointToView(GetParent(), this, &tabstrip_origin); | 1510 ConvertPointToView(GetParent(), this, &tabstrip_origin); |
| 1480 tabstrip_bounds.set_origin(tabstrip_origin); | 1511 tabstrip_bounds.set_origin(tabstrip_origin); |
| 1481 bool visible = IsTabStripVisible(); | 1512 bool visible = IsTabStripVisible(); |
| 1482 int y = visible ? tabstrip_bounds.y() : 0; | 1513 int y = visible ? tabstrip_bounds.y() : 0; |
| 1483 int height = visible ? tabstrip_bounds.height() : 0; | 1514 int height = visible ? tabstrip_bounds.height() : 0; |
| 1484 tabstrip_->SetVisible(visible); | 1515 int bottom = y + height; |
| 1485 tabstrip_->SetBounds(tabstrip_bounds.x(), y, tabstrip_bounds.width(), height); | 1516 if (TabStrip2::Enabled()) { |
| 1486 return y + height; | 1517 gfx::Size btsps = bts_->GetPreferredSize(); |
| 1518 bts_->SetBounds(tabstrip_bounds.x(), y, width(), btsps.height()); |
| 1519 } else { |
| 1520 tabstrip_->SetVisible(visible); |
| 1521 tabstrip_->SetBounds(tabstrip_bounds.x(), y, tabstrip_bounds.width(), height
); |
| 1522 } |
| 1523 return bottom; |
| 1487 } | 1524 } |
| 1488 | 1525 |
| 1489 int BrowserView::LayoutToolbar(int top) { | 1526 int BrowserView::LayoutToolbar(int top) { |
| 1490 int browser_view_width = width(); | 1527 int browser_view_width = width(); |
| 1491 bool visible = IsToolbarVisible(); | 1528 bool visible = IsToolbarVisible(); |
| 1492 toolbar_->location_bar()->SetFocusable(visible); | 1529 toolbar_->location_bar()->SetFocusable(visible); |
| 1493 int y = top - | 1530 int y = top - |
| 1494 ((visible && IsTabStripVisible()) ? kToolbarTabStripVerticalOverlap : 0); | 1531 ((visible && IsTabStripVisible()) ? kToolbarTabStripVerticalOverlap : 0); |
| 1495 int height = visible ? toolbar_->GetPreferredSize().height() : 0; | 1532 int height = visible ? toolbar_->GetPreferredSize().height() : 0; |
| 1496 toolbar_->SetVisible(visible); | 1533 toolbar_->SetVisible(visible); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 #endif | 1824 #endif |
| 1788 } | 1825 } |
| 1789 | 1826 |
| 1790 void BrowserView::LoadingAnimationCallback() { | 1827 void BrowserView::LoadingAnimationCallback() { |
| 1791 if (browser_->type() == Browser::TYPE_NORMAL) { | 1828 if (browser_->type() == Browser::TYPE_NORMAL) { |
| 1792 // Loading animations are shown in the tab for tabbed windows. We check the | 1829 // Loading animations are shown in the tab for tabbed windows. We check the |
| 1793 // browser type instead of calling IsTabStripVisible() because the latter | 1830 // browser type instead of calling IsTabStripVisible() because the latter |
| 1794 // will return false for fullscreen windows, but we still need to update | 1831 // will return false for fullscreen windows, but we still need to update |
| 1795 // their animations (so that when they come out of fullscreen mode they'll | 1832 // their animations (so that when they come out of fullscreen mode they'll |
| 1796 // be correct). | 1833 // be correct). |
| 1797 tabstrip_->UpdateLoadingAnimations(); | 1834 if (!TabStrip2::Enabled()) |
| 1835 tabstrip_->UpdateLoadingAnimations(); |
| 1798 } else if (ShouldShowWindowIcon()) { | 1836 } else if (ShouldShowWindowIcon()) { |
| 1799 // ... or in the window icon area for popups and app windows. | 1837 // ... or in the window icon area for popups and app windows. |
| 1800 TabContents* tab_contents = browser_->GetSelectedTabContents(); | 1838 TabContents* tab_contents = browser_->GetSelectedTabContents(); |
| 1801 // GetSelectedTabContents can return NULL for example under Purify when | 1839 // GetSelectedTabContents can return NULL for example under Purify when |
| 1802 // the animations are running slowly and this function is called on a timer | 1840 // the animations are running slowly and this function is called on a timer |
| 1803 // through LoadingAnimationCallback. | 1841 // through LoadingAnimationCallback. |
| 1804 frame_->UpdateThrobber(tab_contents && tab_contents->is_loading()); | 1842 frame_->UpdateThrobber(tab_contents && tab_contents->is_loading()); |
| 1805 } | 1843 } |
| 1806 } | 1844 } |
| 1807 | 1845 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 | 1889 |
| 1852 // static | 1890 // static |
| 1853 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 1891 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 1854 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 1892 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 1855 } | 1893 } |
| 1856 | 1894 |
| 1857 // static | 1895 // static |
| 1858 void BrowserList::AllBrowsersClosed() { | 1896 void BrowserList::AllBrowsersClosed() { |
| 1859 views::Window::CloseAllSecondaryWindows(); | 1897 views::Window::CloseAllSecondaryWindows(); |
| 1860 } | 1898 } |
| OLD | NEW |