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

Unified Diff: chrome/browser/ui/views/new_back_shortcut_bubble.cc

Issue 2540523003: Use standardized accelerator-to-shortcut code for new backspace shortcut UI. (Closed)
Patch Set: Remove refactoring Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/new_back_shortcut_bubble.cc
diff --git a/chrome/browser/ui/views/new_back_shortcut_bubble.cc b/chrome/browser/ui/views/new_back_shortcut_bubble.cc
index 21a62386cd9929edb22c869ebb05ce37e440ecf2..4c5528cee1e812c0824923b8fa504773b65bc252 100644
--- a/chrome/browser/ui/views/new_back_shortcut_bubble.cc
+++ b/chrome/browser/ui/views/new_back_shortcut_bubble.cc
@@ -10,6 +10,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
#include "chrome/browser/ui/views/subtle_notification_view.h"
#include "chrome/grit/generated_resources.h"
@@ -55,23 +56,16 @@ bool NewBackShortcutBubble::IsVisible() const {
}
void NewBackShortcutBubble::UpdateContent(bool forward) {
- // Note: The key names are parameters so that we can vary by operating system
- // or change the direction of the arrow as necessary (see
- // https://crbug.com/612685).
-
-#if defined(OS_MACOSX)
- // U+2318 = PLACE OF INTEREST SIGN (Mac Command symbol).
- base::string16 accelerator = base::WideToUTF16(L"\x2318");
-#else
- base::string16 accelerator = l10n_util::GetStringUTF16(IDS_APP_ALT_KEY);
-#endif
-
- int message_id = forward ? IDS_PRESS_ALT_RIGHT_TO_GO_FORWARD
- : IDS_PRESS_ALT_LEFT_TO_GO_BACK;
- // U+2192 = RIGHTWARDS ARROW; U+2190 = LEFTWARDS ARROW.
- base::string16 arrow_key = base::WideToUTF16(forward ? L"\x2192" : L"\x2190");
+ const int command_id = forward ? IDC_FORWARD : IDC_BACK;
+ ui::Accelerator accelerator;
+ const bool got_accelerator =
+ bubble_view_context_->GetAcceleratorProvider()
+ ->GetAcceleratorForCommandId(command_id, &accelerator);
+ DCHECK(got_accelerator);
+ const int message_id = forward ? IDS_PRESS_SHORTCUT_TO_GO_FORWARD
+ : IDS_PRESS_SHORTCUT_TO_GO_BACK;
view_->UpdateContent(
- l10n_util::GetStringFUTF16(message_id, accelerator, arrow_key),
+ l10n_util::GetStringFUTF16(message_id, accelerator.GetShortcutText()),
base::string16());
view_->SetSize(GetPopupRect(true).size());
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698