OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/cros_settings.h" | 10 #include "chrome/browser/chromeos/cros_settings.h" |
11 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 11 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
14 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" | 14 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" |
15 #include "chrome/browser/ui/webui/options/chromeos/proxy_handler.h" | 15 #include "chrome/browser/ui/webui/options/chromeos/proxy_handler.h" |
16 #include "chrome/common/jstemplate_builder.h" | 16 #include "chrome/common/jstemplate_builder.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/public/browser/web_contents.h" |
19 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
21 | 21 |
| 22 using content::WebContents; |
| 23 |
22 namespace { | 24 namespace { |
23 | 25 |
24 class ProxySettingsHTMLSource : public ChromeURLDataManager::DataSource { | 26 class ProxySettingsHTMLSource : public ChromeURLDataManager::DataSource { |
25 public: | 27 public: |
26 explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings); | 28 explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings); |
27 | 29 |
28 // Called when the network layer has requested a resource underneath | 30 // Called when the network layer has requested a resource underneath |
29 // the path we registered. | 31 // the path we registered. |
30 virtual void StartDataRequest(const std::string& path, | 32 virtual void StartDataRequest(const std::string& path, |
31 bool is_incognito, | 33 bool is_incognito, |
(...skipping 25 matching lines...) Expand all Loading... |
57 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 59 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
58 html, localized_strings_.get()); | 60 html, localized_strings_.get()); |
59 | 61 |
60 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); | 62 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
61 } | 63 } |
62 | 64 |
63 } // namespace | 65 } // namespace |
64 | 66 |
65 namespace chromeos { | 67 namespace chromeos { |
66 | 68 |
67 ProxySettingsUI::ProxySettingsUI(TabContents* contents) | 69 ProxySettingsUI::ProxySettingsUI(WebContents* contents) |
68 : ChromeWebUI(contents), | 70 : ChromeWebUI(contents), |
69 proxy_handler_(new ProxyHandler()) { | 71 proxy_handler_(new ProxyHandler()) { |
70 // |localized_strings| will be owned by ProxySettingsHTMLSource. | 72 // |localized_strings| will be owned by ProxySettingsHTMLSource. |
71 DictionaryValue* localized_strings = new DictionaryValue(); | 73 DictionaryValue* localized_strings = new DictionaryValue(); |
72 | 74 |
73 CoreChromeOSOptionsHandler* core_handler = new CoreChromeOSOptionsHandler(); | 75 CoreChromeOSOptionsHandler* core_handler = new CoreChromeOSOptionsHandler(); |
74 core_handler->set_handlers_host(this); | 76 core_handler->set_handlers_host(this); |
75 core_handler->GetLocalizedValues(localized_strings); | 77 core_handler->GetLocalizedValues(localized_strings); |
76 AddMessageHandler(core_handler); | 78 AddMessageHandler(core_handler); |
77 | 79 |
(...skipping 24 matching lines...) Expand all Loading... |
102 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 104 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
103 } | 105 } |
104 PrefProxyConfigTracker* proxy_tracker = GetProfile()->GetProxyConfigTracker(); | 106 PrefProxyConfigTracker* proxy_tracker = GetProfile()->GetProxyConfigTracker(); |
105 proxy_tracker->UIMakeActiveNetworkCurrent(); | 107 proxy_tracker->UIMakeActiveNetworkCurrent(); |
106 std::string network_name; | 108 std::string network_name; |
107 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 109 proxy_tracker->UIGetCurrentNetworkName(&network_name); |
108 proxy_handler_->SetNetworkName(network_name); | 110 proxy_handler_->SetNetworkName(network_name); |
109 } | 111 } |
110 | 112 |
111 } // namespace chromeos | 113 } // namespace chromeos |
OLD | NEW |