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

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: forlanding 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
« no previous file with comments | « chrome/browser/resources/chromeos/keyboard_overlay.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ec58e7c84bb35a5a81550633d51ba8d614fbfcb6 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"
@@ -61,7 +63,21 @@ struct I18nContentToMessage {
} kI18nContentToMessage[] = {
{ "keyboardOverlayLearnMore", IDS_KEYBOARD_OVERLAY_LEARN_MORE },
{ "keyboardOverlayTitle", IDS_KEYBOARD_OVERLAY_TITLE },
+ { "keyboardOverlayF1", IDS_KEYBOARD_OVERLAY_F1 },
+ { "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 },
{ "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 },
@@ -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,17 @@ 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 chromeos_keyboard = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kHasChromeOSKeyboard);
+
+ bool search_key_acts_as_function_key = chromeos_keyboard &&
+ 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));
}
« no previous file with comments | « chrome/browser/resources/chromeos/keyboard_overlay.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698