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

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: 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/sessions_ui.h" 5 #include "chrome/browser/ui/webui/sessions_ui.h"
6 6
7 #include <algorithm>
8
7 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/engine/syncapi.h" 10 #include "chrome/browser/sync/engine/syncapi.h"
9 #include "chrome/browser/sync/glue/session_model_associator.h" 11 #include "chrome/browser/sync/glue/session_model_associator.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
12 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 14 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
13 #include "chrome/common/chrome_version_info.h" 15 #include "chrome/common/chrome_version_info.h"
14 #include "chrome/common/jstemplate_builder.h" 16 #include "chrome/common/jstemplate_builder.h"
15 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
16 #include "content/browser/webui/web_ui.h" 18 #include "content/browser/webui/web_ui.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); 72 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings);
71 73
72 static const base::StringPiece sessions_html( 74 static const base::StringPiece sessions_html(
73 ResourceBundle::GetSharedInstance(). 75 ResourceBundle::GetSharedInstance().
74 GetRawDataResource(IDR_SESSIONS_HTML)); 76 GetRawDataResource(IDR_SESSIONS_HTML));
75 std::string full_html = 77 std::string full_html =
76 jstemplate_builder::GetI18nTemplateHtml(sessions_html, 78 jstemplate_builder::GetI18nTemplateHtml(sessions_html,
77 &localized_strings); 79 &localized_strings);
78 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); 80 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
79 81
80 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 82 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 } 83 }
86 84
87 //////////////////////////////////////////////////////////////////////////////// 85 ////////////////////////////////////////////////////////////////////////////////
88 // 86 //
89 // SessionsDOMHandler 87 // SessionsDOMHandler
90 // 88 //
91 //////////////////////////////////////////////////////////////////////////////// 89 ////////////////////////////////////////////////////////////////////////////////
92 90
93 // The handler for Javascript messages for the chrome://sessions/ page. 91 // The handler for Javascript messages for the chrome://sessions/ page.
94 class SessionsDOMHandler : public WebUIMessageHandler { 92 class SessionsDOMHandler : public WebUIMessageHandler {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 287
290 // Set up the chrome://sessions/ source. 288 // Set up the chrome://sessions/ source.
291 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 289 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
292 } 290 }
293 291
294 // static 292 // static
295 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { 293 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() {
296 return ResourceBundle::GetSharedInstance(). 294 return ResourceBundle::GetSharedInstance().
297 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 295 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
298 } 296 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_data_source.cc ('k') | chrome/browser/ui/webui/sync_internals_html_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698