| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // Helper function to parse greasesmonkey headers | 25 // Helper function to parse greasesmonkey headers |
| 26 static bool GetDeclarationValue(const StringPiece& line, | 26 static bool GetDeclarationValue(const StringPiece& line, |
| 27 const StringPiece& prefix, | 27 const StringPiece& prefix, |
| 28 std::string* value) { | 28 std::string* value) { |
| 29 if (!line.starts_with(prefix)) | 29 if (!line.starts_with(prefix)) |
| 30 return false; | 30 return false; |
| 31 | 31 |
| 32 std::string temp(line.data() + prefix.length(), | 32 std::string temp(line.data() + prefix.length(), |
| 33 line.length() - prefix.length()); | 33 line.length() - prefix.length()); |
| 34 TrimWhitespace(temp, TRIM_ALL, value); | 34 TrimWhitespaceASCII(temp, TRIM_ALL, value); |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 UserScriptMaster::ScriptReloader::ScriptReloader(UserScriptMaster* master) | 38 UserScriptMaster::ScriptReloader::ScriptReloader(UserScriptMaster* master) |
| 39 : master_(master), | 39 : master_(master), |
| 40 master_message_loop_(MessageLoop::current()) { | 40 master_message_loop_(MessageLoop::current()) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 // static | 43 // static |
| 44 bool UserScriptMaster::ScriptReloader::ParseMetadataHeader( | 44 bool UserScriptMaster::ScriptReloader::ParseMetadataHeader( |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 DCHECK(false); | 380 DCHECK(false); |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 void UserScriptMaster::StartScan() { | 384 void UserScriptMaster::StartScan() { |
| 385 if (!script_reloader_) | 385 if (!script_reloader_) |
| 386 script_reloader_ = new ScriptReloader(this); | 386 script_reloader_ = new ScriptReloader(this); |
| 387 | 387 |
| 388 script_reloader_->StartScan(worker_loop_, user_script_dir_, lone_scripts_); | 388 script_reloader_->StartScan(worker_loop_, user_script_dir_, lone_scripts_); |
| 389 } | 389 } |
| OLD | NEW |