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