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

Side by Side Diff: ui/views/window/dialog_client_view.cc

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix FocusManagerTest.StoreFocusedView Created 4 years, 10 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
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | 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) 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 "ui/views/window/dialog_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
11 #include "ui/views/background.h" 11 #include "ui/views/background.h"
12 #include "ui/views/controls/button/blue_button.h" 12 #include "ui/views/controls/button/blue_button.h"
13 #include "ui/views/controls/button/label_button.h" 13 #include "ui/views/controls/button/label_button.h"
14 #include "ui/views/layout/layout_constants.h" 14 #include "ui/views/layout/layout_constants.h"
15 #include "ui/views/style/platform_style.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
16 #include "ui/views/window/dialog_delegate.h" 17 #include "ui/views/window/dialog_delegate.h"
17 18
18 namespace views { 19 namespace views {
19 20
20 namespace { 21 namespace {
21 22
22 // The group used by the buttons. This name is chosen voluntarily big not to 23 // The group used by the buttons. This name is chosen voluntarily big not to
23 // conflict with other groups that could be in the dialog content. 24 // conflict with other groups that could be in the dialog content.
24 const int kButtonGroup = 6666; 25 const int kButtonGroup = 6666;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); 337 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type);
337 LabelButton* button = NULL; 338 LabelButton* button = NULL;
338 if (GetDialogDelegate()->UseNewStyleForThisDialog() && 339 if (GetDialogDelegate()->UseNewStyleForThisDialog() &&
339 GetDialogDelegate()->GetDefaultDialogButton() == type && 340 GetDialogDelegate()->GetDefaultDialogButton() == type &&
340 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { 341 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) {
341 button = new BlueButton(this, title); 342 button = new BlueButton(this, title);
342 } else { 343 } else {
343 button = new LabelButton(this, title); 344 button = new LabelButton(this, title);
344 button->SetStyle(Button::STYLE_BUTTON); 345 button->SetStyle(Button::STYLE_BUTTON);
345 } 346 }
346 button->SetFocusable(true);
347 347
348 PlatformStyle::SetControlStyleFocus(button);
348 const int kDialogMinButtonWidth = 75; 349 const int kDialogMinButtonWidth = 75;
349 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); 350 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0));
350 button->SetGroup(kButtonGroup); 351 button->SetGroup(kButtonGroup);
351 return button; 352 return button;
352 } 353 }
353 354
354 void DialogClientView::UpdateButton(LabelButton* button, 355 void DialogClientView::UpdateButton(LabelButton* button,
355 ui::DialogButton type) { 356 ui::DialogButton type) {
356 DialogDelegate* dialog = GetDialogDelegate(); 357 DialogDelegate* dialog = GetDialogDelegate();
357 button->SetText(dialog->GetDialogButtonLabel(type)); 358 button->SetText(dialog->GetDialogButtonLabel(type));
(...skipping 16 matching lines...) Expand all
374 gfx::Insets(0, kButtonHEdgeMarginNew, 375 gfx::Insets(0, kButtonHEdgeMarginNew,
375 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew); 376 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew);
376 } 377 }
377 378
378 void DialogClientView::Close() { 379 void DialogClientView::Close() {
379 GetWidget()->Close(); 380 GetWidget()->Close();
380 GetDialogDelegate()->OnClosed(); 381 GetDialogDelegate()->OnClosed();
381 } 382 }
382 383
383 } // namespace views 384 } // namespace views
OLDNEW
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698