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

Side by Side Diff: chrome/browser/ui/webui/sessions_ui.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit_tests 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/sessions_ui.h" 5 #include "chrome/browser/ui/webui/sessions_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/engine/syncapi.h" 8 #include "chrome/browser/sync/engine/syncapi.h"
9 #include "chrome/browser/sync/glue/session_model_associator.h" 9 #include "chrome/browser/sync/glue/session_model_associator.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); 70 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings);
71 71
72 static const base::StringPiece sessions_html( 72 static const base::StringPiece sessions_html(
73 ResourceBundle::GetSharedInstance(). 73 ResourceBundle::GetSharedInstance().
74 GetRawDataResource(IDR_SESSIONS_HTML)); 74 GetRawDataResource(IDR_SESSIONS_HTML));
75 std::string full_html = 75 std::string full_html =
76 jstemplate_builder::GetI18nTemplateHtml(sessions_html, 76 jstemplate_builder::GetI18nTemplateHtml(sessions_html,
77 &localized_strings); 77 &localized_strings);
78 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); 78 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
79 79
80 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 80 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
81 html_bytes->data.resize(full_html.size());
82 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
83
84 SendResponse(request_id, html_bytes);
85 } 81 }
86 82
87 //////////////////////////////////////////////////////////////////////////////// 83 ////////////////////////////////////////////////////////////////////////////////
88 // 84 //
89 // SessionsDOMHandler 85 // SessionsDOMHandler
90 // 86 //
91 //////////////////////////////////////////////////////////////////////////////// 87 ////////////////////////////////////////////////////////////////////////////////
92 88
93 // The handler for Javascript messages for the chrome://sessions/ page. 89 // The handler for Javascript messages for the chrome://sessions/ page.
94 class SessionsDOMHandler : public WebUIMessageHandler { 90 class SessionsDOMHandler : public WebUIMessageHandler {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 285
290 // Set up the chrome://sessions/ source. 286 // Set up the chrome://sessions/ source.
291 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 287 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
292 } 288 }
293 289
294 // static 290 // static
295 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { 291 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() {
296 return ResourceBundle::GetSharedInstance(). 292 return ResourceBundle::GetSharedInstance().
297 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 293 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
298 } 294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698