02801fabb3df79663a20828425f4e18c5dcf279b
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / chromeos / proxy_handler.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/options/chromeos/proxy_handler.h"
6
7 #include "base/basictypes.h"
8 #include "base/callback.h"
9 #include "base/stl_util.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "base/time/time.h"
12 #include "base/values.h"
13 #include "chrome/browser/chromeos/system/input_device_settings.h"
14 #include "chrome/common/chrome_constants.h"
15 #include "chromeos/chromeos_constants.h"
16 #include "content/public/browser/web_ui.h"
17 #include "grit/chromium_strings.h"
18 #include "grit/generated_resources.h"
19 #include "grit/locale_settings.h"
20 #include "grit/theme_resources.h"
21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h"
23
24 namespace chromeos {
25 namespace options {
26
27 ProxyHandler::ProxyHandler() {
28 }
29
30 ProxyHandler::~ProxyHandler() {
31 }
32
33 void ProxyHandler::GetLocalizedValues(
34     base::DictionaryValue* localized_strings) {
35   DCHECK(localized_strings);
36
37   // Proxy page - ChromeOS
38   static OptionsStringResource resources[] = {
39     { "proxyPage", IDS_OPTIONS_PROXY_TAB_LABEL },
40     { "proxyDirectInternetConnection", IDS_PROXY_DIRECT_CONNECTION },
41     { "proxyManual", IDS_PROXY_MANUAL_CONFIG },
42     { "sameProxyProtocols", IDS_PROXY_SAME_FORALL },
43     { "httpProxy", IDS_PROXY_HTTP_PROXY },
44     { "secureHttpProxy", IDS_PROXY_HTTP_SECURE_HTTP_PROXY },
45     { "ftpProxy", IDS_PROXY_FTP_PROXY },
46     { "socksHost", IDS_PROXY_SOCKS_HOST },
47     { "proxyAutomatic", IDS_PROXY_AUTOMATIC },
48     { "proxyUseConfigUrl", IDS_PROXY_USE_AUTOCONFIG_URL },
49     { "addHost", IDS_PROXY_ADD_HOST },
50     { "removeHost", IDS_PROXY_REMOVE_HOST },
51     { "proxyPort", IDS_PROXY_PORT },
52     { "proxyBypass", IDS_PROXY_BYPASS },
53     { "proxyBannerPolicy", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_POLICY },
54     { "proxyBannerExtension",
55        IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_EXTENSION },
56     { "proxyBannerOther",
57       IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_OTHER_PRECEDE }
58   };
59
60   RegisterStrings(localized_strings, resources, arraysize(resources));
61
62   localized_strings->SetString("proxyBannerShared",
63       l10n_util::GetStringFUTF16(
64           IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_ENABLE_SHARED_HINT,
65           l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES)));
66 }
67
68 void ProxyHandler::InitializePage() {
69   ::options::OptionsPageUIHandler::InitializePage();
70
71   bool keyboard_driven_oobe =
72       system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation();
73   if (keyboard_driven_oobe) {
74     web_ui()->CallJavascriptFunction(
75         "DetailsInternetPage.initializeKeyboardFlow");
76   }
77 }
78
79 }  // namespace options
80 }  // namespace chromeos