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

Side by Side Diff: ui/views/style/platform_style_mac.mm

Issue 2607923002: MacViews: Handle Space and Return keys correctly for Buttons. (Closed)
Patch Set: -- Created 3 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/views/style/platform_style.h" 5 #include "ui/views/style/platform_style.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/base/ui_features.h" 9 #include "ui/base/ui_features.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // On Mac, the Cocoa browser window does not flip its UI in RTL (e.g. bookmark 31 // On Mac, the Cocoa browser window does not flip its UI in RTL (e.g. bookmark
32 // star remains on the right, padlock on the left). So bubbles should open in 32 // star remains on the right, padlock on the left). So bubbles should open in
33 // the same direction as in LTR by default, unless the entire browser is views. 33 // the same direction as in LTR by default, unless the entire browser is views.
34 const bool PlatformStyle::kMirrorBubbleArrowInRTLByDefault = 34 const bool PlatformStyle::kMirrorBubbleArrowInRTLByDefault =
35 BUILDFLAG(MAC_VIEWS_BROWSER); 35 BUILDFLAG(MAC_VIEWS_BROWSER);
36 36
37 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction = 37 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction =
38 CustomButton::NOTIFY_ON_PRESS; 38 CustomButton::NOTIFY_ON_PRESS;
39 39
40 const CustomButton::ButtonAction PlatformStyle::kButtonActionOnSpace =
41 CustomButton::ACTION_CLICK;
42
43 // On Mac, the Return Key is used to perform the default action even when a
44 // control is focused.
45 const bool PlatformStyle::kClickControlOnReturn = false;
46
40 // static 47 // static
41 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, 48 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled,
42 Combobox::Style style) { 49 Combobox::Style style) {
43 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't 50 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't
44 // look right on Mac. See https://crbug.com/384071. 51 // look right on Mac. See https://crbug.com/384071.
45 if (style == Combobox::STYLE_ACTION) { 52 if (style == Combobox::STYLE_ACTION) {
46 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 53 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
47 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); 54 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
48 } 55 }
49 const int kComboboxArrowWidth = 24; 56 const int kComboboxArrowWidth = 24;
(...skipping 28 matching lines...) Expand all
78 ButtonColorByState& colors = *color_by_state; 85 ButtonColorByState& colors = *color_by_state;
79 colors[Button::STATE_PRESSED] = SK_ColorWHITE; 86 colors[Button::STATE_PRESSED] = SK_ColorWHITE;
80 } 87 }
81 88
82 // static 89 // static
83 void PlatformStyle::OnTextfieldEditFailed() { 90 void PlatformStyle::OnTextfieldEditFailed() {
84 NSBeep(); 91 NSBeep();
85 } 92 }
86 93
87 } // namespace views 94 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698