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

Side by Side Diff: chrome/browser/ui/webui/history2_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/history2_ui.h" 5 #include "chrome/browser/ui/webui/history2_ui.h"
6 6
7 #include <algorithm>
8 #include <set> 7 #include <set>
9 8
10 #include "base/callback.h" 9 #include "base/callback.h"
11 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
12 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
13 #include "base/message_loop.h" 12 #include "base/message_loop.h"
14 #include "base/string16.h" 13 #include "base/string16.h"
15 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
16 #include "base/string_piece.h" 15 #include "base/string_piece.h"
17 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 localized_strings.SetString("clearallhistory", 93 localized_strings.SetString("clearallhistory",
95 l10n_util::GetStringUTF16(IDS_HISTORY_OPEN_CLEAR_BROWSING_DATA_DIALOG)); 94 l10n_util::GetStringUTF16(IDS_HISTORY_OPEN_CLEAR_BROWSING_DATA_DIALOG));
96 localized_strings.SetString("deletewarning", 95 localized_strings.SetString("deletewarning",
97 l10n_util::GetStringUTF16(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING)); 96 l10n_util::GetStringUTF16(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING));
98 97
99 SetFontAndTextDirection(&localized_strings); 98 SetFontAndTextDirection(&localized_strings);
100 99
101 static const base::StringPiece history_html( 100 static const base::StringPiece history_html(
102 ResourceBundle::GetSharedInstance().GetRawDataResource( 101 ResourceBundle::GetSharedInstance().GetRawDataResource(
103 IDR_HISTORY2_HTML)); 102 IDR_HISTORY2_HTML));
104 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( 103 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
105 history_html, &localized_strings); 104 history_html, &localized_strings);
106 105
107 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 106 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
108 html_bytes->data.resize(full_html.size());
109 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
110
111 SendResponse(request_id, html_bytes);
112 } 107 }
113 108
114 std::string HistoryUIHTMLSource2::GetMimeType(const std::string&) const { 109 std::string HistoryUIHTMLSource2::GetMimeType(const std::string&) const {
115 return "text/html"; 110 return "text/html";
116 } 111 }
117 112
118 //////////////////////////////////////////////////////////////////////////////// 113 ////////////////////////////////////////////////////////////////////////////////
119 // 114 //
120 // HistoryHandler 115 // HistoryHandler
121 // 116 //
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { 401 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) {
407 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + 402 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" +
408 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 403 EscapeQueryParamValue(UTF16ToUTF8(text), true));
409 } 404 }
410 405
411 // static 406 // static
412 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { 407 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() {
413 return ResourceBundle::GetSharedInstance(). 408 return ResourceBundle::GetSharedInstance().
414 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 409 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
415 } 410 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/gpu_internals_ui.cc ('k') | chrome/browser/ui/webui/media/media_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698