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

Side by Side Diff: chrome/browser/ui/webui/options2/options_ui2.cc

Issue 10272004: Move RefCountedMemory class to base namespace. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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/options2/options_ui2.h ('k') | chrome/browser/ui/webui/plugins_ui.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options2/options_ui2.h" 5 #include "chrome/browser/ui/webui/options2/options_ui2.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) 131 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings)
132 : DataSource(chrome::kChromeUISettingsFrameHost, MessageLoop::current()) { 132 : DataSource(chrome::kChromeUISettingsFrameHost, MessageLoop::current()) {
133 DCHECK(localized_strings); 133 DCHECK(localized_strings);
134 localized_strings_.reset(localized_strings); 134 localized_strings_.reset(localized_strings);
135 } 135 }
136 136
137 void OptionsUIHTMLSource::StartDataRequest(const std::string& path, 137 void OptionsUIHTMLSource::StartDataRequest(const std::string& path,
138 bool is_incognito, 138 bool is_incognito,
139 int request_id) { 139 int request_id) {
140 scoped_refptr<RefCountedMemory> response_bytes; 140 scoped_refptr<base::RefCountedMemory> response_bytes;
141 SetFontAndTextDirection(localized_strings_.get()); 141 SetFontAndTextDirection(localized_strings_.get());
142 142
143 if (path == kLocalizedStringsFile) { 143 if (path == kLocalizedStringsFile) {
144 // Return dynamically-generated strings from memory. 144 // Return dynamically-generated strings from memory.
145 std::string strings_js; 145 std::string strings_js;
146 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); 146 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js);
147 response_bytes = base::RefCountedString::TakeString(&strings_js); 147 response_bytes = base::RefCountedString::TakeString(&strings_js);
148 } else if (path == kOptionsBundleJsFile) { 148 } else if (path == kOptionsBundleJsFile) {
149 // Return (and cache) the options javascript code. 149 // Return (and cache) the options javascript code.
150 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 150 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 continue; 353 continue;
354 DictionaryValue* entry = new DictionaryValue(); 354 DictionaryValue* entry = new DictionaryValue();
355 entry->SetString("title", match.description); 355 entry->SetString("title", match.description);
356 entry->SetString("displayURL", match.contents); 356 entry->SetString("displayURL", match.contents);
357 entry->SetString("url", match.destination_url.spec()); 357 entry->SetString("url", match.destination_url.spec());
358 suggestions->Append(entry); 358 suggestions->Append(entry);
359 } 359 }
360 } 360 }
361 361
362 // static 362 // static
363 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { 363 base::RefCountedMemory* OptionsUI::GetFaviconResourceBytes() {
364 return ResourceBundle::GetSharedInstance(). 364 return ResourceBundle::GetSharedInstance().
365 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); 365 LoadDataResourceBytes(IDR_SETTINGS_FAVICON);
366 } 366 }
367 367
368 void OptionsUI::InitializeHandlers() { 368 void OptionsUI::InitializeHandlers() {
369 Profile* profile = Profile::FromWebUI(web_ui()); 369 Profile* profile = Profile::FromWebUI(web_ui());
370 DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession()); 370 DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession());
371 371
372 // A new web page DOM has been brought up in an existing renderer, causing 372 // A new web page DOM has been brought up in an existing renderer, causing
373 // this method to be called twice. If that happens, ignore the second call. 373 // this method to be called twice. If that happens, ignore the second call.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); 408 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString());
409 #else 409 #else
410 command_line_string = 410 command_line_string =
411 CommandLine::ForCurrentProcess()->GetCommandLineString(); 411 CommandLine::ForCurrentProcess()->GetCommandLineString();
412 #endif 412 #endif
413 413
414 render_view_host->SetWebUIProperty("commandLineString", command_line_string); 414 render_view_host->SetWebUIProperty("commandLineString", command_line_string);
415 } 415 }
416 416
417 } // namespace options2 417 } // namespace options2
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/options_ui2.h ('k') | chrome/browser/ui/webui/plugins_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698