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 content { | |
16 class WebContents; | |
17 } | |
18 | |
19 namespace headless { | |
20 class WebFrame; | |
21 | |
22 class HEADLESS_EXPORT WebContents { | |
Sami
2015/12/01 14:03:58
Could just have a top-level comment here that says
altimin
2015/12/01 15:17:29
Done.
| |
23 public: | |
24 virtual ~WebContents() {} | |
25 | |
26 class Observer { | |
Sami
2015/12/01 14:03:58
How do you set the observer? Can you have several?
| |
27 public: | |
28 // Will be called on browser thread. | |
29 virtual void DocumentOnLoadCompletedInMainFrame() = 0; | |
30 | |
31 // TODO(altimin): More OnSomething() methods will go here. | |
32 | |
33 protected: | |
34 explicit Observer(WebContents* web_contents); | |
35 virtual ~Observer(); | |
36 | |
37 private: | |
38 class ObserverImpl; | |
39 scoped_ptr<ObserverImpl> observer_; | |
Sami
2015/12/01 14:03:58
DISALLOW_COPY_AND_ASSIGN
altimin
2015/12/01 15:17:29
Done.
| |
40 }; | |
41 | |
42 // Returns main frame for web page. | |
43 // Should be called on browser main thread. | |
44 virtual scoped_ptr<WebFrame> main_frame() = 0; | |
Sami
2015/12/01 14:03:58
I don't think we can return a scoped_ptr here. Tha
altimin
2015/12/01 15:17:29
Done.
| |
45 | |
46 // Requests browser tab to nagivate to given url. | |
47 // Should be called on browser main thread. | |
48 virtual void OpenURL(const GURL& url) = 0; | |
49 | |
50 using ScreenshotCallback = base::Callback<void(scoped_ptr<SkBitmap>)>; | |
51 // Requests an image of web contents. | |
52 // Should be called on browser main thread. | |
53 virtual void GetScreenshot(const ScreenshotCallback& callback) = 0; | |
54 | |
55 protected: | |
56 virtual content::WebContents* web_contents() = 0; | |
Sami
2015/12/01 14:03:57
Does this need to be here? I imagine the impl clas
altimin
2015/12/01 15:17:29
This is needed for Observer (which is a wrapper ar
| |
57 }; | |
Sami
2015/12/01 14:03:58
DISALLOW_COPY_AND_ASSIGN
| |
58 | |
59 } // namespace headless | |
60 | |
61 #endif // HEADLESS_PUBLIC_WEB_CONTENTS_H_ | |
OLD | NEW |