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

Side by Side Diff: chrome/browser/extensions/user_script_master.cc

Issue 6735004: Move extension messages to their own file and add a RenderViewObserver to start moving the extens... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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/extensions/user_script_master.h" 5 #include "chrome/browser/extensions/user_script_master.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 } 232 }
233 233
234 // Pickle user scripts and return pointer to the shared memory. 234 // Pickle user scripts and return pointer to the shared memory.
235 static base::SharedMemory* Serialize(const UserScriptList& scripts) { 235 static base::SharedMemory* Serialize(const UserScriptList& scripts) {
236 Pickle pickle; 236 Pickle pickle;
237 pickle.WriteSize(scripts.size()); 237 pickle.WriteSize(scripts.size());
238 for (size_t i = 0; i < scripts.size(); i++) { 238 for (size_t i = 0; i < scripts.size(); i++) {
239 const UserScript& script = scripts[i]; 239 const UserScript& script = scripts[i];
240 // TODO(aa): This can be replaced by sending content script metadata to 240 // TODO(aa): This can be replaced by sending content script metadata to
241 // renderers along with other extension data in ViewMsg_ExtensionLoaded. 241 // renderers along with other extension data in ExtensionMsg_Loaded.
242 // See crbug.com/70516. 242 // See crbug.com/70516.
243 script.Pickle(&pickle); 243 script.Pickle(&pickle);
244 // Write scripts as 'data' so that we can read it out in the slave without 244 // Write scripts as 'data' so that we can read it out in the slave without
245 // allocating a new string. 245 // allocating a new string.
246 for (size_t j = 0; j < script.js_scripts().size(); j++) { 246 for (size_t j = 0; j < script.js_scripts().size(); j++) {
247 base::StringPiece contents = script.js_scripts()[j].GetContent(); 247 base::StringPiece contents = script.js_scripts()[j].GetContent();
248 pickle.WriteData(contents.data(), contents.length()); 248 pickle.WriteData(contents.data(), contents.length());
249 } 249 }
250 for (size_t j = 0; j < script.css_scripts().size(); j++) { 250 for (size_t j = 0; j < script.css_scripts().size(); j++) {
251 base::StringPiece contents = script.css_scripts()[j].GetContent(); 251 base::StringPiece contents = script.css_scripts()[j].GetContent();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 DCHECK(false); 398 DCHECK(false);
399 } 399 }
400 } 400 }
401 401
402 void UserScriptMaster::StartScan() { 402 void UserScriptMaster::StartScan() {
403 if (!script_reloader_) 403 if (!script_reloader_)
404 script_reloader_ = new ScriptReloader(this); 404 script_reloader_ = new ScriptReloader(this);
405 405
406 script_reloader_->StartScan(user_script_dir_, lone_scripts_); 406 script_reloader_->StartScan(user_script_dir_, lone_scripts_);
407 } 407 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.cc ('k') | chrome/browser/notifications/balloon_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698