| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 bool ToolbarView::ShouldShowIncompatibilityWarning() { | 706 bool ToolbarView::ShouldShowIncompatibilityWarning() { |
| 707 #if defined(OS_WIN) | 707 #if defined(OS_WIN) |
| 708 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); | 708 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); |
| 709 return loaded_modules->ShouldShowConflictWarning(); | 709 return loaded_modules->ShouldShowConflictWarning(); |
| 710 #else | 710 #else |
| 711 return false; | 711 return false; |
| 712 #endif | 712 #endif |
| 713 } | 713 } |
| 714 | 714 |
| 715 int ToolbarView::PopupTopSpacing() const { | 715 int ToolbarView::PopupTopSpacing() const { |
| 716 // TODO(beng): For some reason GetWidget() returns NULL here in some | 716 return GetWidget()->ShouldUseNativeFrame() ? 0 : kPopupTopSpacingNonGlass; |
| 717 // unidentified circumstances on ChromeOS. This means GetWidget() | |
| 718 // succeeded but we were (probably) unable to locate a | |
| 719 // NativeWidgetGtk* on it using | |
| 720 // NativeWidget::GetNativeWidgetForNativeView. | |
| 721 // I am throwing in a NULL check for now to stop the hurt, but | |
| 722 // it's possible the crash may just show up somewhere else. | |
| 723 const views::Widget* widget = GetWidget(); | |
| 724 DCHECK(widget) << "If you hit this please talk to beng"; | |
| 725 return widget && widget->ShouldUseNativeFrame() ? | |
| 726 0 : kPopupTopSpacingNonGlass; | |
| 727 } | 717 } |
| 728 | 718 |
| 729 void ToolbarView::LoadImages() { | 719 void ToolbarView::LoadImages() { |
| 730 ui::ThemeProvider* tp = GetThemeProvider(); | 720 ui::ThemeProvider* tp = GetThemeProvider(); |
| 731 | 721 |
| 732 back_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_BACK)); | 722 back_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_BACK)); |
| 733 back_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_BACK_H)); | 723 back_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_BACK_H)); |
| 734 back_->SetImage(views::CustomButton::BS_PUSHED, | 724 back_->SetImage(views::CustomButton::BS_PUSHED, |
| 735 tp->GetBitmapNamed(IDR_BACK_P)); | 725 tp->GetBitmapNamed(IDR_BACK_P)); |
| 736 back_->SetImage(views::CustomButton::BS_DISABLED, | 726 back_->SetImage(views::CustomButton::BS_DISABLED, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 accname_app = l10n_util::GetStringFUTF16( | 775 accname_app = l10n_util::GetStringFUTF16( |
| 786 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); | 776 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); |
| 787 } | 777 } |
| 788 app_menu_->SetAccessibleName(accname_app); | 778 app_menu_->SetAccessibleName(accname_app); |
| 789 | 779 |
| 790 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 780 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
| 791 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 781 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 792 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 782 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 793 SchedulePaint(); | 783 SchedulePaint(); |
| 794 } | 784 } |
| OLD | NEW |