Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: headless/public/web_contents.h

Issue 1461693003: [headless] Initial skeleton of headless/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove direct dom interaction Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698