OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_factory.h" |
14 #include "chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handle
r2.h" | 14 #include "chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handle
r2.h" |
15 #include "chrome/browser/ui/webui/options2/chromeos/proxy_handler2.h" | 15 #include "chrome/browser/ui/webui/options2/chromeos/proxy_handler2.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/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
20 #include "content/public/browser/web_ui_message_handler.h" | 20 #include "content/public/browser/web_ui_message_handler.h" |
21 #include "grit/browser_resources.h" | 21 #include "grit/browser_resources.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 | 23 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 core_handler_->set_handlers_host(this); | 79 core_handler_->set_handlers_host(this); |
80 core_handler_->GetLocalizedValues(localized_strings); | 80 core_handler_->GetLocalizedValues(localized_strings); |
81 web_ui->AddMessageHandler(core_handler_); | 81 web_ui->AddMessageHandler(core_handler_); |
82 | 82 |
83 proxy_handler_->GetLocalizedValues(localized_strings); | 83 proxy_handler_->GetLocalizedValues(localized_strings); |
84 web_ui->AddMessageHandler(proxy_handler_); | 84 web_ui->AddMessageHandler(proxy_handler_); |
85 | 85 |
86 ProxySettingsHTMLSource* source = | 86 ProxySettingsHTMLSource* source = |
87 new ProxySettingsHTMLSource(localized_strings); | 87 new ProxySettingsHTMLSource(localized_strings); |
88 Profile* profile = Profile::FromWebUI(web_ui); | 88 Profile* profile = Profile::FromWebUI(web_ui); |
89 profile->GetChromeURLDataManager()->AddDataSource(source); | 89 ChromeURLDataManagerFactory::GetForProfile(profile)->AddDataSource(source); |
90 } | 90 } |
91 | 91 |
92 ProxySettingsUI::~ProxySettingsUI() { | 92 ProxySettingsUI::~ProxySettingsUI() { |
93 // Uninitialize all registered handlers. The base class owns them and it will | 93 // Uninitialize all registered handlers. The base class owns them and it will |
94 // eventually delete them. | 94 // eventually delete them. |
95 core_handler_->Uninitialize(); | 95 core_handler_->Uninitialize(); |
96 proxy_handler_->Uninitialize(); | 96 proxy_handler_->Uninitialize(); |
97 } | 97 } |
98 | 98 |
99 void ProxySettingsUI::InitializeHandlers() { | 99 void ProxySettingsUI::InitializeHandlers() { |
100 core_handler_->InitializeHandler(); | 100 core_handler_->InitializeHandler(); |
101 proxy_handler_->InitializeHandler(); | 101 proxy_handler_->InitializeHandler(); |
102 core_handler_->InitializePage(); | 102 core_handler_->InitializePage(); |
103 proxy_handler_->InitializePage(); | 103 proxy_handler_->InitializePage(); |
104 Profile* profile = Profile::FromWebUI(web_ui()); | 104 Profile* profile = Profile::FromWebUI(web_ui()); |
105 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); | 105 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); |
106 proxy_tracker->UIMakeActiveNetworkCurrent(); | 106 proxy_tracker->UIMakeActiveNetworkCurrent(); |
107 std::string network_name; | 107 std::string network_name; |
108 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 108 proxy_tracker->UIGetCurrentNetworkName(&network_name); |
109 } | 109 } |
110 | 110 |
111 } // namespace chromeos | 111 } // namespace chromeos |
OLD | NEW |