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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 2231353002: Make FileReader return ownership of the string content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 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
« no previous file with comments | « no previous file | extensions/browser/api/execute_code_function.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 extensions::ExtensionResource resource = resources_.front(); 185 extensions::ExtensionResource resource = resources_.front();
186 resources_.pop(); 186 resources_.pop();
187 scoped_refptr<FileReader> reader(new FileReader(resource, base::Bind( 187 scoped_refptr<FileReader> reader(new FileReader(resource, base::Bind(
188 &ContentScriptLoader::OnFileLoaded, base::Unretained(this)))); 188 &ContentScriptLoader::OnFileLoaded, base::Unretained(this))));
189 reader->Start(); 189 reader->Start();
190 } 190 }
191 191
192 private: 192 private:
193 void OnFileLoaded(bool success, const std::string& data) { 193 void OnFileLoaded(bool success, std::unique_ptr<std::string> data) {
194 if (success) { 194 if (success) {
195 RenderViewHost* render_view_host = 195 RenderViewHost* render_view_host =
196 RenderViewHost::FromID(render_process_id_, render_view_id_); 196 RenderViewHost::FromID(render_process_id_, render_view_id_);
197 if (render_view_host) 197 if (render_view_host)
198 ExecuteScriptHelper(render_view_host, data, extension_id_); 198 ExecuteScriptHelper(render_view_host, *data, extension_id_);
199 } 199 }
200 Run(); 200 Run();
201 } 201 }
202 202
203 std::string extension_id_; 203 std::string extension_id_;
204 int render_process_id_; 204 int render_process_id_;
205 int render_view_id_; 205 int render_view_id_;
206 std::queue<extensions::ExtensionResource> resources_; 206 std::queue<extensions::ExtensionResource> resources_;
207 }; 207 };
208 208
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 content::BrowserContext* context) { 1541 content::BrowserContext* context) {
1542 keyboard_listener_extension_id_ = id; 1542 keyboard_listener_extension_id_ = id;
1543 1543
1544 extensions::ExtensionRegistry* registry = 1544 extensions::ExtensionRegistry* registry =
1545 extensions::ExtensionRegistry::Get(context); 1545 extensions::ExtensionRegistry::Get(context);
1546 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1546 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1547 extension_registry_observer_.Add(registry); 1547 extension_registry_observer_.Add(registry);
1548 } 1548 }
1549 1549
1550 } // namespace chromeos 1550 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/execute_code_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698