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_WEB_CONTENTS_IMPL_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ |
6 #define HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include "headless/public/headless_web_contents.h" | 8 #include "headless/public/headless_web_contents.h" |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 class Size; | 23 class Size; |
24 } | 24 } |
25 | 25 |
26 namespace headless { | 26 namespace headless { |
27 class WebContentsObserverAdapter; | 27 class WebContentsObserverAdapter; |
28 | 28 |
29 class HeadlessWebContentsImpl : public HeadlessWebContents { | 29 class HeadlessWebContentsImpl : public HeadlessWebContents { |
30 public: | 30 public: |
| 31 HeadlessWebContentsImpl(content::BrowserContext* context, |
| 32 aura::Window* parent_window, |
| 33 const gfx::Size& initial_size); |
31 ~HeadlessWebContentsImpl() override; | 34 ~HeadlessWebContentsImpl() override; |
32 | 35 |
33 // HeadlessWebContents implementation: | 36 // HeadlessWebContents implementation: |
34 bool OpenURL(const GURL& url) override; | |
35 void AddObserver(Observer* observer) override; | 37 void AddObserver(Observer* observer) override; |
36 void RemoveObserver(Observer* observer) override; | 38 void RemoveObserver(Observer* observer) override; |
37 | 39 |
38 content::WebContents* web_contents() const; | 40 content::WebContents* web_contents() const; |
| 41 bool OpenURL(const GURL& url); |
39 | 42 |
40 private: | 43 private: |
41 friend class HeadlessBrowserImpl; | |
42 | |
43 HeadlessWebContentsImpl(content::BrowserContext* context, | |
44 aura::Window* parent_window, | |
45 const gfx::Size& initial_size); | |
46 | |
47 class Delegate; | 44 class Delegate; |
48 std::unique_ptr<Delegate> web_contents_delegate_; | 45 std::unique_ptr<Delegate> web_contents_delegate_; |
49 std::unique_ptr<content::WebContents> web_contents_; | 46 std::unique_ptr<content::WebContents> web_contents_; |
50 | 47 |
51 using ObserverMap = | 48 using ObserverMap = |
52 std::unordered_map<HeadlessWebContents::Observer*, | 49 std::unordered_map<HeadlessWebContents::Observer*, |
53 std::unique_ptr<WebContentsObserverAdapter>>; | 50 std::unique_ptr<WebContentsObserverAdapter>>; |
54 ObserverMap observer_map_; | 51 ObserverMap observer_map_; |
55 | 52 |
56 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); | 53 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); |
57 }; | 54 }; |
58 | 55 |
59 } // namespace headless | 56 } // namespace headless |
60 | 57 |
61 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ | 58 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |