Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ | 5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ | 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 // operations are delegated, and provides an interface for adding, removing, | 28 // operations are delegated, and provides an interface for adding, removing, |
| 29 // and clearing scripts. | 29 // and clearing scripts. |
| 30 class DeclarativeUserScriptMaster { | 30 class DeclarativeUserScriptMaster { |
| 31 public: | 31 public: |
| 32 DeclarativeUserScriptMaster(content::BrowserContext* browser_context, | 32 DeclarativeUserScriptMaster(content::BrowserContext* browser_context, |
| 33 const HostID& host_id); | 33 const HostID& host_id); |
| 34 ~DeclarativeUserScriptMaster(); | 34 ~DeclarativeUserScriptMaster(); |
| 35 | 35 |
| 36 // Adds script to shared memory region. This may not happen right away if a | 36 // Adds script to shared memory region. This may not happen right away if a |
| 37 // script load is in progress. | 37 // script load is in progress. |
| 38 void AddScript(const UserScript& script); | 38 void AddScript(std::unique_ptr<UserScript> script); |
| 39 | 39 |
| 40 // Adds a set of scripts to shared meomory region. The fetch of the content | 40 // Adds a set of scripts to shared meomory region. The fetch of the content |
| 41 // of the script on WebUI requires to start URL request to the associated | 41 // of the script on WebUI requires to start URL request to the associated |
| 42 // render specified by |render_process_id, render_frame_id|. | 42 // render specified by |render_process_id, render_frame_id|. |
| 43 // This may not happen right away if a script load is in progress. | 43 // This may not happen right away if a script load is in progress. |
| 44 void AddScripts(const std::vector<UserScript>& scripts, | 44 void AddScripts(std::vector<std::unique_ptr<UserScript>>& scripts, |
|
Devlin
2016/08/17 16:39:31
UserScriptList? Also I think style disallows pass
lazyboy
2016/08/17 18:55:52
UserScriptList is in user_script.h, which we're no
| |
| 45 int render_process_id, | 45 int render_process_id, |
| 46 int render_frame_id); | 46 int render_frame_id); |
| 47 | 47 |
| 48 // Removes script from shared memory region. This may not happen right away if | 48 // Removes script from shared memory region. This may not happen right away if |
| 49 // a script load is in progress. | 49 // a script load is in progress. |
| 50 void RemoveScript(const UserScript& script); | 50 void RemoveScript(const UserScriptIDPair& script); |
| 51 | 51 |
| 52 // Removes a set of scripts from shared memory region. This may not happen | 52 // Removes a set of scripts from shared memory region. This may not happen |
| 53 // right away if a script load is in progress. | 53 // right away if a script load is in progress. |
| 54 void RemoveScripts(const std::set<UserScriptIDPair>& scripts); | 54 void RemoveScripts(const std::set<UserScriptIDPair>& scripts); |
| 55 | 55 |
| 56 // Removes all scripts from shared memory region. This may not happen right | 56 // Removes all scripts from shared memory region. This may not happen right |
| 57 // away if a script load is in progress. | 57 // away if a script load is in progress. |
| 58 void ClearScripts(); | 58 void ClearScripts(); |
| 59 | 59 |
| 60 const HostID& host_id() const { return host_id_; } | 60 const HostID& host_id() const { return host_id_; } |
| 61 | 61 |
| 62 UserScriptLoader* loader() { return loader_.get(); } | 62 UserScriptLoader* loader() { return loader_.get(); } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // ID of host that owns scripts that this component manages. | 65 // ID of host that owns scripts that this component manages. |
| 66 HostID host_id_; | 66 HostID host_id_; |
| 67 | 67 |
| 68 // Script loader that handles loading contents of scripts into shared memory | 68 // Script loader that handles loading contents of scripts into shared memory |
| 69 // and notifying renderers of script updates. | 69 // and notifying renderers of script updates. |
| 70 std::unique_ptr<UserScriptLoader> loader_; | 70 std::unique_ptr<UserScriptLoader> loader_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); | 72 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace extensions | 75 } // namespace extensions |
| 76 | 76 |
| 77 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ | 77 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| OLD | NEW |