| OLD | NEW |
| 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 <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/pickle.h" | 14 #include "base/pickle.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/version.h" | 18 #include "base/version.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_file_util.h" | 23 #include "chrome/common/extensions/extension_file_util.h" |
| 24 #include "chrome/common/extensions/extension_message_bundle.h" | 24 #include "chrome/common/extensions/extension_message_bundle.h" |
| 25 #include "chrome/common/extensions/extension_resource.h" | 25 #include "chrome/common/extensions/extension_resource.h" |
| 26 #include "chrome/common/extensions/extension_set.h" | 26 #include "chrome/common/extensions/extension_set.h" |
| 27 #include "content/browser/renderer_host/render_process_host.h" | 27 #include "content/browser/renderer_host/render_process_host.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 | 29 |
| 30 using content::BrowserThread; |
| 31 |
| 30 // Helper function to parse greasesmonkey headers | 32 // Helper function to parse greasesmonkey headers |
| 31 static bool GetDeclarationValue(const base::StringPiece& line, | 33 static bool GetDeclarationValue(const base::StringPiece& line, |
| 32 const base::StringPiece& prefix, | 34 const base::StringPiece& prefix, |
| 33 std::string* value) { | 35 std::string* value) { |
| 34 base::StringPiece::size_type index = line.find(prefix); | 36 base::StringPiece::size_type index = line.find(prefix); |
| 35 if (index == base::StringPiece::npos) | 37 if (index == base::StringPiece::npos) |
| 36 return false; | 38 return false; |
| 37 | 39 |
| 38 std::string temp(line.data() + index + prefix.length(), | 40 std::string temp(line.data() + index + prefix.length(), |
| 39 line.length() - index - prefix.length()); | 41 line.length() - index - prefix.length()); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (!handle) | 423 if (!handle) |
| 422 return; | 424 return; |
| 423 | 425 |
| 424 base::SharedMemoryHandle handle_for_process; | 426 base::SharedMemoryHandle handle_for_process; |
| 425 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 427 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |
| 426 return; // This can legitimately fail if the renderer asserts at startup. | 428 return; // This can legitimately fail if the renderer asserts at startup. |
| 427 | 429 |
| 428 if (base::SharedMemory::IsHandleValid(handle_for_process)) | 430 if (base::SharedMemory::IsHandleValid(handle_for_process)) |
| 429 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); | 431 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); |
| 430 } | 432 } |
| OLD | NEW |