OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/linked_ptr.h" |
| 12 |
| 13 class Profile; |
| 14 |
| 15 namespace extensions { |
| 16 class DeclarativeUserScriptMaster; |
| 17 |
| 18 // Manages a set of DeclarativeUserScriptMaster objects for script injections. |
| 19 class DeclarativeUserScriptManager { |
| 20 public: |
| 21 explicit DeclarativeUserScriptManager(Profile* profile); |
| 22 ~DeclarativeUserScriptManager(); |
| 23 |
| 24 // Get the user script master for declarative scripts; if one does not exist, |
| 25 // a new object will be created. |
| 26 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( |
| 27 const std::string& id); |
| 28 |
| 29 private: |
| 30 using UserScriptMasterMap = |
| 31 std::map<std::string, linked_ptr<DeclarativeUserScriptMaster>>; |
| 32 |
| 33 // A map of DeclarativeUserScriptMasters for ids; each master is lazily |
| 34 // initialized. |
| 35 UserScriptMasterMap declarative_user_script_masters_; |
| 36 |
| 37 Profile* profile_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager); |
| 40 }; |
| 41 |
| 42 } // extensions |
| 43 |
| 44 #endif // CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
OLD | NEW |