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/action_box_menu.h" | 5 #include "chrome/browser/ui/views/action_box_menu.h" |
6 | 6 |
7 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" | 7 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" |
8 #include "chrome/browser/ui/views/browser_action_view.h" | 8 #include "chrome/browser/ui/views/browser_action_view.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/views/bubble/bubble_border.h" | 13 #include "ui/views/bubble/bubble_border.h" |
14 #include "ui/views/controls/button/menu_button.h" | 14 #include "ui/views/controls/button/menu_button.h" |
15 #include "ui/views/controls/menu/menu_runner.h" | 15 #include "ui/views/controls/menu/menu_runner.h" |
16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) && !defined(USE_AURA) |
19 // Included for MENU_POPUPITEM and a few other Windows specific constants. | 19 // Included for MENU_POPUPITEM and a few other Windows specific constants. |
20 #include <vssym32.h> | 20 #include <vssym32.h> |
21 #include "ui/base/native_theme/native_theme_win.h" | 21 #include "ui/base/native_theme/native_theme_win.h" |
22 #endif | 22 #endif |
23 | 23 |
24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
25 // ActionBoxMenu | 25 // ActionBoxMenu |
26 | 26 |
27 ActionBoxMenu::ActionBoxMenu(Browser* browser, | 27 ActionBoxMenu::ActionBoxMenu(Browser* browser, |
28 ActionBoxMenuModel* model, | 28 ActionBoxMenuModel* model, |
(...skipping 26 matching lines...) Expand all Loading... |
55 views::MenuItemView::TOPRIGHT, | 55 views::MenuItemView::TOPRIGHT, |
56 views::MenuRunner::HAS_MNEMONICS)); | 56 views::MenuRunner::HAS_MNEMONICS)); |
57 } | 57 } |
58 | 58 |
59 void ActionBoxMenu::ExecuteCommand(int id) { | 59 void ActionBoxMenu::ExecuteCommand(int id) { |
60 }; | 60 }; |
61 | 61 |
62 views::Border* ActionBoxMenu::CreateMenuBorder() { | 62 views::Border* ActionBoxMenu::CreateMenuBorder() { |
63 // TODO(yefim): Use correct theme color on non-Windows. | 63 // TODO(yefim): Use correct theme color on non-Windows. |
64 SkColor border_color = SK_ColorBLACK; | 64 SkColor border_color = SK_ColorBLACK; |
65 #if defined(OS_WIN) | 65 #if defined(OS_WIN) && !defined(USE_AURA) |
66 // TODO(yefim): Move to Windows only files if possible. | 66 // TODO(yefim): Move to Windows only files if possible. |
67 border_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( | 67 border_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( |
68 ui::NativeThemeWin::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, | 68 ui::NativeThemeWin::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, |
69 COLOR_MENUTEXT); | 69 COLOR_MENUTEXT); |
70 #endif | 70 #endif |
71 return views::Border::CreateSolidBorder(1, border_color); | 71 return views::Border::CreateSolidBorder(1, border_color); |
72 } | 72 } |
73 | 73 |
74 views::Background* ActionBoxMenu::CreateMenuBackground() { | 74 views::Background* ActionBoxMenu::CreateMenuBackground() { |
75 // TODO(yefim): Use correct theme color on non-Windows. | 75 // TODO(yefim): Use correct theme color on non-Windows. |
76 SkColor background_color = SK_ColorWHITE; | 76 SkColor background_color = SK_ColorWHITE; |
77 #if defined(OS_WIN) | 77 #if defined(OS_WIN) && !defined(USE_AURA) |
78 // TODO(yefim): Move to Windows only files if possible. | 78 // TODO(yefim): Move to Windows only files if possible. |
79 background_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( | 79 background_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( |
80 ui::NativeThemeWin::TEXTFIELD, EP_BACKGROUND, EBS_NORMAL, | 80 ui::NativeThemeWin::TEXTFIELD, EP_BACKGROUND, EBS_NORMAL, |
81 TMT_BACKGROUND, COLOR_WINDOW); | 81 TMT_BACKGROUND, COLOR_WINDOW); |
82 #endif | 82 #endif |
83 return views::Background::CreateSolidBackground(background_color); | 83 return views::Background::CreateSolidBackground(background_color); |
84 } | 84 } |
85 | 85 |
86 int ActionBoxMenu::GetCurrentTabId() const { | 86 int ActionBoxMenu::GetCurrentTabId() const { |
87 return 0; | 87 return 0; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 string16 label = l10n_util::GetStringUTF16(starred_ ? | 154 string16 label = l10n_util::GetStringUTF16(starred_ ? |
155 IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR); | 155 IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR); |
156 gfx::ImageSkia* icon = | 156 gfx::ImageSkia* icon = |
157 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 157 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
158 starred_ ? IDR_STAR_LIT : IDR_STAR); | 158 starred_ ? IDR_STAR_LIT : IDR_STAR); |
159 views::MenuItemView* item = | 159 views::MenuItemView* item = |
160 parent->AppendMenuItemWithIcon(*item_id, label, *icon); | 160 parent->AppendMenuItemWithIcon(*item_id, label, *icon); |
161 (*item_id)++; | 161 (*item_id)++; |
162 return item; | 162 return item; |
163 } | 163 } |
OLD | NEW |