Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 7237032: Changes wrench menu button to show system menu on space. This matches (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak comment Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/app_menu_button_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
33 #include "ui/gfx/canvas_skia.h" 33 #include "ui/gfx/canvas_skia.h"
34 #include "ui/gfx/skbitmap_operations.h" 34 #include "ui/gfx/skbitmap_operations.h"
35 #include "views/controls/button/button_dropdown.h" 35 #include "views/controls/button/button_dropdown.h"
36 #include "views/focus/view_storage.h" 36 #include "views/focus/view_storage.h"
37 #include "views/widget/tooltip_manager.h" 37 #include "views/widget/tooltip_manager.h"
38 #include "views/window/non_client_view.h" 38 #include "views/window/non_client_view.h"
39 39
40 #if defined(OS_WIN) 40 #if defined(OS_WIN)
41 #include "chrome/browser/enumerate_modules_model_win.h" 41 #include "chrome/browser/enumerate_modules_model_win.h"
42 #include "chrome/browser/ui/views/app_menu_button_win.h"
42 #endif 43 #endif
43 44
44 // static 45 // static
45 char ToolbarView::kViewClassName[] = "browser/ui/views/ToolbarView"; 46 char ToolbarView::kViewClassName[] = "browser/ui/views/ToolbarView";
46 // The space between items is 4 px in general. 47 // The space between items is 4 px in general.
47 const int ToolbarView::kStandardSpacing = 4; 48 const int ToolbarView::kStandardSpacing = 4;
48 // The top of the toolbar has an edge we have to skip over in addition to the 4 49 // The top of the toolbar has an edge we have to skip over in addition to the 4
49 // px of spacing. 50 // px of spacing.
50 const int ToolbarView::kVertSpacing = kStandardSpacing + 1; 51 const int ToolbarView::kVertSpacing = kStandardSpacing + 1;
51 // The edge graphics have some built-in spacing/shadowing, so we have to adjust 52 // The edge graphics have some built-in spacing/shadowing, so we have to adjust
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 home_->set_triggerable_event_flags(ui::EF_LEFT_BUTTON_DOWN | 159 home_->set_triggerable_event_flags(ui::EF_LEFT_BUTTON_DOWN |
159 ui::EF_MIDDLE_BUTTON_DOWN); 160 ui::EF_MIDDLE_BUTTON_DOWN);
160 home_->set_tag(IDC_HOME); 161 home_->set_tag(IDC_HOME);
161 home_->SetTooltipText( 162 home_->SetTooltipText(
162 UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_HOME))); 163 UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_HOME)));
163 home_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME)); 164 home_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME));
164 home_->set_id(VIEW_ID_HOME_BUTTON); 165 home_->set_id(VIEW_ID_HOME_BUTTON);
165 166
166 browser_actions_ = new BrowserActionsContainer(browser_, this); 167 browser_actions_ = new BrowserActionsContainer(browser_, this);
167 168
169 #if defined(OS_WIN)
170 app_menu_ = new AppMenuButtonWin(this);
171 #else
168 app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false); 172 app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
173 #endif
169 app_menu_->set_border(NULL); 174 app_menu_->set_border(NULL);
170 app_menu_->EnableCanvasFlippingForRTLUI(true); 175 app_menu_->EnableCanvasFlippingForRTLUI(true);
171 app_menu_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)); 176 app_menu_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_APP));
172 app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16( 177 app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16(
173 IDS_APPMENU_TOOLTIP, 178 IDS_APPMENU_TOOLTIP,
174 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); 179 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
175 app_menu_->set_id(VIEW_ID_APP_MENU); 180 app_menu_->set_id(VIEW_ID_APP_MENU);
176 181
177 // Add any necessary badges to the menu item based on the system state. 182 // Add any necessary badges to the menu item based on the system state.
178 if (IsUpgradeRecommended() || ShouldShowIncompatibilityWarning()) { 183 if (IsUpgradeRecommended() || ShouldShowIncompatibilityWarning()) {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 693 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 694 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
690 } 695 }
691 696
692 void ToolbarView::UpdateAppMenuBadge() { 697 void ToolbarView::UpdateAppMenuBadge() {
693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 698 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 699 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 700 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
696 SchedulePaint(); 701 SchedulePaint();
697 } 702 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/app_menu_button_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698