Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: headless/lib/browser/headless_browser_impl.h

Issue 2709433002: Add HeadlessFocusClient to fix document.hasFocus() issues. (Closed)
Patch Set: Set FocusClient and add test Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #endif 22 #endif
23 23
24 namespace aura {
Eric Seckler 2017/02/22 09:00:04 nit: let's move this into the "#if defined(USE_AUR
irisu 2017/02/23 00:02:26 Done.
25 namespace client {
26 class FocusClient;
27 }
28 }
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(
32 const base::Callback<void(HeadlessBrowser*)>& on_start_callback, 38 const base::Callback<void(HeadlessBrowser*)>& on_start_callback,
33 HeadlessBrowser::Options options); 39 HeadlessBrowser::Options options);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_;
91
Eric Seckler 2017/02/22 09:00:04 nit: move blank line after "#endif"
irisu 2017/02/23 00:02:26 Done.
84 #endif 92 #endif
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_
OLDNEW
« no previous file with comments | « no previous file | headless/lib/browser/headless_browser_impl.cc » ('j') | headless/lib/browser/headless_browser_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698