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

Side by Side Diff: chrome/browser/ui/webui/textfields_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
« no previous file with comments | « chrome/browser/ui/webui/task_manager_ui.cc ('k') | chrome/browser/ui/webui/theme_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/textfields_ui.h" 5 #include "chrome/browser/ui/webui/textfields_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 11 matching lines...) Expand all
22 /** 22 /**
23 * TextfieldsUIHTMLSource implementation. 23 * TextfieldsUIHTMLSource implementation.
24 */ 24 */
25 TextfieldsUIHTMLSource::TextfieldsUIHTMLSource() 25 TextfieldsUIHTMLSource::TextfieldsUIHTMLSource()
26 : DataSource(chrome::kChromeUITextfieldsHost, MessageLoop::current()) { 26 : DataSource(chrome::kChromeUITextfieldsHost, MessageLoop::current()) {
27 } 27 }
28 28
29 void TextfieldsUIHTMLSource::StartDataRequest(const std::string& path, 29 void TextfieldsUIHTMLSource::StartDataRequest(const std::string& path,
30 bool is_incognito, 30 bool is_incognito,
31 int request_id) { 31 int request_id) {
32 const std::string full_html = ResourceBundle::GetSharedInstance() 32 SendResponse(request_id, ResourceBundle::GetSharedInstance()
33 .GetRawDataResource(IDR_TEXTFIELDS_HTML).as_string(); 33 .LoadDataResourceBytes(IDR_TEXTFIELDS_HTML));
34
35 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
36 html_bytes->data.resize(full_html.size());
37 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
38
39 SendResponse(request_id, html_bytes);
40 } 34 }
41 35
42 std::string TextfieldsUIHTMLSource::GetMimeType( 36 std::string TextfieldsUIHTMLSource::GetMimeType(
43 const std::string& /* path */) const { 37 const std::string& /* path */) const {
44 return "text/html"; 38 return "text/html";
45 } 39 }
46 40
47 TextfieldsUIHTMLSource::~TextfieldsUIHTMLSource() {} 41 TextfieldsUIHTMLSource::~TextfieldsUIHTMLSource() {}
48 42
49 /** 43 /**
(...skipping 17 matching lines...) Expand all
67 TextfieldsUI::TextfieldsUI(TabContents* contents) : ChromeWebUI(contents) { 61 TextfieldsUI::TextfieldsUI(TabContents* contents) : ChromeWebUI(contents) {
68 TextfieldsDOMHandler* handler = new TextfieldsDOMHandler(); 62 TextfieldsDOMHandler* handler = new TextfieldsDOMHandler();
69 AddMessageHandler(handler); 63 AddMessageHandler(handler);
70 handler->Attach(this); 64 handler->Attach(this);
71 65
72 TextfieldsUIHTMLSource* html_source = new TextfieldsUIHTMLSource(); 66 TextfieldsUIHTMLSource* html_source = new TextfieldsUIHTMLSource();
73 67
74 // Set up the chrome://textfields/ source. 68 // Set up the chrome://textfields/ source.
75 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 69 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
76 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/task_manager_ui.cc ('k') | chrome/browser/ui/webui/theme_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698