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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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) 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/profiler_ui.h" 5 #include "chrome/browser/ui/webui/profiler_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 // When testing the javacript code, it is cumbersome to have to keep 9 // When testing the javacript code, it is cumbersome to have to keep
10 // re-building the resouces package and reloading the browser. To solve 10 // re-building the resouces package and reloading the browser. To solve
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 // If no resource was specified, default to profiler.html. 78 // If no resource was specified, default to profiler.html.
79 std::string filename = path.empty() ? "profiler.html" : path; 79 std::string filename = path.empty() ? "profiler.html" : path;
80 80
81 base::FilePath file_path; 81 base::FilePath file_path;
82 file_path = base_path.AppendASCII(filename); 82 file_path = base_path.AppendASCII(filename);
83 83
84 // Read the file synchronously and send it as the response. 84 // Read the file synchronously and send it as the response.
85 base::ThreadRestrictions::ScopedAllowIO allow; 85 base::ThreadRestrictions::ScopedAllowIO allow;
86 std::string file_contents; 86 std::string file_contents;
87 if (!file_util::ReadFileToString(file_path, &file_contents)) 87 if (!base::ReadFileToString(file_path, &file_contents))
88 LOG(ERROR) << "Couldn't read file: " << file_path.value(); 88 LOG(ERROR) << "Couldn't read file: " << file_path.value();
89 scoped_refptr<base::RefCountedString> response = 89 scoped_refptr<base::RefCountedString> response =
90 new base::RefCountedString(); 90 new base::RefCountedString();
91 response->data() = file_contents; 91 response->data() = file_contents;
92 callback.Run(response); 92 callback.Run(response);
93 } 93 }
94 94
95 private: 95 private:
96 DISALLOW_COPY_AND_ASSIGN(ProfilerWebUIDataSource); 96 DISALLOW_COPY_AND_ASSIGN(ProfilerWebUIDataSource);
97 }; 97 };
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 int process_type) { 176 int process_type) {
177 // Serialize the data to JSON. 177 // Serialize the data to JSON.
178 DictionaryValue json_data; 178 DictionaryValue json_data;
179 task_profiler::TaskProfilerDataSerializer::ToValue(profiler_data, 179 task_profiler::TaskProfilerDataSerializer::ToValue(profiler_data,
180 process_type, 180 process_type,
181 &json_data); 181 &json_data);
182 182
183 // Send the data to the renderer. 183 // Send the data to the renderer.
184 web_ui()->CallJavascriptFunction("g_browserBridge.receivedData", json_data); 184 web_ui()->CallJavascriptFunction("g_browserBridge.receivedData", json_data);
185 } 185 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/certificate_manager_handler.cc ('k') | chrome/browser/upload_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698