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_WEB_CONTENTS_H_ |
| 6 #define HEADLESS_PUBLIC_WEB_CONTENTS_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "headless/public/headless_export.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 class SkBitmap; |
| 14 |
| 15 namespace headless { |
| 16 |
| 17 class WebFrame; |
| 18 |
| 19 class HEADLESS_EXPORT WebContents { |
| 20 public: |
| 21 class Observer { |
| 22 public: |
| 23 // Will be called on browser thread. |
| 24 virtual void DocumentOnLoadCompletedInMainFrame() = 0; |
| 25 |
| 26 protected: |
| 27 Observer(WebContents* web_contents); |
| 28 virtual ~Observer(); |
| 29 |
| 30 private: |
| 31 class ObserverImpl; |
| 32 scoped_ptr<ObserverImpl> observer_; |
| 33 }; |
| 34 |
| 35 // Returns main frame for web page. |
| 36 // Should be called on browser main thread. |
| 37 virtual scoped_ptr<WebFrame> main_frame(); |
| 38 |
| 39 // Requests browser tab to nagivate to given url. |
| 40 // Should be called on browser main thread. |
| 41 virtual void OpenURL(const GURL& url); |
| 42 |
| 43 using ScreenshotCallback = base::Callback<void(scoped_ptr<SkBitmap>)>; |
| 44 // Requests an image of web contents. |
| 45 // Should be called on browser main thread. |
| 46 virtual void GetScreenshot(const ScreenshotCallback& callback); |
| 47 |
| 48 protected: |
| 49 virtual ~WebContents() {} |
| 50 }; |
| 51 |
| 52 } // namespace headless |
| 53 |
| 54 #endif // HEADLESS_PUBLIC_WEB_CONTENTS_H_ |
OLD | NEW |