| 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_IMPL_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ |
| 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ |
| 7 | 7 |
| 8 #include "headless/public/headless_browser.h" | 8 #include "headless/public/headless_browser.h" |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <unordered_map> | 12 #include <unordered_map> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "headless/lib/browser/headless_devtools_manager_delegate.h" | 17 #include "headless/lib/browser/headless_devtools_manager_delegate.h" |
| 18 #include "headless/lib/browser/headless_web_contents_impl.h" | 18 #include "headless/lib/browser/headless_web_contents_impl.h" |
| 19 | 19 |
| 20 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
| 21 #include "headless/lib/browser/headless_window_tree_host.h" | 21 #include "headless/lib/browser/headless_window_tree_host.h" |
| 22 |
| 23 namespace aura { |
| 24 namespace client { |
| 25 class FocusClient; |
| 26 } |
| 27 } |
| 22 #endif | 28 #endif |
| 23 | 29 |
| 24 namespace headless { | 30 namespace headless { |
| 25 | 31 |
| 26 class HeadlessBrowserContextImpl; | 32 class HeadlessBrowserContextImpl; |
| 27 class HeadlessBrowserMainParts; | 33 class HeadlessBrowserMainParts; |
| 28 | 34 |
| 29 class HeadlessBrowserImpl : public HeadlessBrowser { | 35 class HeadlessBrowserImpl : public HeadlessBrowser { |
| 30 public: | 36 public: |
| 31 HeadlessBrowserImpl( | 37 HeadlessBrowserImpl( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void PlatformCreateWindow(); | 80 void PlatformCreateWindow(); |
| 75 void PlatformInitializeWebContents(const gfx::Size& initial_size, | 81 void PlatformInitializeWebContents(const gfx::Size& initial_size, |
| 76 content::WebContents* web_contents); | 82 content::WebContents* web_contents); |
| 77 | 83 |
| 78 protected: | 84 protected: |
| 79 #if defined(USE_AURA) | 85 #if defined(USE_AURA) |
| 80 // TODO(eseckler): Currently one window and one window_tree_host | 86 // TODO(eseckler): Currently one window and one window_tree_host |
| 81 // is used for all web contents. We should probably use one | 87 // is used for all web contents. We should probably use one |
| 82 // window per web contents, but additional investigation is needed. | 88 // window per web contents, but additional investigation is needed. |
| 83 std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_; | 89 std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_; |
| 90 std::unique_ptr<aura::client::FocusClient> focus_client_; |
| 84 #endif | 91 #endif |
| 92 |
| 85 base::Callback<void(HeadlessBrowser*)> on_start_callback_; | 93 base::Callback<void(HeadlessBrowser*)> on_start_callback_; |
| 86 HeadlessBrowser::Options options_; | 94 HeadlessBrowser::Options options_; |
| 87 HeadlessBrowserMainParts* browser_main_parts_; // Not owned. | 95 HeadlessBrowserMainParts* browser_main_parts_; // Not owned. |
| 88 | 96 |
| 89 std::unordered_map<std::string, std::unique_ptr<HeadlessBrowserContextImpl>> | 97 std::unordered_map<std::string, std::unique_ptr<HeadlessBrowserContextImpl>> |
| 90 browser_contexts_; | 98 browser_contexts_; |
| 91 HeadlessBrowserContext* default_browser_context_; // Not owned. | 99 HeadlessBrowserContext* default_browser_context_; // Not owned. |
| 92 | 100 |
| 93 base::WeakPtrFactory<HeadlessBrowserImpl> weak_ptr_factory_; | 101 base::WeakPtrFactory<HeadlessBrowserImpl> weak_ptr_factory_; |
| 94 | 102 |
| 95 private: | 103 private: |
| 96 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImpl); | 104 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImpl); |
| 97 }; | 105 }; |
| 98 | 106 |
| 99 } // namespace headless | 107 } // namespace headless |
| 100 | 108 |
| 101 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ | 109 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ |
| OLD | NEW |