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

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: Changes according to skyostil@'s comments 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/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "headless/public/headless_export.h"
12 #include "url/gurl.h"
13
14 class SkBitmap;
15
16 namespace content {
17 class WebContents;
18 }
19
20 namespace headless {
21 class WebFrame;
22
23 // Class representing contents of a browser tab.
24 // Should be accessed from browser main thread.
25 class HEADLESS_EXPORT WebContents {
26 public:
27 virtual ~WebContents() {}
28
29 class Observer {
30 public:
31 // Will be called on browser thread.
32 virtual void DocumentOnLoadCompletedInMainFrame() = 0;
33
34 // TODO(altimin): More OnSomething() methods will go here.
35
36 protected:
37 explicit Observer(WebContents* web_contents);
38 virtual ~Observer();
39
40 private:
41 class ObserverImpl;
42 scoped_ptr<ObserverImpl> observer_;
43
44 DISALLOW_COPY_AND_ASSIGN(Observer);
45 };
46
47 // Returns main frame for web page.
48 // Should be called on browser main thread.
Sami 2015/12/01 17:47:34 Does this need to be on the renderer thread instea
altimin 2015/12/01 18:42:46 Oh, my bad. Yes, renderer thread indeed, thanks!
49 virtual WebFrame* MainFrame() = 0;
50
51 // Requests browser tab to nagivate to given url.
52 // Should be called on browser main thread.
53 virtual void OpenURL(const GURL& url) = 0;
54
55 using ScreenshotCallback = base::Callback<void(scoped_ptr<SkBitmap>)>;
56 // Requests an image of web contents.
57 // Should be called on browser main thread.
58 virtual void GetScreenshot(const ScreenshotCallback& callback) = 0;
59
60 protected:
61 virtual content::WebContents* web_contents() = 0;
62
63 private:
64 DISALLOW_COPY_AND_ASSIGN(WebContents);
65 };
66
67 } // namespace headless
68
69 #endif // HEADLESS_PUBLIC_WEB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698