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_PUBLIC_HEADLESS_WEB_CONTENTS_H_ |
| 6 #define HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "headless/public/headless_export.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace headless { |
| 15 |
| 16 // Class representing contents of a browser tab. Should be accessed from browser |
| 17 // main thread. |
| 18 class HEADLESS_EXPORT HeadlessWebContents { |
| 19 public: |
| 20 virtual ~HeadlessWebContents() {} |
| 21 |
| 22 // TODO(skyostil): Replace this with an equivalent client API. |
| 23 class Observer { |
| 24 public: |
| 25 // Will be called on browser thread. |
| 26 virtual void DocumentOnLoadCompletedInMainFrame() = 0; |
| 27 |
| 28 protected: |
| 29 Observer() {} |
| 30 virtual ~Observer() {} |
| 31 |
| 32 private: |
| 33 DISALLOW_COPY_AND_ASSIGN(Observer); |
| 34 }; |
| 35 |
| 36 // TODO(skyostil): Replace this with an equivalent client API. |
| 37 virtual bool OpenURL(const GURL& url) = 0; |
| 38 |
| 39 // Add or remove an observer to receive events from this WebContents. |
| 40 // |observer| must outlive this class or be removed prior to being destroyed. |
| 41 virtual void AddObserver(Observer* observer) = 0; |
| 42 virtual void RemoveObserver(Observer* observer) = 0; |
| 43 |
| 44 private: |
| 45 friend class HeadlessWebContentsImpl; |
| 46 HeadlessWebContents() {} |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContents); |
| 49 }; |
| 50 |
| 51 } // namespace headless |
| 52 |
| 53 #endif // HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ |
OLD | NEW |