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 15 matching lines...) Expand all Loading... |
26 using content::WebContents; | 26 using content::WebContents; |
27 using content::WebUIMessageHandler; | 27 using content::WebUIMessageHandler; |
28 | 28 |
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() const OVERRIDE; |
37 virtual void StartDataRequest( | 37 virtual void StartDataRequest( |
38 const std::string& path, | 38 const std::string& path, |
39 bool is_incognito, | 39 bool is_incognito, |
40 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 40 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
41 virtual std::string GetMimeType(const std::string&) const OVERRIDE { | 41 virtual std::string GetMimeType(const std::string&) const OVERRIDE { |
42 return "text/html"; | 42 return "text/html"; |
43 } | 43 } |
44 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 44 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
45 return false; | 45 return false; |
46 } | 46 } |
47 | 47 |
48 protected: | 48 protected: |
49 virtual ~ProxySettingsHTMLSource() {} | 49 virtual ~ProxySettingsHTMLSource() {} |
50 | 50 |
51 private: | 51 private: |
52 scoped_ptr<DictionaryValue> localized_strings_; | 52 scoped_ptr<DictionaryValue> localized_strings_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(ProxySettingsHTMLSource); | 54 DISALLOW_COPY_AND_ASSIGN(ProxySettingsHTMLSource); |
55 }; | 55 }; |
56 | 56 |
57 ProxySettingsHTMLSource::ProxySettingsHTMLSource( | 57 ProxySettingsHTMLSource::ProxySettingsHTMLSource( |
58 DictionaryValue* localized_strings) | 58 DictionaryValue* localized_strings) |
59 : localized_strings_(localized_strings) { | 59 : localized_strings_(localized_strings) { |
60 } | 60 } |
61 | 61 |
62 std::string ProxySettingsHTMLSource::GetSource() { | 62 std::string ProxySettingsHTMLSource::GetSource() const { |
63 return chrome::kChromeUIProxySettingsHost; | 63 return chrome::kChromeUIProxySettingsHost; |
64 } | 64 } |
65 | 65 |
66 void ProxySettingsHTMLSource::StartDataRequest( | 66 void ProxySettingsHTMLSource::StartDataRequest( |
67 const std::string& path, | 67 const std::string& path, |
68 bool is_incognito, | 68 bool is_incognito, |
69 const content::URLDataSource::GotDataCallback& callback) { | 69 const content::URLDataSource::GotDataCallback& callback) { |
70 webui::SetFontAndTextDirection(localized_strings_.get()); | 70 webui::SetFontAndTextDirection(localized_strings_.get()); |
71 | 71 |
72 static const base::StringPiece html( | 72 static const base::StringPiece html( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 core_handler_->InitializePage(); | 115 core_handler_->InitializePage(); |
116 proxy_handler_->InitializePage(); | 116 proxy_handler_->InitializePage(); |
117 Profile* profile = Profile::FromWebUI(web_ui()); | 117 Profile* profile = Profile::FromWebUI(web_ui()); |
118 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); | 118 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); |
119 proxy_tracker->UIMakeActiveNetworkCurrent(); | 119 proxy_tracker->UIMakeActiveNetworkCurrent(); |
120 std::string network_name; | 120 std::string network_name; |
121 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 121 proxy_tracker->UIGetCurrentNetworkName(&network_name); |
122 } | 122 } |
123 | 123 |
124 } // namespace chromeos | 124 } // namespace chromeos |
OLD | NEW |