| 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 #ifndef CHROME_RENDERER_GREASEMONKEY_SLAVE_H__ | 5 #ifndef CHROME_RENDERER_GREASEMONKEY_SLAVE_H_ |
| 6 #define CHROME_RENDERER_GREASEMONKEY_SLAVE_H__ | 6 #define CHROME_RENDERER_GREASEMONKEY_SLAVE_H_ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "testing/gtest/include/gtest/gtest_prod.h" | 12 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 13 #include "webkit/glue/webframe.h" | 13 #include "webkit/glue/webframe.h" |
| 14 | 14 |
| 15 | 15 |
| 16 // Parsed representation of a Greasemonkey script. | 16 // Parsed representation of a Greasemonkey script. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 std::vector<std::string> include_patterns_; | 68 std::vector<std::string> include_patterns_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 | 71 |
| 72 // Manages installed GreasemonkeyScripts for a render process. | 72 // Manages installed GreasemonkeyScripts for a render process. |
| 73 class GreasemonkeySlave { | 73 class GreasemonkeySlave { |
| 74 public: | 74 public: |
| 75 GreasemonkeySlave(); | 75 GreasemonkeySlave(); |
| 76 | 76 |
| 77 // Update the parsed scripts from shared memory. | 77 // Update the parsed scripts from shared memory. |
| 78 bool UpdateScripts(SharedMemoryHandle shared_memory); | 78 bool UpdateScripts(base::SharedMemoryHandle shared_memory); |
| 79 | 79 |
| 80 // Inject the appropriate scripts into a frame based on its URL. | 80 // Inject the appropriate scripts into a frame based on its URL. |
| 81 // TODO(aa): Extract a GreasemonkeyFrame interface out of this to improve | 81 // TODO(aa): Extract a GreasemonkeyFrame interface out of this to improve |
| 82 // testability. | 82 // testability. |
| 83 bool InjectScripts(WebFrame* frame); | 83 bool InjectScripts(WebFrame* frame); |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 // Shared memory containing raw script data. | 86 // Shared memory containing raw script data. |
| 87 scoped_ptr<SharedMemory> shared_memory_; | 87 scoped_ptr<base::SharedMemory> shared_memory_; |
| 88 | 88 |
| 89 // Parsed script data. | 89 // Parsed script data. |
| 90 std::vector<GreasemonkeyScript> scripts_; | 90 std::vector<GreasemonkeyScript> scripts_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(GreasemonkeySlave); | 92 DISALLOW_COPY_AND_ASSIGN(GreasemonkeySlave); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 #endif // CHROME_RENDERER_GREASEMONKEY_SLAVE_H__ | 95 #endif // CHROME_RENDERER_GREASEMONKEY_SLAVE_H_ |
| OLD | NEW |