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

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: erg comments 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/browser_about_handler.h" 5 #include "chrome/browser/browser_about_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 response = AboutLinuxProxyConfig(); 1412 response = AboutLinuxProxyConfig();
1413 } else if (host == chrome::kChromeUISandboxHost) { 1413 } else if (host == chrome::kChromeUISandboxHost) {
1414 response = AboutSandbox(); 1414 response = AboutSandbox();
1415 #endif 1415 #endif
1416 } 1416 }
1417 1417
1418 FinishDataRequest(response, request_id); 1418 FinishDataRequest(response, request_id);
1419 } 1419 }
1420 1420
1421 void AboutSource::FinishDataRequest(const std::string& html, int request_id) { 1421 void AboutSource::FinishDataRequest(const std::string& html, int request_id) {
1422 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 1422 std::string html_copy(html);
1423 html_bytes->data.resize(html.size()); 1423 SendResponse(request_id, base::RefCountedString::TakeString(&html_copy));
1424 std::copy(html.begin(), html.end(), html_bytes->data.begin());
1425 SendResponse(request_id, html_bytes);
1426 } 1424 }
1427 1425
1428 std::string AboutSource::GetMimeType(const std::string& path) const { 1426 std::string AboutSource::GetMimeType(const std::string& path) const {
1429 if (path == kCreditsJsPath || 1427 if (path == kCreditsJsPath ||
1430 path == kStatsJsPath || 1428 path == kStatsJsPath ||
1431 path == kStringsJsPath || 1429 path == kStringsJsPath ||
1432 path == kVersionJsPath || 1430 path == kVersionJsPath ||
1433 path == kMemoryJsPath) { 1431 path == kMemoryJsPath) {
1434 return "application/javascript"; 1432 return "application/javascript";
1435 } 1433 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 return false; 1518 return false;
1521 } 1519 }
1522 1520
1523 std::vector<std::string> ChromePaths() { 1521 std::vector<std::string> ChromePaths() {
1524 std::vector<std::string> paths; 1522 std::vector<std::string> paths;
1525 paths.reserve(arraysize(kChromePaths)); 1523 paths.reserve(arraysize(kChromePaths));
1526 for (size_t i = 0; i < arraysize(kChromePaths); i++) 1524 for (size_t i = 0; i < arraysize(kChromePaths); i++)
1527 paths.push_back(kChromePaths[i]); 1525 paths.push_back(kChromePaths[i]);
1528 return paths; 1526 return paths;
1529 } 1527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698