Commit 6cd9455e authored by csilv@chromium.org's avatar csilv@chromium.org

dom-ui settings: enable languages & spell checker settings for all platforms.

BUG=56415,43716
TEST=Verify language & settings panel functionality on dom-ui settings window.
Review URL: http://codereview.chromium.org/6296017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72085 0039d316-1c4b-4281-b951-d872f2087c98
parent c247cab7
...@@ -6360,6 +6360,69 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -6360,6 +6360,69 @@ Keep your key file in a safe place. You will need it to create new versions of y
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</message> </message>
<!-- Language & spell-checker settings -->
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_DIALOG_TITLE">
Languages and Input
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES" desc="The label for the list of languages">
Languages
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_BUTTON"
desc="The label for the add button for adding a language">
Add
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON"
desc="The label for the remove button for removing a language">
Remove
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_INSTRUCTIONS"
desc="Explanatory message about how to add and order languages">
Add languages and drag to order them based on your preference.
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_PLEASE_ADD_ANOTHER_LANGUAGE"
desc="Warning invoked when the user tries to remove the last language">
Please add another language before removing this one.
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_CANNOT_BE_DISPLAYED_IN_THIS_LANGUAGE"
desc="The label for a language that cannot be used for UI">
<ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> cannot be displayed in this language
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE"
desc="The label for a language that is currently used for UI">
<ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> is displayed in this language
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE"
desc="The label is used for a button that changes the UI
language of Chrome OS">
Display <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> in this language
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_THIS_LANGUAGE_IS_CURRENTLY_IN_USE"
desc="Warning invoked when the user tries to remove the language used for displaying Chrome OS">
This language is currently in use for displaying <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph>.
</message>
<message name="IDS_OPTIONS_SETTINGS_USE_THIS_FOR_SPELL_CHECKING"
desc="The label for a language a button that changes the spell check language of Chrome OS">
Use this language for spell checking
</message>
<message name="IDS_OPTIONS_SETTINGS_CANNOT_BE_USED_FOR_SPELL_CHECKING"
desc="The label for a language that cannot be used for spell checking">
This language cannot be used for spell checking
</message>
<message name="IDS_OPTIONS_SETTINGS_IS_USED_FOR_SPELL_CHECKING"
desc="The label for a language that is currently used for spell checking">
This language is used for spell checking
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_RESTART_BUTTON"
desc="The label for the restart button for changing UI language">
Restart
</message>
<message name="IDS_OPTIONS_LANGUAGES_ADD_TITLE" desc="The title for the add language dialog.">
Add language:
</message>
<message name="IDS_OPTIONS_LANGUAGES_ADD_SELECT_LABEL" desc="The label for the add language select control.">
Language:
</message>
<!-- HTTP POST Warning --> <!-- HTTP POST Warning -->
<message name="IDS_HTTP_POST_WARNING_TITLE" desc="Title for dialog that warns users about a navigation that results in a repost"> <message name="IDS_HTTP_POST_WARNING_TITLE" desc="Title for dialog that warns users about a navigation that results in a repost">
Confirm Form Resubmission Confirm Form Resubmission
...@@ -7782,15 +7845,18 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -7782,15 +7845,18 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM" desc="The label of the 'Custom' option"> <message name="IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM" desc="The label of the 'Custom' option">
Custom Custom
</message> </message>
<message name="IDS_OPTIONS_LANGUAGE_AND_SPELLCHECK_BUTTON" desc="Button title for invoking the 'Languages and Spell-checker' panel.">
Languages and Spell-checker settings
</message>
<message name="IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE" desc="The documentation string of the 'Spell check dictionary language' preference"> <message name="IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE" desc="The documentation string of the 'Spell check dictionary language' preference">
Spell-checker language: Spell-checker language:
</message> </message>
<message name="IDS_OPTIONS_ENABLE_SPELLCHECK" desc="The documentation string of the 'Enable spellcheck' option"> <message name="IDS_OPTIONS_ENABLE_SPELLCHECK" desc="The documentation string of the 'Enable spellcheck' option">
Check spelling: Enable spell checking
</message> </message>
<message name="IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION" desc="The documentation string of the 'Enable auto spell correction' option"> <message name="IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION" desc="The documentation string of the 'Enable auto spell correction' option">
Correct spelling automatically: Enable automatic spell correction
</message> </message>
<!-- TODO(kmadhusu): Remove "IDS_OPTIONS_RESET", "IDS_OPTIONS_RESET_OKLABEL", "IDS_OPTIONS_RESET_CANCELLABEL" after platform-specific dialogs are removed.--> <!-- TODO(kmadhusu): Remove "IDS_OPTIONS_RESET", "IDS_OPTIONS_RESET_OKLABEL", "IDS_OPTIONS_RESET_CANCELLABEL" after platform-specific dialogs are removed.-->
...@@ -9552,12 +9618,7 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -9552,12 +9618,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE" desc="In settings system options, the label for the customize button for modifier keys"> <message name="IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE" desc="In settings system options, the label for the customize button for modifier keys">
Modifier keys... Modifier keys...
</message> </message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_DIALOG_TITLE">
Languages and Input
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES" desc="The label for the list of languages">
Languages
</message>
<message name="IDS_EULA_BACK_BUTTON" desc="Back button shown on EULA screen."> <message name="IDS_EULA_BACK_BUTTON" desc="Back button shown on EULA screen.">
« Back « Back
</message> </message>
...@@ -10070,18 +10131,6 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -10070,18 +10131,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
desc="The label for the section header for input methods"> desc="The label for the section header for input methods">
Input Method Input Method
</message> </message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX"
desc="The label for the add language combobox">
Add language
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_BUTTON"
desc="The label for the add button for adding a language">
Add
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON"
desc="The label for the remove button for removing a language">
Remove
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_SIGN_OUT_BUTTON" <message name="IDS_OPTIONS_SETTINGS_LANGUAGES_SIGN_OUT_BUTTON"
desc="The label for the sign out button for changing UI language"> desc="The label for the sign out button for changing UI language">
Sign out Sign out
...@@ -10090,18 +10139,6 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -10090,18 +10139,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
desc="Warning invoked when the user tries to remove the last input method"> desc="Warning invoked when the user tries to remove the last input method">
Please add another input method before removing this one. Please add another input method before removing this one.
</message> </message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_PLEASE_ADD_ANOTHER_LANGUAGE"
desc="Warning invoked when the user tries to remove the last language">
Please add another language before removing this one.
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_THIS_LANGUAGE_IS_CURRENTLY_IN_USE"
desc="Warning invoked when the user tries to remove the language used for displaying Chrome OS">
This language is currently in use for displaying <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph>.
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_INSTRUCTIONS"
desc="Explanatory message about how to add and order languages">
Add languages and drag to order them based on your preference.
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD_INSTRUCTIONS" <message name="IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD_INSTRUCTIONS"
desc="Explanatory message about how to select input methods"> desc="Explanatory message about how to select input methods">
For text input, select a language to see available input methods. For text input, select a language to see available input methods.
...@@ -10114,31 +10151,6 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -10114,31 +10151,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
desc="Explanatory message about how to select the previous input method"> desc="Explanatory message about how to select the previous input method">
Press <ph name="HOTKEY_NAME">$1<ex>ctrl-space</ex></ph> to select the previous input method. Press <ph name="HOTKEY_NAME">$1<ex>ctrl-space</ex></ph> to select the previous input method.
</message> </message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE"
desc="The label is used for a button that changes the UI
language of Chrome OS">
Display <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> in this language
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE"
desc="The label for a language that is currently used for UI">
<ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> is displayed in this language
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_CANNOT_BE_DISPLAYED_IN_THIS_LANGUAGE"
desc="The label for a language that cannot be used for UI">
<ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> cannot be displayed in this language
</message>
<message name="IDS_OPTIONS_SETTINGS_USE_THIS_FOR_SPELL_CHECKING"
desc="The label for a language a button that changes the spell check language of Chrome OS">
Use this language for spell checking
</message>
<message name="IDS_OPTIONS_SETTINGS_CANNOT_BE_USED_FOR_SPELL_CHECKING"
desc="The label for a language that cannot be used for spell checking">
This language cannot be used for spell checking
</message>
<message name="IDS_OPTIONS_SETTINGS_IS_USED_FOR_SPELL_CHECKING"
desc="The label for a language that is currently used for spell checking">
This language is used for spell checking
</message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD" <message name="IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD"
desc="The label for a input method"> desc="The label for a input method">
Standard input method Standard input method
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -140,6 +140,9 @@ void AdvancedOptionsHandler::GetLocalizedValues( ...@@ -140,6 +140,9 @@ void AdvancedOptionsHandler::GetLocalizedValues(
localized_strings->SetString("fontSettingsCustomizeFontsButton", localized_strings->SetString("fontSettingsCustomizeFontsButton",
l10n_util::GetStringUTF16( l10n_util::GetStringUTF16(
IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON)); IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON));
localized_strings->SetString("languageAndSpellCheckSettingsButton",
l10n_util::GetStringUTF16(
IDS_OPTIONS_LANGUAGE_AND_SPELLCHECK_BUTTON));
localized_strings->SetString("advancedSectionTitlePrivacy", localized_strings->SetString("advancedSectionTitlePrivacy",
dom_options_util::StripColon( dom_options_util::StripColon(
l10n_util::GetStringUTF16( l10n_util::GetStringUTF16(
......
...@@ -6,19 +6,16 @@ ...@@ -6,19 +6,16 @@
#define CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ #define CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_
#pragma once #pragma once
// TODO(csilv): This is for the move CL. Changes to make this cross-platform #include "chrome/browser/dom_ui/options/options_ui.h"
// will come in the followup CL.
#if defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/dom_ui/options/options_ui.h" #endif // defined(OS_CHROMEOS)
class DictionaryValue; class DictionaryValue;
class ListValue; class ListValue;
namespace chromeos { // Language options page UI handler.
// ChromeOS language options page UI handler.
class LanguageOptionsHandler : public OptionsPageUIHandler { class LanguageOptionsHandler : public OptionsPageUIHandler {
public: public:
LanguageOptionsHandler(); LanguageOptionsHandler();
...@@ -39,14 +36,21 @@ class LanguageOptionsHandler : public OptionsPageUIHandler { ...@@ -39,14 +36,21 @@ class LanguageOptionsHandler : public OptionsPageUIHandler {
// //
// Note that true in languageCodeSet does not mean anything. We just use // Note that true in languageCodeSet does not mean anything. We just use
// the dictionary as a set. // the dictionary as a set.
#if defined(OS_CHROMEOS)
static ListValue* GetInputMethodList( static ListValue* GetInputMethodList(
const InputMethodDescriptors& descriptors); const chromeos::InputMethodDescriptors& descriptors);
#endif // defined(OS_CHROMEOS)
// Gets the list of languages from the given input descriptors. // Gets the list of languages from the given input descriptors.
// The return value will look like: // The return value will look like:
// [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'},
// ...] // ...]
static ListValue* GetLanguageList(const InputMethodDescriptors& descriptors); #if defined(OS_CHROMEOS)
static ListValue* GetLanguageList(
const chromeos::InputMethodDescriptors& descriptors);
#else
static ListValue* GetLanguageList();
#endif // defined(OS_CHROMEOS)
// Gets the set of language codes that can be used as UI language. // Gets the set of language codes that can be used as UI language.
// The return value will look like: // The return value will look like:
...@@ -54,7 +58,7 @@ class LanguageOptionsHandler : public OptionsPageUIHandler { ...@@ -54,7 +58,7 @@ class LanguageOptionsHandler : public OptionsPageUIHandler {
// //
// Note that true in values does not mean anything. We just use the // Note that true in values does not mean anything. We just use the
// dictionary as a set. // dictionary as a set.
static DictionaryValue* GetUiLanguageCodeSet(); static DictionaryValue* GetUILanguageCodeSet();
// Gets the set of language codes that can be used for spellchecking. // Gets the set of language codes that can be used for spellchecking.
// The return value will look like: // The return value will look like:
...@@ -65,6 +69,7 @@ class LanguageOptionsHandler : public OptionsPageUIHandler { ...@@ -65,6 +69,7 @@ class LanguageOptionsHandler : public OptionsPageUIHandler {
static DictionaryValue* GetSpellCheckLanguageCodeSet(); static DictionaryValue* GetSpellCheckLanguageCodeSet();
private: private:
#if defined(OS_CHROMEOS)
// Called when the input method is disabled. // Called when the input method is disabled.
// |args| will contain the input method ID as string (ex. "mozc"). // |args| will contain the input method ID as string (ex. "mozc").
void InputMethodDisableCallback(const ListValue* args); void InputMethodDisableCallback(const ListValue* args);
...@@ -76,6 +81,7 @@ class LanguageOptionsHandler : public OptionsPageUIHandler { ...@@ -76,6 +81,7 @@ class LanguageOptionsHandler : public OptionsPageUIHandler {
// Called when the input method options page is opened. // Called when the input method options page is opened.
// |args| will contain the input method ID as string (ex. "mozc"). // |args| will contain the input method ID as string (ex. "mozc").
void InputMethodOptionsOpenCallback(const ListValue* args); void InputMethodOptionsOpenCallback(const ListValue* args);
#endif // defined(OS_CHROMEOS)
// Called when the language options is opened. // Called when the language options is opened.
void LanguageOptionsOpenCallback(const ListValue* args); void LanguageOptionsOpenCallback(const ListValue* args);
...@@ -88,15 +94,10 @@ class LanguageOptionsHandler : public OptionsPageUIHandler { ...@@ -88,15 +94,10 @@ class LanguageOptionsHandler : public OptionsPageUIHandler {
// |args| will contain the language code as string (ex. "fr"). // |args| will contain the language code as string (ex. "fr").
void SpellCheckLanguageChangeCallback(const ListValue* args); void SpellCheckLanguageChangeCallback(const ListValue* args);
// Called when the sign out button is clicked. // Called when the restart/sign-out button is clicked.
void SignOutCallback(const ListValue* args); void RestartCallback(const ListValue* args);
DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandler); DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandler);
}; };
} // namespace
#endif // OS_CHROMEOS
#endif // CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ #endif // CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_
...@@ -2,45 +2,45 @@ ...@@ -2,45 +2,45 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(csilv): This is for the move CL. Changes to make this cross-platform
// will come in the followup CL.
#if defined(OS_CHROMEOS)
#include "chrome/browser/dom_ui/options/language_options_handler.h" #include "chrome/browser/dom_ui/options/language_options_handler.h"
#include <string> #include <string>
#include "base/scoped_ptr.h" #include "base/scoped_ptr.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/input_method_library.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace chromeos { #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/input_method_library.h"
#endif // defined(OS_CHROMEOS)
static InputMethodDescriptors CreateInputMethodDescriptors() { #if defined(OS_CHROMEOS)
InputMethodDescriptors descriptors; static chromeos::InputMethodDescriptors CreateInputMethodDescriptors() {
chromeos::InputMethodDescriptors descriptors;
descriptors.push_back( descriptors.push_back(
InputMethodDescriptor("xkb:us::eng", "USA", "us", "eng")); chromeos::InputMethodDescriptor("xkb:us::eng", "USA", "us", "eng"));
descriptors.push_back( descriptors.push_back(
InputMethodDescriptor("xkb:fr::fra", "France", "fr", "fra")); chromeos::InputMethodDescriptor("xkb:fr::fra", "France", "fr", "fra"));
descriptors.push_back( descriptors.push_back(
InputMethodDescriptor("xkb:be::fra", "Belgium", "be", "fr")); chromeos::InputMethodDescriptor("xkb:be::fra", "Belgium", "be", "fr"));
descriptors.push_back( descriptors.push_back(
InputMethodDescriptor("mozc", "Mozc (US keyboard layout)", "us", "ja")); chromeos::InputMethodDescriptor("mozc", "Mozc (US keyboard layout)", "us",
"ja"));
return descriptors; return descriptors;
} }
TEST(LanguageOptionsHandlerTest, GetInputMethodList) { TEST(LanguageOptionsHandlerTest, GetInputMethodList) {
// Use the stub libcros. The object will take care of the cleanup. // Use the stub libcros. The object will take care of the cleanup.
ScopedStubCrosEnabler stub_cros_enabler; chromeos::ScopedStubCrosEnabler stub_cros_enabler;
// Reset the library implementation so it will be initialized // Reset the library implementation so it will be initialized
// again. Otherwise, non-stub implementation can be reused, if it's // again. Otherwise, non-stub implementation can be reused, if it's
// already initialized elsewhere, which results in a crash. // already initialized elsewhere, which results in a crash.
CrosLibrary::Get()->GetTestApi()->SetInputMethodLibrary(NULL, false); chromeos::CrosLibrary::Get()->GetTestApi()->SetInputMethodLibrary(NULL,
false);
InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); chromeos::InputMethodDescriptors descriptors = CreateInputMethodDescriptors();
scoped_ptr<ListValue> list( scoped_ptr<ListValue> list(
LanguageOptionsHandler::GetInputMethodList(descriptors)); LanguageOptionsHandler::GetInputMethodList(descriptors));
ASSERT_EQ(4U, list->GetSize()); ASSERT_EQ(4U, list->GetSize());
...@@ -94,7 +94,7 @@ TEST(LanguageOptionsHandlerTest, GetInputMethodList) { ...@@ -94,7 +94,7 @@ TEST(LanguageOptionsHandlerTest, GetInputMethodList) {
} }
TEST(LanguageOptionsHandlerTest, GetLanguageList) { TEST(LanguageOptionsHandlerTest, GetLanguageList) {
InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); chromeos::InputMethodDescriptors descriptors = CreateInputMethodDescriptors();
scoped_ptr<ListValue> list( scoped_ptr<ListValue> list(
LanguageOptionsHandler::GetLanguageList(descriptors)); LanguageOptionsHandler::GetLanguageList(descriptors));
ASSERT_EQ(6U, list->GetSize()); ASSERT_EQ(6U, list->GetSize());
...@@ -158,23 +158,21 @@ TEST(LanguageOptionsHandlerTest, GetLanguageList) { ...@@ -158,23 +158,21 @@ TEST(LanguageOptionsHandlerTest, GetLanguageList) {
EXPECT_EQ("espa\u00F1ol (Latinoam\u00E9rica y el Caribe)", EXPECT_EQ("espa\u00F1ol (Latinoam\u00E9rica y el Caribe)",
native_display_name); native_display_name);
} }
#endif // defined(OS_CHROMEOS)
TEST(LanguageOptionsHandlerTest, GetUiLanguageCodeSet) { #if !defined(OS_MACOSX)
TEST(LanguageOptionsHandlerTest, GetUILanguageCodeSet) {
scoped_ptr<DictionaryValue> dictionary( scoped_ptr<DictionaryValue> dictionary(
LanguageOptionsHandler::GetUiLanguageCodeSet()); LanguageOptionsHandler::GetUILanguageCodeSet());
EXPECT_TRUE(dictionary->HasKey("en-US")); EXPECT_TRUE(dictionary->HasKey("en-US"));
// Note that we don't test a false case, as such an expectation will // Note that we don't test a false case, as such an expectation will
// fail when we add support for the language. // fail when we add support for the language.
// EXPECT_FALSE(dictionary->HasKey("no")); // EXPECT_FALSE(dictionary->HasKey("no"));
} }
#endif // !defined(OS_MACOSX)
TEST(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) { TEST(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) {
scoped_ptr<DictionaryValue> dictionary( scoped_ptr<DictionaryValue> dictionary(
LanguageOptionsHandler::GetSpellCheckLanguageCodeSet()); LanguageOptionsHandler::GetSpellCheckLanguageCodeSet());
EXPECT_TRUE(dictionary->HasKey("en-US")); EXPECT_TRUE(dictionary->HasKey("en-US"));
} }
} // namespace chromeos
#endif // OS_CHROMEOS
...@@ -153,6 +153,7 @@ OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { ...@@ -153,6 +153,7 @@ OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) {
AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new CookiesViewHandler()); AddOptionsPageUIHandler(localized_strings, new CookiesViewHandler());
AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler());
AddOptionsPageUIHandler(localized_strings, new PasswordManagerHandler()); AddOptionsPageUIHandler(localized_strings, new PasswordManagerHandler());
AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler());
AddOptionsPageUIHandler(localized_strings, new SearchEngineManagerHandler()); AddOptionsPageUIHandler(localized_strings, new SearchEngineManagerHandler());
...@@ -172,8 +173,6 @@ OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { ...@@ -172,8 +173,6 @@ OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) {
new chromeos::LanguageHangulOptionsHandler()); new chromeos::LanguageHangulOptionsHandler());
AddOptionsPageUIHandler(localized_strings, AddOptionsPageUIHandler(localized_strings,
new chromeos::LanguageMozcOptionsHandler()); new chromeos::LanguageMozcOptionsHandler());
AddOptionsPageUIHandler(localized_strings,
new chromeos::LanguageOptionsHandler());
AddOptionsPageUIHandler(localized_strings, AddOptionsPageUIHandler(localized_strings,
new chromeos::LanguagePinyinOptionsHandler()); new chromeos::LanguagePinyinOptionsHandler());
AddOptionsPageUIHandler(localized_strings, new chromeos::ProxyHandler()); AddOptionsPageUIHandler(localized_strings, new chromeos::ProxyHandler());
......
...@@ -95,6 +95,12 @@ ...@@ -95,6 +95,12 @@
</select> </select>
</label> </label>
</div> </div>
<if expr="not pp_ifdef('chromeos')">
<div>
<button id="language-button"
i18n-content="languageAndSpellCheckSettingsButton"></button>
</div>
</if>
<if expr="os == 'win32'"> <if expr="os == 'win32'">
<div> <div>
<label style="display:inline;"> <label style="display:inline;">
......
...@@ -60,6 +60,11 @@ var OptionsPage = options.OptionsPage; ...@@ -60,6 +60,11 @@ var OptionsPage = options.OptionsPage;
chrome.send('defaultFontSizeAction', chrome.send('defaultFontSizeAction',
[String(event.target.options[event.target.selectedIndex].value)]); [String(event.target.options[event.target.selectedIndex].value)]);
}; };
$('language-button').onclick = function(event) {
OptionsPage.showPageByName('language');
chrome.send('coreOptionsUserMetricsAction',
['Options_LanuageAndSpellCheckSettings']);
};
if (cr.isWindows || cr.isMac) { if (cr.isWindows || cr.isMac) {
$('certificatesManageButton').onclick = function(event) { $('certificatesManageButton').onclick = function(event) {
......
<div class="page hidden" id="add-language-overlay-page"> <div class="page hidden" id="add-language-overlay-page">
<if expr="pp_ifdef('chromeos')">
<ul id="add-language-overlay-language-list"> <ul id="add-language-overlay-language-list">
</ul> </ul>
<button id="add-language-overlay-cancel-button" <button id="add-language-overlay-cancel-button"
i18n-content="cancel"></button> i18n-content="cancel"></button>
</if>
<if expr="not pp_ifdef('chromeos')">
<h1 i18n-content="add_language_title"></h1>
<label>
<span i18n-content="add_language_select_label"></span>
<select id="add-language-overlay-language-list"></select>
</label>
<div class="action-area">
<div class="button-strip">
<button id="add-language-overlay-cancel-button" i18n-content="cancel">
</button>
<button id="add-language-overlay-ok-button" i18n-content="ok"></button>
</div>
</div>
</if>
</div> </div>
...@@ -39,23 +39,30 @@ cr.define('options.language', function() { ...@@ -39,23 +39,30 @@ cr.define('options.language', function() {
}; };
// Create the language list with which users can add a language. // Create the language list with which users can add a language.
// Note that we have about 40 languages.
var addLanguageList = $('add-language-overlay-language-list'); var addLanguageList = $('add-language-overlay-language-list');
var languageListData = templateData.languageList; var languageListData = templateData.languageList;
for (var i = 0; i < languageListData.length; i++) { for (var i = 0; i < languageListData.length; i++) {
var language = languageListData[i]; var language = languageListData[i];
var button = document.createElement('button'); var displayText = language.displayName;
button.className = 'link-button';
button.textContent = language.displayName;
// If the native name is different, add it. // If the native name is different, add it.
if (language.displayName != language.nativeDisplayName) { if (language.displayName != language.nativeDisplayName) {
button.textContent += ' - ' + language.nativeDisplayName; displayText += ' - ' + language.nativeDisplayName;
}
if (cr.isChromeOS) {
var button = document.createElement('button');
button.className = 'link-button';
button.textContent = displayText;
button.languageCode = language.code;
var li = document.createElement('li');
li.languageCode = language.code;
li.appendChild(button);
addLanguageList.appendChild(li);
} else {
var option = document.createElement('option');
option.value = language.code;
option.textContent = displayText;
addLanguageList.appendChild(option);
} }
button.languageCode = language.code;
var li = document.createElement('li');
li.languageCode = language.code;
li.appendChild(button);
addLanguageList.appendChild(li);
} }
}, },
}; };
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -92,8 +92,13 @@ cr.define('options.language', function() { ...@@ -92,8 +92,13 @@ cr.define('options.language', function() {
window.addEventListener('resize', this.redraw.bind(this)); window.addEventListener('resize', this.redraw.bind(this));
// Listen to pref change. // Listen to pref change.
Preferences.getInstance().addEventListener(this.preferredLanguagesPref, if (cr.isChromeOS) {
this.handlePreferredLanguagesPrefChange_.bind(this)); Preferences.getInstance().addEventListener(this.preferredLanguagesPref,
this.handlePreferredLanguagesPrefChange_.bind(this));
} else {
Preferences.getInstance().addEventListener(this.acceptLanguagesPref,
this.handleAcceptLanguagesPrefChange_.bind(this));
}
// Listen to drag and drop events. // Listen to drag and drop events.
this.addEventListener('dragstart', this.handleDragStart_.bind(this)); this.addEventListener('dragstart', this.handleDragStart_.bind(this));
...@@ -184,6 +189,10 @@ cr.define('options.language', function() { ...@@ -184,6 +189,10 @@ cr.define('options.language', function() {
if (target instanceof ListItem) { if (target instanceof ListItem) {
this.draggedItem = target; this.draggedItem = target;
e.dataTransfer.effectAllowed = 'move'; e.dataTransfer.effectAllowed = 'move';
// We need to put some kind of data in the drag or it will be
// ignored. Use the display name in case the user drags to a text
// field or the desktop.
e.dataTransfer.setData('text/plain', target.title);
} }
}, },
...@@ -255,6 +264,18 @@ cr.define('options.language', function() { ...@@ -255,6 +264,18 @@ cr.define('options.language', function() {
this.load_(languageCodes); this.load_(languageCodes);
}, },
/**
* Handles accept languages pref change.
* @param {Event} e The change event object.
* @private
*/
handleAcceptLanguagesPrefChange_: function(e) {
var languageCodesInCsv = e.value.value;
var languageCodes = this.filterBadLanguageCodes_(
languageCodesInCsv.split(','));
this.load_(languageCodes);
},
/** /**
* Loads given language list. * Loads given language list.
* @param {Array} languageCodes List of language codes. * @param {Array} languageCodes List of language codes.
...@@ -286,8 +307,9 @@ cr.define('options.language', function() { ...@@ -286,8 +307,9 @@ cr.define('options.language', function() {
*/ */
savePreference_: function() { savePreference_: function() {
// Encode the language codes into a CSV string. // Encode the language codes into a CSV string.
Preferences.setStringPref(this.preferredLanguagesPref, if (cr.isChromeOS)
this.dataModel.slice().join(',')); Preferences.setStringPref(this.preferredLanguagesPref,
this.dataModel.slice().join(','));
// Save the same language list as accept languages preference as // Save the same language list as accept languages preference as
// well, but we need to expand the language list, to make it more // well, but we need to expand the language list, to make it more
// acceptable. For instance, some web sites don't understand 'en-US' // acceptable. For instance, some web sites don't understand 'en-US'
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
.language-options h3 { .language-options h3 {
-webkit-margin-start: 12px; -webkit-margin-start: 12px;
font-size: 75%; font-size: 100%;
font-weight: bold; font-weight: bold;
margin-top: 12px; margin-top: 12px;
} }
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
#language-options-list { #language-options-list {
-webkit-box-flex: 1; -webkit-box-flex: 1;
padding: 0; padding: 1px 0 0;
width: 100%; width: 100%;
} }
...@@ -87,31 +87,32 @@ ...@@ -87,31 +87,32 @@
margin-top: 12px; margin-top: 12px;
} }
#add-language-overlay-language-list { #add-language-overlay-language-list[os=chromeos] {
-webkit-column-count: 2; -webkit-column-count: 2;
-webkit-column-gap: 20px; -webkit-column-gap: 20px;
} }
#add-language-overlay-cancel-button { #add-language-overlay-cancel-button[os=chromeos] {
/* Place the button in the center. */ /* Place the button in the center. */
display: block; display: block;
margin: auto; margin: auto;
margin-top: 15px; margin-top: 15px;
} }
#add-language-overlay-page { #add-language-overlay-page[os=chromeos] {
width: 800px; width: 800px;
} }
#add-language-overlay-page button { #add-language-overlay-page[os=chromeos] button {
padding: 0; padding: 0;
text-align: left; text-align: left;
} }
#add-language-overlay-page ul { #add-language-overlay-page[os=chromeos] ul {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
/* TODO(kochi): This is temporary copy from new_new_tab.css */ /* TODO(kochi): This is temporary copy from new_new_tab.css */
/* Notification */ /* Notification */
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
</div> </div>
<div class="language-options-header"> <div class="language-options-header">
<div i18n-content="add_language_instructions"></div> <div i18n-content="add_language_instructions"></div>
<if expr="pp_ifdef('chromeos')">
<div i18n-content="input_method_instructions"></div> <div i18n-content="input_method_instructions"></div>
</if>
</div> </div>
<div class="language-options"> <div class="language-options">
<div class="language-options-left"> <div class="language-options-left">
...@@ -21,26 +23,49 @@ ...@@ -21,26 +23,49 @@
</div> </div>
<div class="language-options-right"> <div class="language-options-right">
<h3 id="language-options-language-name"></h3> <h3 id="language-options-language-name"></h3>
<if expr="os != 'darwin'">
<div class="language-options-contents"> <div class="language-options-contents">
<button id="language-options-ui-language-button"></button> <button id="language-options-ui-language-button"></button>
</div> </div>
</if>
<div class="language-options-contents"> <div class="language-options-contents">
<button id="language-options-spell-check-language-button"></button> <button id="language-options-spell-check-language-button"></button>
</div> </div>
<div id="language-options-ui-notification-bar" <div id="language-options-ui-notification-bar"
class="language-options-notification"> class="language-options-notification">
<div i18n-content="sign_out_required"></div> <div i18n-content="restart_required"></div>
<button id="language-options-ui-sign-out-button" <button id="language-options-ui-restart-button"
i18n-content="sign_out_button"></button> i18n-content="restart_button"></button>
</div> </div>
<if expr="pp_ifdef('chromeos')">
<h3 i18n-content="input_method"></h3> <h3 i18n-content="input_method"></h3>
<div id="language-options-input-method-list" <div id="language-options-input-method-list"
class="language-options-contents"> class="language-options-contents">
</div> </div>
</if>
</div> </div>
</div> </div>
<div class="language-options-footer"> <div class="language-options-footer">
<if expr="pp_ifdef('chromeos')">
<div i18n-content="switch_input_methods_hint"></div> <div i18n-content="switch_input_methods_hint"></div>
<div i18n-content="select_previous_input_method_hint"></div> <div i18n-content="select_previous_input_method_hint"></div>
</if>
<if expr="not pp_ifdef('chromeos')">
<div id="spell-check-option">
<label class="checkbox">
<input id="enable-spell-check" pref="browser.enable_spellchecking"
metric="Options_SpellCheck" type="checkbox">
<span i18n-content="enable_spell_check"></span>
</label>
</div>
<div id="auto-spell-correction-option" class="hidden">
<label class="checkbox">
<input id="enable-auto-spell-correction"
pref="browser.enable_autospellcorrect"
metric="Options_AutoSpellCorrection" type="checkbox">
<span i18n-content="enable_auto_spell_correction"></span>
</label>
</div>
</if>
</div> </div>
</div> </div>
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -58,8 +58,12 @@ cr.define('options', function() { ...@@ -58,8 +58,12 @@ cr.define('options', function() {
this.addEventListener('visibleChange', this.addEventListener('visibleChange',
this.handleVisibleChange_.bind(this)); this.handleVisibleChange_.bind(this));
this.initializeInputMethodList_(); if (cr.isChromeOS) {
this.initializeLanguageCodeToInputMehotdIdsMap_(); this.initializeInputMethodList_();
this.initializeLanguageCodeToInputMehotdIdsMap_();
}
Preferences.getInstance().addEventListener(this.spellCheckDictionaryPref,
this.handleSpellCheckDictionaryPrefChange_.bind(this));
// Set up add button. // Set up add button.
$('language-options-add-button').onclick = function(e) { $('language-options-add-button').onclick = function(e) {
...@@ -80,10 +84,22 @@ cr.define('options', function() { ...@@ -80,10 +84,22 @@ cr.define('options', function() {
// Setup add language overlay page. // Setup add language overlay page.
OptionsPage.registerOverlay(AddLanguageOverlay.getInstance()); OptionsPage.registerOverlay(AddLanguageOverlay.getInstance());
// Listen to user clicks on the add language list. if (cr.isChromeOS) {
var addLanguageList = $('add-language-overlay-language-list'); // Listen to user clicks on the add language list.
addLanguageList.addEventListener('click', var addLanguageList = $('add-language-overlay-language-list');
this.handleAddLanguageListClick_.bind(this)); addLanguageList.addEventListener('click',
this.handleAddLanguageListClick_.bind(this));
} else {
// Listen to add language dialog ok button.
var addLanguageOkButton = $('add-language-overlay-ok-button');
addLanguageOkButton.addEventListener('click',
this.handleAddLanguageOkButtonClick_.bind(this));
// Show experimental features if enabled.
if (templateData.experimentalSpellCheckFeatures == 'true') {
$('auto-spell-correction-option').classList.remove('hidden');
}
}
}, },
// The preference is a CSV string that describes preload engines // The preference is a CSV string that describes preload engines
...@@ -137,8 +153,6 @@ cr.define('options', function() { ...@@ -137,8 +153,6 @@ cr.define('options', function() {
// Listen to pref change once the input method list is initialized. // Listen to pref change once the input method list is initialized.
Preferences.getInstance().addEventListener(this.preloadEnginesPref, Preferences.getInstance().addEventListener(this.preloadEnginesPref,
this.handlePreloadEnginesPrefChange_.bind(this)); this.handlePreloadEnginesPrefChange_.bind(this));
Preferences.getInstance().addEventListener(this.spellCheckDictionaryPref,
this.handleSpellCheckDictionaryPrefChange_.bind(this));
}, },
/** /**
...@@ -191,9 +205,11 @@ cr.define('options', function() { ...@@ -191,9 +205,11 @@ cr.define('options', function() {
} }
} }
this.updateSelectedLanguageName_(languageCode); this.updateSelectedLanguageName_(languageCode);
this.updateUiLanguageButton_(languageCode); if (!cr.isMac)
this.updateUiLanguageButton_(languageCode);
this.updateSpellCheckLanguageButton_(languageCode); this.updateSpellCheckLanguageButton_(languageCode);
this.updateInputMethodList_(languageCode); if (cr.isChromeOS)
this.updateInputMethodList_(languageCode);
this.updateLanguageListInAddLanguageOverlay_(); this.updateLanguageListInAddLanguageOverlay_();
}, },
...@@ -203,9 +219,11 @@ cr.define('options', function() { ...@@ -203,9 +219,11 @@ cr.define('options', function() {
* @private * @private
*/ */
handleLanguageOptionsListSave_: function(e) { handleLanguageOptionsListSave_: function(e) {
// Sort the preload engines per the saved languages before save. if (cr.isChromeOS) {
this.preloadEngines_ = this.sortPreloadEngines_(this.preloadEngines_); // Sort the preload engines per the saved languages before save.
this.savePreloadEnginesPref_(); this.preloadEngines_ = this.sortPreloadEngines_(this.preloadEngines_);
this.savePreloadEnginesPref_();
}
}, },
/** /**
...@@ -321,8 +339,8 @@ cr.define('options', function() { ...@@ -321,8 +339,8 @@ cr.define('options', function() {
uiLanguageButton.onclick = function(e) { uiLanguageButton.onclick = function(e) {
chrome.send('uiLanguageChange', [languageCode]); chrome.send('uiLanguageChange', [languageCode]);
} }
$('language-options-ui-sign-out-button').onclick = function(e) { $('language-options-ui-restart-button').onclick = function(e) {
chrome.send('uiLanguageSignOut'); chrome.send('uiLanguageRestart');
} }
} else { } else {
// If the language is not supported as UI language, the button // If the language is not supported as UI language, the button
...@@ -506,6 +524,19 @@ cr.define('options', function() { ...@@ -506,6 +524,19 @@ cr.define('options', function() {
OptionsPage.clearOverlays(); OptionsPage.clearOverlays();
}, },
/**
* Handles add language dialog ok button.
*/
handleAddLanguageOkButtonClick_ : function() {
var languagesSelect = $('add-language-overlay-language-list');
var selectedIndex = languagesSelect.selectedIndex;
if (selectedIndex >= 0) {
var selection = languagesSelect.options[selectedIndex];
$('language-options-list').addLanguage(String(selection.value));
OptionsPage.clearOverlays();
}
},
/** /**
* Handles remove button's click event. * Handles remove button's click event.
* @param {Event} e Click event. * @param {Event} e Click event.
...@@ -520,14 +551,16 @@ cr.define('options', function() { ...@@ -520,14 +551,16 @@ cr.define('options', function() {
localStrings.getString('ok_button')); localStrings.getString('ok_button'));
return; return;
} }
// Disable input methods associated with |languageCode|. if (cr.isChromeOS) {
// Don't allow removing the language if cerntain conditions are met. // Disable input methods associated with |languageCode|.
// See removePreloadEnginesByLanguageCode_() for details. // Don't allow removing the language if cerntain conditions are met.
if (!this.removePreloadEnginesByLanguageCode_(languageCode)) { // See removePreloadEnginesByLanguageCode_() for details.
this.showNotification_( if (!this.removePreloadEnginesByLanguageCode_(languageCode)) {
localStrings.getString('please_add_another_language'), this.showNotification_(
localStrings.getString('ok_button')); localStrings.getString('please_add_another_language'),
return; localStrings.getString('ok_button'));
return;
}
} }
languageOptionsList.removeSelectedLanguage(); languageOptionsList.removeSelectedLanguage();
}, },
......
...@@ -75,22 +75,22 @@ function load() { ...@@ -75,22 +75,22 @@ function load() {
new OptionsPage('languageChewing', new OptionsPage('languageChewing',
localStrings.getString('languageChewingPage'), localStrings.getString('languageChewingPage'),
'languageChewingPage'), 'languageChewingPage'),
SystemOptions.getInstance()); LanguageOptions.getInstance());
OptionsPage.registerSubPage( OptionsPage.registerSubPage(
new OptionsPage('languageHangul', new OptionsPage('languageHangul',
localStrings.getString('languageHangulPage'), localStrings.getString('languageHangulPage'),
'languageHangulPage'), 'languageHangulPage'),
SystemOptions.getInstance()); LanguageOptions.getInstance());
OptionsPage.registerSubPage( OptionsPage.registerSubPage(
new OptionsPage('languageMozc', new OptionsPage('languageMozc',
localStrings.getString('languageMozcPage'), localStrings.getString('languageMozcPage'),
'languageMozcPage'), 'languageMozcPage'),
SystemOptions.getInstance()); LanguageOptions.getInstance());
OptionsPage.registerSubPage( OptionsPage.registerSubPage(
new OptionsPage('languagePinyin', new OptionsPage('languagePinyin',
localStrings.getString('languagePinyinPage'), localStrings.getString('languagePinyinPage'),
'languagePinyinPage'), 'languagePinyinPage'),
SystemOptions.getInstance()); LanguageOptions.getInstance());
OptionsPage.register(InternetOptions.getInstance()); OptionsPage.register(InternetOptions.getInstance());
} }
OptionsPage.register(AdvancedOptions.getInstance()); OptionsPage.register(AdvancedOptions.getInstance());
...@@ -106,6 +106,11 @@ function load() { ...@@ -106,6 +106,11 @@ function load() {
OptionsPage.registerSubPage(FontSettings.getInstance(), OptionsPage.registerSubPage(FontSettings.getInstance(),
AdvancedOptions.getInstance(), AdvancedOptions.getInstance(),
[$('fontSettingsCustomizeFontsButton')]); [$('fontSettingsCustomizeFontsButton')]);
if (!cr.isChromeOS) {
OptionsPage.registerSubPage(LanguageOptions.getInstance(),
AdvancedOptions.getInstance(),
[$('language-button')]);
}
if (!cr.isWindows && !cr.isMac) { if (!cr.isWindows && !cr.isMac) {
OptionsPage.registerSubPage(CertificateManager.getInstance(), OptionsPage.registerSubPage(CertificateManager.getInstance(),
AdvancedOptions.getInstance(), AdvancedOptions.getInstance(),
...@@ -167,8 +172,14 @@ function load() { ...@@ -167,8 +172,14 @@ function load() {
// Allow platform specific CSS rules. // Allow platform specific CSS rules.
if (cr.isMac) if (cr.isMac)
document.documentElement.setAttribute('os', 'mac'); document.documentElement.setAttribute('os', 'mac');
if (cr.isLinux) if (cr.isWindows)
document.documentElement.setAttribute('os', 'windows');
if (cr.isChromeOS)
document.documentElement.setAttribute('os', 'chromeos');
if (cr.isLinux) {
document.documentElement.setAttribute('os', 'linux');
document.documentElement.setAttribute('toolkit', 'gtk'); document.documentElement.setAttribute('toolkit', 'gtk');
}
if (cr.isViews) if (cr.isViews)
document.documentElement.setAttribute('toolkit', 'views'); document.documentElement.setAttribute('toolkit', 'views');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment