Upstream version 10.39.225.0
[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 "chrome/grit/generated_resources.h"
16 #include "chrome/grit/locale_settings.h"
17 #include "chromeos/chromeos_constants.h"
18 #include "content/public/browser/web_ui.h"
19 #include "ui/base/l10n/l10n_util.h"
20
21 namespace chromeos {
22 namespace options {
23
24 ProxyHandler::ProxyHandler() {
25 }
26
27 ProxyHandler::~ProxyHandler() {
28 }
29
30 void ProxyHandler::GetLocalizedValues(
31     base::DictionaryValue* localized_strings) {
32   DCHECK(localized_strings);
33
34   // Proxy page - ChromeOS
35   static OptionsStringResource resources[] = {
36     { "proxyPage", IDS_OPTIONS_PROXY_TAB_LABEL },
37     { "proxyDirectInternetConnection", IDS_PROXY_DIRECT_CONNECTION },
38     { "proxyManual", IDS_PROXY_MANUAL_CONFIG },
39     { "sameProxyProtocols", IDS_PROXY_SAME_FORALL },
40     { "httpProxy", IDS_PROXY_HTTP_PROXY },
41     { "secureHttpProxy", IDS_PROXY_HTTP_SECURE_HTTP_PROXY },
42     { "ftpProxy", IDS_PROXY_FTP_PROXY },
43     { "socksHost", IDS_PROXY_SOCKS_HOST },
44     { "proxyAutomatic", IDS_PROXY_AUTOMATIC },
45     { "proxyUseConfigUrl", IDS_PROXY_USE_AUTOCONFIG_URL },
46     { "addHost", IDS_PROXY_ADD_HOST },
47     { "removeHost", IDS_PROXY_REMOVE_HOST },
48     { "proxyPort", IDS_PROXY_PORT },
49     { "proxyBypass", IDS_PROXY_BYPASS },
50     { "proxyBannerPolicy", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_POLICY },
51     { "proxyBannerExtension",
52        IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_EXTENSION },
53     { "proxyBannerOther",
54       IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_OTHER_PRECEDE }
55   };
56
57   RegisterStrings(localized_strings, resources, arraysize(resources));
58
59   localized_strings->SetString("proxyBannerShared",
60       l10n_util::GetStringFUTF16(
61           IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PROXY_ENABLE_SHARED_HINT,
62           l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES)));
63 }
64
65 void ProxyHandler::InitializePage() {
66   ::options::OptionsPageUIHandler::InitializePage();
67
68   bool keyboard_driven_oobe =
69       system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation();
70   if (keyboard_driven_oobe) {
71     web_ui()->CallJavascriptFunction(
72         "DetailsInternetPage.initializeKeyboardFlow");
73   }
74 }
75
76 }  // namespace options
77 }  // namespace chromeos