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/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/chromeos/cros_settings.h" | 11 #include "chrome/browser/chromeos/cros_settings.h" |
12 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 12 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
15 #include "chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handle
r2.h" | 15 #include "chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handle
r2.h" |
16 #include "chrome/browser/ui/webui/options2/chromeos/proxy_handler2.h" | 16 #include "chrome/browser/ui/webui/options2/chromeos/proxy_handler2.h" |
17 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
20 #include "content/public/browser/web_ui.h" | 20 #include "content/public/browser/web_ui.h" |
21 #include "content/public/browser/web_ui_message_handler.h" | 21 #include "content/public/browser/web_ui_message_handler.h" |
22 #include "grit/browser_resources.h" | 22 #include "grit/browser_resources.h" |
| 23 #include "ui/base/layout.h" |
23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
24 | 25 |
25 using content::WebContents; | 26 using content::WebContents; |
26 using content::WebUIMessageHandler; | 27 using content::WebUIMessageHandler; |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 class ProxySettingsHTMLSource : public ChromeURLDataManager::DataSource { | 31 class ProxySettingsHTMLSource : public ChromeURLDataManager::DataSource { |
31 public: | 32 public: |
32 explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings); | 33 explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings); |
(...skipping 19 matching lines...) Expand all Loading... |
52 localized_strings_(localized_strings) { | 53 localized_strings_(localized_strings) { |
53 } | 54 } |
54 | 55 |
55 void ProxySettingsHTMLSource::StartDataRequest(const std::string& path, | 56 void ProxySettingsHTMLSource::StartDataRequest(const std::string& path, |
56 bool is_incognito, | 57 bool is_incognito, |
57 int request_id) { | 58 int request_id) { |
58 SetFontAndTextDirection(localized_strings_.get()); | 59 SetFontAndTextDirection(localized_strings_.get()); |
59 | 60 |
60 static const base::StringPiece html( | 61 static const base::StringPiece html( |
61 ResourceBundle::GetSharedInstance().GetRawDataResource( | 62 ResourceBundle::GetSharedInstance().GetRawDataResource( |
62 IDR_PROXY_SETTINGS_HTML)); | 63 IDR_PROXY_SETTINGS_HTML, ui::SCALE_FACTOR_NONE)); |
63 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 64 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
64 html, localized_strings_.get()); | 65 html, localized_strings_.get()); |
65 | 66 |
66 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); | 67 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
67 } | 68 } |
68 | 69 |
69 } // namespace | 70 } // namespace |
70 | 71 |
71 namespace chromeos { | 72 namespace chromeos { |
72 | 73 |
(...skipping 30 matching lines...) Expand all Loading... |
103 core_handler_->InitializePage(); | 104 core_handler_->InitializePage(); |
104 proxy_handler_->InitializePage(); | 105 proxy_handler_->InitializePage(); |
105 Profile* profile = Profile::FromWebUI(web_ui()); | 106 Profile* profile = Profile::FromWebUI(web_ui()); |
106 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); | 107 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); |
107 proxy_tracker->UIMakeActiveNetworkCurrent(); | 108 proxy_tracker->UIMakeActiveNetworkCurrent(); |
108 std::string network_name; | 109 std::string network_name; |
109 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 110 proxy_tracker->UIGetCurrentNetworkName(&network_name); |
110 } | 111 } |
111 | 112 |
112 } // namespace chromeos | 113 } // namespace chromeos |
OLD | NEW |