| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ |
| 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 content::BrowserContext* browser_context); | 35 content::BrowserContext* browser_context); |
| 36 | 36 |
| 37 static std::unique_ptr<HeadlessBrowserContextImpl> Create( | 37 static std::unique_ptr<HeadlessBrowserContextImpl> Create( |
| 38 HeadlessBrowserContext::Builder* builder); | 38 HeadlessBrowserContext::Builder* builder); |
| 39 | 39 |
| 40 // HeadlessBrowserContext implementation: | 40 // HeadlessBrowserContext implementation: |
| 41 HeadlessWebContents::Builder CreateWebContentsBuilder() override; | 41 HeadlessWebContents::Builder CreateWebContentsBuilder() override; |
| 42 std::vector<HeadlessWebContents*> GetAllWebContents() override; | 42 std::vector<HeadlessWebContents*> GetAllWebContents() override; |
| 43 HeadlessWebContents* GetWebContentsForDevToolsAgentHostId( | 43 HeadlessWebContents* GetWebContentsForDevToolsAgentHostId( |
| 44 const std::string& devtools_agent_host_id) override; | 44 const std::string& devtools_agent_host_id) override; |
| 45 int GetFrameTreeNodeId(int render_process_id, |
| 46 int render_frame_id) const override; |
| 45 void Close() override; | 47 void Close() override; |
| 46 const std::string& Id() const override; | 48 const std::string& Id() const override; |
| 47 | 49 |
| 50 void SetFrameTreeNodeId(int render_process_id, |
| 51 int render_frame_id, |
| 52 int frame_tree_node_id); |
| 53 |
| 54 void RemoveFrameTreeNode(int render_process_id, int render_frame_id); |
| 55 |
| 48 // BrowserContext implementation: | 56 // BrowserContext implementation: |
| 49 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( | 57 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( |
| 50 const base::FilePath& partition_path) override; | 58 const base::FilePath& partition_path) override; |
| 51 base::FilePath GetPath() const override; | 59 base::FilePath GetPath() const override; |
| 52 bool IsOffTheRecord() const override; | 60 bool IsOffTheRecord() const override; |
| 53 content::ResourceContext* GetResourceContext() override; | 61 content::ResourceContext* GetResourceContext() override; |
| 54 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; | 62 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; |
| 55 content::BrowserPluginGuestManager* GetGuestManager() override; | 63 content::BrowserPluginGuestManager* GetGuestManager() override; |
| 56 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; | 64 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; |
| 57 content::PushMessagingService* GetPushMessagingService() override; | 65 content::PushMessagingService* GetPushMessagingService() override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void InitWhileIOAllowed(); | 99 void InitWhileIOAllowed(); |
| 92 | 100 |
| 93 HeadlessBrowserImpl* browser_; // Not owned. | 101 HeadlessBrowserImpl* browser_; // Not owned. |
| 94 std::unique_ptr<HeadlessBrowserContextOptions> context_options_; | 102 std::unique_ptr<HeadlessBrowserContextOptions> context_options_; |
| 95 std::unique_ptr<HeadlessResourceContext> resource_context_; | 103 std::unique_ptr<HeadlessResourceContext> resource_context_; |
| 96 base::FilePath path_; | 104 base::FilePath path_; |
| 97 | 105 |
| 98 std::unordered_map<std::string, std::unique_ptr<HeadlessWebContents>> | 106 std::unordered_map<std::string, std::unique_ptr<HeadlessWebContents>> |
| 99 web_contents_map_; | 107 web_contents_map_; |
| 100 | 108 |
| 109 mutable base::Lock frame_tree_node_map_lock_; // Guards frame_tree_node_map_ |
| 110 std::map<std::pair<int, int>, int> frame_tree_node_map_; |
| 111 |
| 101 std::unique_ptr<content::PermissionManager> permission_manager_; | 112 std::unique_ptr<content::PermissionManager> permission_manager_; |
| 102 | 113 |
| 103 std::string id_; | 114 std::string id_; |
| 104 | 115 |
| 105 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl); | 116 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl); |
| 106 }; | 117 }; |
| 107 | 118 |
| 108 } // namespace headless | 119 } // namespace headless |
| 109 | 120 |
| 110 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ | 121 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ |
| OLD | NEW |