Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 void ProxySettingsHTMLSource::StartDataRequest(const std::string& path, 48 void ProxySettingsHTMLSource::StartDataRequest(const std::string& path,
49 bool is_incognito, 49 bool is_incognito,
50 int request_id) { 50 int request_id) {
51 SetFontAndTextDirection(localized_strings_.get()); 51 SetFontAndTextDirection(localized_strings_.get());
52 52
53 static const base::StringPiece html( 53 static const base::StringPiece html(
54 ResourceBundle::GetSharedInstance().GetRawDataResource( 54 ResourceBundle::GetSharedInstance().GetRawDataResource(
55 IDR_PROXY_SETTINGS_HTML)); 55 IDR_PROXY_SETTINGS_HTML));
56 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( 56 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
57 html, localized_strings_.get()); 57 html, localized_strings_.get());
58 58
59 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 59 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
60 html_bytes->data.resize(full_html.size());
61 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
62
63 SendResponse(request_id, html_bytes);
64 } 60 }
65 61
66 } // namespace 62 } // namespace
67 63
68 namespace chromeos { 64 namespace chromeos {
69 65
70 ProxySettingsUI::ProxySettingsUI(TabContents* contents) 66 ProxySettingsUI::ProxySettingsUI(TabContents* contents)
71 : ChromeWebUI(contents), 67 : ChromeWebUI(contents),
72 proxy_settings_(NULL) { 68 proxy_settings_(NULL) {
73 // |localized_strings| will be owned by ProxySettingsHTMLSource. 69 // |localized_strings| will be owned by ProxySettingsHTMLSource.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!proxy_settings_) { 107 if (!proxy_settings_) {
112 proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>( 108 proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>(
113 chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy")); 109 chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy"));
114 if (!proxy_settings_) 110 if (!proxy_settings_)
115 NOTREACHED() << "Error getting access to proxy cros settings provider"; 111 NOTREACHED() << "Error getting access to proxy cros settings provider";
116 } 112 }
117 return proxy_settings_; 113 return proxy_settings_;
118 } 114 }
119 115
120 } // namespace chromeos 116 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc ('k') | chrome/browser/ui/webui/chromeos/register_page_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698