| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/accessibility/browser_accessibility_state.h" | 10 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 15 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 16 #include "chrome/browser/ui/view_ids.h" | 16 #include "chrome/browser/ui/view_ids.h" |
| 17 #include "chrome/browser/ui/views/browser_actions_container.h" | 17 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 18 #include "chrome/browser/ui/views/event_utils.h" | 18 #include "chrome/browser/ui/views/event_utils.h" |
| 19 #include "chrome/browser/ui/views/wrench_menu.h" |
| 19 #include "chrome/browser/upgrade_detector.h" | 20 #include "chrome/browser/upgrade_detector.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "content/browser/user_metrics.h" | 22 #include "content/browser/user_metrics.h" |
| 22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
| 23 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 25 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
| 26 #include "grit/theme_resources_standard.h" | 27 #include "grit/theme_resources_standard.h" |
| 27 #include "ui/base/accessibility/accessible_view_state.h" | 28 #include "ui/base/accessibility/accessible_view_state.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/base/theme_provider.h" | 31 #include "ui/base/theme_provider.h" |
| 31 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
| 32 #include "ui/gfx/canvas_skia.h" | 33 #include "ui/gfx/canvas_skia.h" |
| 33 #include "ui/gfx/skbitmap_operations.h" | 34 #include "ui/gfx/skbitmap_operations.h" |
| 34 #include "views/controls/button/button_dropdown.h" | 35 #include "views/controls/button/button_dropdown.h" |
| 35 #include "views/focus/view_storage.h" | 36 #include "views/focus/view_storage.h" |
| 36 #include "views/widget/tooltip_manager.h" | 37 #include "views/widget/tooltip_manager.h" |
| 37 #include "views/window/non_client_view.h" | 38 #include "views/window/non_client_view.h" |
| 38 #include "views/window/window.h" | 39 #include "views/window/window.h" |
| 39 | 40 |
| 40 #if defined(OS_CHROMEOS) | |
| 41 #include "chrome/browser/chromeos/cros/cros_library.h" | |
| 42 #include "chrome/browser/chromeos/cros/update_library.h" | |
| 43 #endif | |
| 44 #include "chrome/browser/ui/views/wrench_menu.h" | |
| 45 | |
| 46 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 47 #include "chrome/browser/enumerate_modules_model_win.h" | 42 #include "chrome/browser/enumerate_modules_model_win.h" |
| 48 #endif | 43 #endif |
| 49 | 44 |
| 50 // The space between items is 4 px in general. | 45 // The space between items is 4 px in general. |
| 51 const int ToolbarView::kStandardSpacing = 4; | 46 const int ToolbarView::kStandardSpacing = 4; |
| 52 // The top of the toolbar has an edge we have to skip over in addition to the 4 | 47 // The top of the toolbar has an edge we have to skip over in addition to the 4 |
| 53 // px of spacing. | 48 // px of spacing. |
| 54 const int ToolbarView::kVertSpacing = kStandardSpacing + 1; | 49 const int ToolbarView::kVertSpacing = kStandardSpacing + 1; |
| 55 // The edge graphics have some built-in spacing/shadowing, so we have to adjust | 50 // The edge graphics have some built-in spacing/shadowing, so we have to adjust |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 607 |
| 613 void ToolbarView::RemovePaneFocus() { | 608 void ToolbarView::RemovePaneFocus() { |
| 614 AccessiblePaneView::RemovePaneFocus(); | 609 AccessiblePaneView::RemovePaneFocus(); |
| 615 location_bar_->SetShowFocusRect(false); | 610 location_bar_->SetShowFocusRect(false); |
| 616 } | 611 } |
| 617 | 612 |
| 618 //////////////////////////////////////////////////////////////////////////////// | 613 //////////////////////////////////////////////////////////////////////////////// |
| 619 // ToolbarView, private: | 614 // ToolbarView, private: |
| 620 | 615 |
| 621 bool ToolbarView::IsUpgradeRecommended() { | 616 bool ToolbarView::IsUpgradeRecommended() { |
| 622 #if defined(OS_CHROMEOS) | |
| 623 return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status == | |
| 624 chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT); | |
| 625 #else | |
| 626 return (UpgradeDetector::GetInstance()->notify_upgrade()); | 617 return (UpgradeDetector::GetInstance()->notify_upgrade()); |
| 627 #endif | |
| 628 } | 618 } |
| 629 | 619 |
| 630 bool ToolbarView::ShouldShowIncompatibilityWarning() { | 620 bool ToolbarView::ShouldShowIncompatibilityWarning() { |
| 631 #if defined(OS_WIN) | 621 #if defined(OS_WIN) |
| 632 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); | 622 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); |
| 633 return loaded_modules->ShouldShowConflictWarning(); | 623 return loaded_modules->ShouldShowConflictWarning(); |
| 634 #else | 624 #else |
| 635 return false; | 625 return false; |
| 636 #endif | 626 #endif |
| 637 } | 627 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 683 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 694 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 684 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 695 } | 685 } |
| 696 | 686 |
| 697 void ToolbarView::UpdateAppMenuBadge() { | 687 void ToolbarView::UpdateAppMenuBadge() { |
| 698 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 688 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
| 699 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 689 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 700 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 690 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 701 SchedulePaint(); | 691 SchedulePaint(); |
| 702 } | 692 } |
| OLD | NEW |