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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace { | 29 namespace { |
30 | 30 |
31 class ProxySettingsHTMLSource : public content::URLDataSource { | 31 class ProxySettingsHTMLSource : public content::URLDataSource { |
32 public: | 32 public: |
33 explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings); | 33 explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings); |
34 | 34 |
35 // content::URLDataSource implementation. | 35 // content::URLDataSource implementation. |
36 virtual std::string GetSource() OVERRIDE; | 36 virtual std::string GetSource() OVERRIDE; |
37 virtual void StartDataRequest( | 37 virtual void StartDataRequest( |
38 const std::string& path, | 38 const std::string& path, |
39 bool is_incognito, | 39 int render_process_id, |
| 40 int render_view_id, |
40 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 41 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
41 virtual std::string GetMimeType(const std::string&) const OVERRIDE { | 42 virtual std::string GetMimeType(const std::string&) const OVERRIDE { |
42 return "text/html"; | 43 return "text/html"; |
43 } | 44 } |
44 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 45 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
45 return false; | 46 return false; |
46 } | 47 } |
47 | 48 |
48 protected: | 49 protected: |
49 virtual ~ProxySettingsHTMLSource() {} | 50 virtual ~ProxySettingsHTMLSource() {} |
50 | 51 |
51 private: | 52 private: |
52 scoped_ptr<DictionaryValue> localized_strings_; | 53 scoped_ptr<DictionaryValue> localized_strings_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(ProxySettingsHTMLSource); | 55 DISALLOW_COPY_AND_ASSIGN(ProxySettingsHTMLSource); |
55 }; | 56 }; |
56 | 57 |
57 ProxySettingsHTMLSource::ProxySettingsHTMLSource( | 58 ProxySettingsHTMLSource::ProxySettingsHTMLSource( |
58 DictionaryValue* localized_strings) | 59 DictionaryValue* localized_strings) |
59 : localized_strings_(localized_strings) { | 60 : localized_strings_(localized_strings) { |
60 } | 61 } |
61 | 62 |
62 std::string ProxySettingsHTMLSource::GetSource() { | 63 std::string ProxySettingsHTMLSource::GetSource() { |
63 return chrome::kChromeUIProxySettingsHost; | 64 return chrome::kChromeUIProxySettingsHost; |
64 } | 65 } |
65 | 66 |
66 void ProxySettingsHTMLSource::StartDataRequest( | 67 void ProxySettingsHTMLSource::StartDataRequest( |
67 const std::string& path, | 68 const std::string& path, |
68 bool is_incognito, | 69 int render_process_id, |
| 70 int render_view_id, |
69 const content::URLDataSource::GotDataCallback& callback) { | 71 const content::URLDataSource::GotDataCallback& callback) { |
70 webui::SetFontAndTextDirection(localized_strings_.get()); | 72 webui::SetFontAndTextDirection(localized_strings_.get()); |
71 | 73 |
72 static const base::StringPiece html( | 74 static const base::StringPiece html( |
73 ResourceBundle::GetSharedInstance().GetRawDataResource( | 75 ResourceBundle::GetSharedInstance().GetRawDataResource( |
74 IDR_PROXY_SETTINGS_HTML)); | 76 IDR_PROXY_SETTINGS_HTML)); |
75 std::string full_html = webui::GetI18nTemplateHtml( | 77 std::string full_html = webui::GetI18nTemplateHtml( |
76 html, localized_strings_.get()); | 78 html, localized_strings_.get()); |
77 | 79 |
78 callback.Run(base::RefCountedString::TakeString(&full_html)); | 80 callback.Run(base::RefCountedString::TakeString(&full_html)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 core_handler_->InitializePage(); | 117 core_handler_->InitializePage(); |
116 proxy_handler_->InitializePage(); | 118 proxy_handler_->InitializePage(); |
117 Profile* profile = Profile::FromWebUI(web_ui()); | 119 Profile* profile = Profile::FromWebUI(web_ui()); |
118 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); | 120 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); |
119 proxy_tracker->UIMakeActiveNetworkCurrent(); | 121 proxy_tracker->UIMakeActiveNetworkCurrent(); |
120 std::string network_name; | 122 std::string network_name; |
121 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 123 proxy_tracker->UIGetCurrentNetworkName(&network_name); |
122 } | 124 } |
123 | 125 |
124 } // namespace chromeos | 126 } // namespace chromeos |
OLD | NEW |