| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
| 34 #include "ui/gfx/canvas_skia.h" | 34 #include "ui/gfx/canvas_skia.h" |
| 35 #include "ui/gfx/skbitmap_operations.h" | 35 #include "ui/gfx/skbitmap_operations.h" |
| 36 #include "views/controls/button/button_dropdown.h" | 36 #include "views/controls/button/button_dropdown.h" |
| 37 #include "views/focus/view_storage.h" | 37 #include "views/focus/view_storage.h" |
| 38 #include "views/widget/tooltip_manager.h" | 38 #include "views/widget/tooltip_manager.h" |
| 39 #include "views/window/non_client_view.h" | 39 #include "views/window/non_client_view.h" |
| 40 | 40 |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "chrome/browser/enumerate_modules_model_win.h" | 42 #include "chrome/browser/enumerate_modules_model_win.h" |
| 43 #if !defined(USE_AURA) |
| 43 #include "chrome/browser/ui/views/app_menu_button_win.h" | 44 #include "chrome/browser/ui/views/app_menu_button_win.h" |
| 44 #endif | 45 #endif |
| 46 #endif |
| 45 | 47 |
| 46 // static | 48 // static |
| 47 char ToolbarView::kViewClassName[] = "browser/ui/views/ToolbarView"; | 49 char ToolbarView::kViewClassName[] = "browser/ui/views/ToolbarView"; |
| 48 // The space between items is 4 px in general. | 50 // The space between items is 4 px in general. |
| 49 const int ToolbarView::kStandardSpacing = 4; | 51 const int ToolbarView::kStandardSpacing = 4; |
| 50 // The top of the toolbar has an edge we have to skip over in addition to the 4 | 52 // The top of the toolbar has an edge we have to skip over in addition to the 4 |
| 51 // px of spacing. | 53 // px of spacing. |
| 52 const int ToolbarView::kVertSpacing = kStandardSpacing + 1; | 54 const int ToolbarView::kVertSpacing = kStandardSpacing + 1; |
| 53 // The edge graphics have some built-in spacing/shadowing, so we have to adjust | 55 // The edge graphics have some built-in spacing/shadowing, so we have to adjust |
| 54 // our spacing to make it still appear to be 4 px. | 56 // our spacing to make it still appear to be 4 px. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 home_->set_triggerable_event_flags(ui::EF_LEFT_BUTTON_DOWN | | 162 home_->set_triggerable_event_flags(ui::EF_LEFT_BUTTON_DOWN | |
| 161 ui::EF_MIDDLE_BUTTON_DOWN); | 163 ui::EF_MIDDLE_BUTTON_DOWN); |
| 162 home_->set_tag(IDC_HOME); | 164 home_->set_tag(IDC_HOME); |
| 163 home_->SetTooltipText( | 165 home_->SetTooltipText( |
| 164 UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_HOME))); | 166 UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_HOME))); |
| 165 home_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME)); | 167 home_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME)); |
| 166 home_->set_id(VIEW_ID_HOME_BUTTON); | 168 home_->set_id(VIEW_ID_HOME_BUTTON); |
| 167 | 169 |
| 168 browser_actions_ = new BrowserActionsContainer(browser_, this); | 170 browser_actions_ = new BrowserActionsContainer(browser_, this); |
| 169 | 171 |
| 170 #if defined(OS_WIN) | 172 #if defined(OS_WIN) && !defined(USE_AURA) |
| 171 app_menu_ = new AppMenuButtonWin(this); | 173 app_menu_ = new AppMenuButtonWin(this); |
| 172 #else | 174 #else |
| 173 app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false); | 175 app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false); |
| 174 #endif | 176 #endif |
| 175 app_menu_->set_border(NULL); | 177 app_menu_->set_border(NULL); |
| 176 app_menu_->EnableCanvasFlippingForRTLUI(true); | 178 app_menu_->EnableCanvasFlippingForRTLUI(true); |
| 177 app_menu_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)); | 179 app_menu_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)); |
| 178 app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16( | 180 app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16( |
| 179 IDS_APPMENU_TOOLTIP, | 181 IDS_APPMENU_TOOLTIP, |
| 180 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); | 182 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 690 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 691 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 690 } | 692 } |
| 691 | 693 |
| 692 void ToolbarView::UpdateAppMenuBadge() { | 694 void ToolbarView::UpdateAppMenuBadge() { |
| 693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 695 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
| 694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 696 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 697 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 696 SchedulePaint(); | 698 SchedulePaint(); |
| 697 } | 699 } |
| OLD | NEW |