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

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

Issue 113612: Make views/ use strings from app_strings. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | « views/views.vsprops ('k') | views/window/window_win.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "views/window/dialog_client_view.h" 5 #include "views/window/dialog_client_view.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 10
11 #include "app/gfx/canvas.h" 11 #include "app/gfx/canvas.h"
12 #include "app/gfx/font.h" 12 #include "app/gfx/font.h"
13 #include "app/l10n_util.h" 13 #include "app/l10n_util.h"
14 #include "app/resource_bundle.h" 14 #include "app/resource_bundle.h"
15 #include "base/gfx/native_theme.h" 15 #include "base/gfx/native_theme.h"
16 #include "grit/generated_resources.h" 16 #include "grit/app_strings.h"
17 #include "views/controls/button/native_button.h" 17 #include "views/controls/button/native_button.h"
18 #include "views/standard_layout.h" 18 #include "views/standard_layout.h"
19 #include "views/window/dialog_delegate.h" 19 #include "views/window/dialog_delegate.h"
20 #include "views/window/window.h" 20 #include "views/window/window.h"
21 21
22 namespace views { 22 namespace views {
23 23
24 namespace { 24 namespace {
25 25
26 // Updates any of the standard buttons according to the delegate. 26 // Updates any of the standard buttons according to the delegate.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DialogClientView::~DialogClientView() { 102 DialogClientView::~DialogClientView() {
103 } 103 }
104 104
105 void DialogClientView::ShowDialogButtons() { 105 void DialogClientView::ShowDialogButtons() {
106 DialogDelegate* dd = GetDialogDelegate(); 106 DialogDelegate* dd = GetDialogDelegate();
107 int buttons = dd->GetDialogButtons(); 107 int buttons = dd->GetDialogButtons();
108 if (buttons & MessageBoxFlags::DIALOGBUTTON_OK && !ok_button_) { 108 if (buttons & MessageBoxFlags::DIALOGBUTTON_OK && !ok_button_) {
109 std::wstring label = 109 std::wstring label =
110 dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_OK); 110 dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_OK);
111 if (label.empty()) 111 if (label.empty())
112 label = l10n_util::GetString(IDS_OK); 112 label = l10n_util::GetString(IDS_APP_OK);
113 bool is_default_button = 113 bool is_default_button =
114 (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_OK) != 0; 114 (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_OK) != 0;
115 ok_button_ = new DialogButton(this, window(), 115 ok_button_ = new DialogButton(this, window(),
116 MessageBoxFlags::DIALOGBUTTON_OK, label, 116 MessageBoxFlags::DIALOGBUTTON_OK, label,
117 is_default_button); 117 is_default_button);
118 ok_button_->SetGroup(kButtonGroup); 118 ok_button_->SetGroup(kButtonGroup);
119 if (is_default_button) 119 if (is_default_button)
120 default_button_ = ok_button_; 120 default_button_ = ok_button_;
121 if (!(buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL)) 121 if (!(buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL))
122 ok_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false)); 122 ok_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false));
123 AddChildView(ok_button_); 123 AddChildView(ok_button_);
124 } 124 }
125 if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL && !cancel_button_) { 125 if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL && !cancel_button_) {
126 std::wstring label = 126 std::wstring label =
127 dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_CANCEL); 127 dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_CANCEL);
128 if (label.empty()) { 128 if (label.empty()) {
129 if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) { 129 if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) {
130 label = l10n_util::GetString(IDS_CANCEL); 130 label = l10n_util::GetString(IDS_APP_CANCEL);
131 } else { 131 } else {
132 label = l10n_util::GetString(IDS_CLOSE); 132 label = l10n_util::GetString(IDS_APP_CLOSE);
133 } 133 }
134 } 134 }
135 bool is_default_button = 135 bool is_default_button =
136 (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_CANCEL) 136 (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_CANCEL)
137 != 0; 137 != 0;
138 cancel_button_ = new DialogButton(this, window(), 138 cancel_button_ = new DialogButton(this, window(),
139 MessageBoxFlags::DIALOGBUTTON_CANCEL, 139 MessageBoxFlags::DIALOGBUTTON_CANCEL,
140 label, is_default_button); 140 label, is_default_button);
141 cancel_button_->SetGroup(kButtonGroup); 141 cancel_button_->SetGroup(kButtonGroup);
142 cancel_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false)); 142 cancel_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false));
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 initialized = true; 458 initialized = true;
459 } 459 }
460 } 460 }
461 461
462 void DialogClientView::Close() { 462 void DialogClientView::Close() {
463 window()->Close(); 463 window()->Close();
464 GetDialogDelegate()->OnClose(); 464 GetDialogDelegate()->OnClose();
465 } 465 }
466 466
467 } // namespace views 467 } // namespace views
OLDNEW
« no previous file with comments | « views/views.vsprops ('k') | views/window/window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698