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

Unified Diff: chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc

Issue 11415124: Add keyboard overlay help for the Search key as a Function key extended keyboard shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 1 month 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
Index: chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
index 9772125bbd09070f5ba54fd5718e709c4c013b2e..df5f232d4d4abe2c1a4343df3288460e6672232d 100644
--- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -15,6 +16,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -62,6 +64,8 @@ struct I18nContentToMessage {
{ "keyboardOverlayLearnMore", IDS_KEYBOARD_OVERLAY_LEARN_MORE },
{ "keyboardOverlayTitle", IDS_KEYBOARD_OVERLAY_TITLE },
{ "keyboardOverlayInstructions", IDS_KEYBOARD_OVERLAY_INSTRUCTIONS },
+ { "keyboardOverlayInstructionsWithSearch",
+ IDS_KEYBOARD_OVERLAY_INSTRUCTIONS_WITH_SEARCH },
{ "keyboardOverlayInstructionsHide", IDS_KEYBOARD_OVERLAY_INSTRUCTIONS_HIDE },
{ "keyboardOverlayActivateLastLauncherItem",
IDS_KEYBOARD_OVERLAY_ACTIVATE_LAST_LAUNCHER_ITEM },
@@ -118,6 +122,18 @@ struct I18nContentToMessage {
{ "keyboardOverlayDomInspector", IDS_KEYBOARD_OVERLAY_DOM_INSPECTOR },
{ "keyboardOverlayDownloads", IDS_KEYBOARD_OVERLAY_DOWNLOADS },
{ "keyboardOverlayEnd", IDS_KEYBOARD_OVERLAY_END },
+ { "keyboardOverlayF1", IDS_KEYBOARD_OVERLAY_F1 },
mazda 2012/11/28 05:25:18 Please move these above "keyboardOverlayActivateLa
danakj 2012/11/28 21:11:24 Done.
+ { "keyboardOverlayF2", IDS_KEYBOARD_OVERLAY_F2 },
+ { "keyboardOverlayF3", IDS_KEYBOARD_OVERLAY_F3 },
+ { "keyboardOverlayF4", IDS_KEYBOARD_OVERLAY_F4 },
+ { "keyboardOverlayF5", IDS_KEYBOARD_OVERLAY_F5 },
+ { "keyboardOverlayF6", IDS_KEYBOARD_OVERLAY_F6 },
+ { "keyboardOverlayF7", IDS_KEYBOARD_OVERLAY_F7 },
+ { "keyboardOverlayF8", IDS_KEYBOARD_OVERLAY_F8 },
+ { "keyboardOverlayF9", IDS_KEYBOARD_OVERLAY_F9 },
+ { "keyboardOverlayF10", IDS_KEYBOARD_OVERLAY_F10 },
+ { "keyboardOverlayF11", IDS_KEYBOARD_OVERLAY_F11 },
+ { "keyboardOverlayF12", IDS_KEYBOARD_OVERLAY_F12 },
{ "keyboardOverlayFindPreviousText",
IDS_KEYBOARD_OVERLAY_FIND_PREVIOUS_TEXT },
{ "keyboardOverlayFindText", IDS_KEYBOARD_OVERLAY_FIND_TEXT },
@@ -222,7 +238,8 @@ std::string ModifierKeyToLabel(ModifierKey modifier) {
return "";
}
-ChromeWebUIDataSource* CreateKeyboardOverlayUIHTMLSource() {
+ChromeWebUIDataSource* CreateKeyboardOverlayUIHTMLSource(
+ bool search_key_acts_as_function_key) {
ChromeWebUIDataSource* source =
new ChromeWebUIDataSource(chrome::kChromeUIKeyboardOverlayHost);
@@ -232,6 +249,8 @@ ChromeWebUIDataSource* CreateKeyboardOverlayUIHTMLSource() {
}
source->AddString("keyboardOverlayLearnMoreURL", UTF8ToUTF16(kLearnMoreURL));
+ source->AddString("keyboardSearchKeyActsAsFunctionKey",
+ search_key_acts_as_function_key ? "true" : "false");
source->set_json_path("strings.js");
source->set_use_json_js_format_v2();
source->add_resource_path("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS);
@@ -347,7 +366,14 @@ KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui)
KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile);
web_ui->AddMessageHandler(handler);
+ PrefService* pref_service = profile->GetPrefs();
+ bool chromebook_function_key = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableChromebookFunctionKey);
+
+ bool search_key_acts_as_function_key = chromebook_function_key &&
+ pref_service->GetBoolean(prefs::kLanguageSearchKeyActsAsFunctionKey);
+
// Set up the chrome://keyboardoverlay/ source.
ChromeURLDataManager::AddDataSource(profile,
- CreateKeyboardOverlayUIHTMLSource());
+ CreateKeyboardOverlayUIHTMLSource(search_key_acts_as_function_key));
}

Powered by Google App Engine
This is Rietveld 408576698