| 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 #include "chrome/browser/ui/views/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 static const int kEdgeSpacing = 3; | 76 static const int kEdgeSpacing = 3; |
| 77 #endif | 77 #endif |
| 78 | 78 |
| 79 // The buttons to the left of the omnibox are close together. | 79 // The buttons to the left of the omnibox are close together. |
| 80 #if defined(USE_ASH) | 80 #if defined(USE_ASH) |
| 81 static const int kButtonSpacing = 0; | 81 static const int kButtonSpacing = 0; |
| 82 #else | 82 #else |
| 83 static const int kButtonSpacing = 1; | 83 static const int kButtonSpacing = 1; |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 // The content area line has a shadow that extends a couple of pixels above |
| 87 // the toolbar bounds. |
| 88 #if defined(USE_ASH) |
| 89 const int kContentShadowHeight = 2; |
| 90 #else |
| 91 const int kContentShadowHeight = 0; |
| 92 #endif |
| 93 |
| 86 // The length of time to run the upgrade notification animation (the time it | 94 // The length of time to run the upgrade notification animation (the time it |
| 87 // takes one pulse to run its course and go back to its original brightness). | 95 // takes one pulse to run its course and go back to its original brightness). |
| 88 static const int kPulseDuration = 2000; | 96 static const int kPulseDuration = 2000; |
| 89 | 97 |
| 90 // How long to wait between pulsating the upgrade notifier. | 98 // How long to wait between pulsating the upgrade notifier. |
| 91 static const int kPulsateEveryMs = 8000; | 99 static const int kPulsateEveryMs = 8000; |
| 92 | 100 |
| 93 static const int kPopupTopSpacingNonGlass = 3; | 101 static const int kPopupTopSpacingNonGlass = 3; |
| 94 static const int kPopupBottomSpacingNonGlass = 2; | 102 static const int kPopupBottomSpacingNonGlass = 2; |
| 95 static const int kPopupBottomSpacingGlass = 1; | 103 static const int kPopupBottomSpacingGlass = 1; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 location_bar_->GetPreferredSize().width() + | 515 location_bar_->GetPreferredSize().width() + |
| 508 browser_actions_->GetPreferredSize().width() + | 516 browser_actions_->GetPreferredSize().width() + |
| 509 app_menu_->GetPreferredSize().width() + kEdgeSpacing; | 517 app_menu_->GetPreferredSize().width() + kEdgeSpacing; |
| 510 | 518 |
| 511 CR_DEFINE_STATIC_LOCAL(SkBitmap, normal_background, ()); | 519 CR_DEFINE_STATIC_LOCAL(SkBitmap, normal_background, ()); |
| 512 if (normal_background.isNull()) { | 520 if (normal_background.isNull()) { |
| 513 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 521 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 514 normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); | 522 normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); |
| 515 } | 523 } |
| 516 | 524 |
| 517 return gfx::Size(min_width, normal_background.height()); | 525 return gfx::Size(min_width, |
| 526 normal_background.height() - kContentShadowHeight); |
| 518 } | 527 } |
| 519 | 528 |
| 520 int vertical_spacing = PopupTopSpacing() + | 529 int vertical_spacing = PopupTopSpacing() + |
| 521 (GetWidget()->ShouldUseNativeFrame() ? | 530 (GetWidget()->ShouldUseNativeFrame() ? |
| 522 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass); | 531 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass); |
| 523 return gfx::Size(0, location_bar_->GetPreferredSize().height() + | 532 return gfx::Size(0, location_bar_->GetPreferredSize().height() + |
| 524 vertical_spacing); | 533 vertical_spacing); |
| 525 } | 534 } |
| 526 | 535 |
| 527 void ToolbarView::Layout() { | 536 void ToolbarView::Layout() { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 accname_app = l10n_util::GetStringFUTF16( | 784 accname_app = l10n_util::GetStringFUTF16( |
| 776 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); | 785 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); |
| 777 } | 786 } |
| 778 app_menu_->SetAccessibleName(accname_app); | 787 app_menu_->SetAccessibleName(accname_app); |
| 779 | 788 |
| 780 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 789 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
| 781 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 790 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 782 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 791 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 783 SchedulePaint(); | 792 SchedulePaint(); |
| 784 } | 793 } |
| OLD | NEW |