| 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/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/global_error_service.h" | 14 #include "chrome/browser/ui/global_error_service.h" |
| 15 #include "chrome/browser/ui/global_error_service_factory.h" | 15 #include "chrome/browser/ui/global_error_service_factory.h" |
| 16 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 16 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 17 #include "chrome/browser/ui/view_ids.h" | 17 #include "chrome/browser/ui/view_ids.h" |
| 18 #include "chrome/browser/ui/views/browser_actions_container.h" | 18 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 19 #include "chrome/browser/ui/views/event_utils.h" | 19 #include "chrome/browser/ui/views/event_utils.h" |
| 20 #include "chrome/browser/ui/views/wrench_menu.h" | 20 #include "chrome/browser/ui/views/wrench_menu.h" |
| 21 #include "chrome/browser/upgrade_detector.h" | 21 #include "chrome/browser/upgrade_detector.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "content/browser/accessibility/browser_accessibility_state.h" | 24 #include "content/browser/accessibility/browser_accessibility_state.h" |
| 25 #include "content/browser/user_metrics.h" | 25 #include "content/browser/user_metrics.h" |
| 26 #include "content/common/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 27 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 30 #include "grit/theme_resources_standard.h" | 30 #include "grit/theme_resources_standard.h" |
| 31 #include "ui/base/accessibility/accessible_view_state.h" | 31 #include "ui/base/accessibility/accessible_view_state.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 33 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 34 #include "ui/base/theme_provider.h" | 34 #include "ui/base/theme_provider.h" |
| 35 #include "ui/gfx/canvas.h" | 35 #include "ui/gfx/canvas.h" |
| 36 #include "ui/gfx/canvas_skia.h" | 36 #include "ui/gfx/canvas_skia.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? | 109 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? |
| 110 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; | 110 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; |
| 111 | 111 |
| 112 if (!kPopupBackgroundEdge) { | 112 if (!kPopupBackgroundEdge) { |
| 113 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 113 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 114 IDR_LOCATIONBG_POPUPMODE_EDGE); | 114 IDR_LOCATIONBG_POPUPMODE_EDGE); |
| 115 } | 115 } |
| 116 | 116 |
| 117 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 117 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 118 NotificationService::AllSources()); | 118 content::NotificationService::AllSources()); |
| 119 #if defined(OS_WIN) && !defined(USE_AURA) | 119 #if defined(OS_WIN) && !defined(USE_AURA) |
| 120 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, | 120 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, |
| 121 NotificationService::AllSources()); | 121 content::NotificationService::AllSources()); |
| 122 #endif | 122 #endif |
| 123 registrar_.Add(this, | 123 registrar_.Add(this, |
| 124 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, | 124 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, |
| 125 NotificationService::AllSources()); | 125 content::NotificationService::AllSources()); |
| 126 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, | 126 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, |
| 127 content::Source<Profile>(browser_->profile())); | 127 content::Source<Profile>(browser_->profile())); |
| 128 } | 128 } |
| 129 | 129 |
| 130 ToolbarView::~ToolbarView() { | 130 ToolbarView::~ToolbarView() { |
| 131 // NOTE: Don't remove the command observers here. This object gets destroyed | 131 // NOTE: Don't remove the command observers here. This object gets destroyed |
| 132 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is | 132 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is |
| 133 // already gone. | 133 // already gone. |
| 134 } | 134 } |
| 135 | 135 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 critical_notification_bubble->set_bubble(bubble); | 737 critical_notification_bubble->set_bubble(bubble); |
| 738 #endif | 738 #endif |
| 739 } | 739 } |
| 740 | 740 |
| 741 void ToolbarView::UpdateAppMenuBadge() { | 741 void ToolbarView::UpdateAppMenuBadge() { |
| 742 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 742 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
| 743 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 743 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 744 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 744 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 745 SchedulePaint(); | 745 SchedulePaint(); |
| 746 } | 746 } |
| OLD | NEW |