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

Side by Side Diff: chrome/browser/ui/login/login_prompt_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/login/login_prompt.h" 5 #include "chrome/browser/ui/login/login_prompt.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 28 matching lines...) Expand all
39 l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL)); 39 l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL));
40 dict.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL)); 40 dict.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL));
41 41
42 SetFontAndTextDirection(&dict); 42 SetFontAndTextDirection(&dict);
43 43
44 const base::StringPiece html( 44 const base::StringPiece html(
45 ResourceBundle::GetSharedInstance().GetRawDataResource( 45 ResourceBundle::GetSharedInstance().GetRawDataResource(
46 IDR_HTTP_AUTH_HTML)); 46 IDR_HTTP_AUTH_HTML));
47 std::string response = jstemplate_builder::GetI18nTemplateHtml(html, &dict); 47 std::string response = jstemplate_builder::GetI18nTemplateHtml(html, &dict);
48 48
49 // Send the response. 49 SendResponse(request_id, base::RefCountedString::TakeString(&response));
50 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
51 html_bytes->data.resize(response.size());
52 std::copy(response.begin(), response.end(), html_bytes->data.begin());
53 SendResponse(request_id, html_bytes);
54 } 50 }
55 51
56 virtual std::string GetMimeType(const std::string& path) const { 52 virtual std::string GetMimeType(const std::string& path) const {
57 return "text/html"; 53 return "text/html";
58 } 54 }
59 55
60 static void RegisterDataSource(Profile *profile) { 56 static void RegisterDataSource(Profile *profile) {
61 ChromeURLDataManager* url_manager = profile->GetChromeURLDataManager(); 57 ChromeURLDataManager* url_manager = profile->GetChromeURLDataManager();
62 LoginHandlerSource *source = new LoginHandlerSource(); 58 LoginHandlerSource *source = new LoginHandlerSource();
63 url_manager->AddDataSource(source); 59 url_manager->AddDataSource(source);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 SetDialog(dialog); 247 SetDialog(dialog);
252 248
253 NotifyAuthNeeded(); 249 NotifyAuthNeeded();
254 } 250 }
255 251
256 // static 252 // static
257 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, 253 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info,
258 net::URLRequest* request) { 254 net::URLRequest* request) {
259 return new LoginHandlerHtml(auth_info, request); 255 return new LoginHandlerHtml(auth_info, request);
260 } 256 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_message_handler.cc ('k') | chrome/browser/ui/webui/active_downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698