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

Unified 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: More minor fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/public/network.h ('k') | headless/public/web_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/web_contents.h
diff --git a/headless/public/web_contents.h b/headless/public/web_contents.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ffb60f949afb538b403e2db85f0df70c811a8b4
--- /dev/null
+++ b/headless/public/web_contents.h
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef HEADLESS_PUBLIC_WEB_CONTENTS_H_
+#define HEADLESS_PUBLIC_WEB_CONTENTS_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "headless/public/headless_export.h"
+#include "url/gurl.h"
+
+class SkBitmap;
+
+namespace content {
+class WebContents;
+}
+
+namespace headless {
+class WebFrame;
+
+// Class representing contents of a browser tab.
+// Should be accessed from browser main thread.
+class HEADLESS_EXPORT WebContents {
ncarter (slow) 2016/01/20 22:23:20 I worry that having two "web_contents.h" headers i
+ public:
+ virtual ~WebContents() {}
+
+ class Observer {
+ public:
+ // Will be called on browser thread.
+ virtual void DocumentOnLoadCompletedInMainFrame() = 0;
+
+ // TODO(altimin): More OnSomething() methods will go here.
+
+ protected:
+ explicit Observer(WebContents* web_contents);
+ virtual ~Observer();
+
+ private:
+ class ObserverImpl;
+ scoped_ptr<ObserverImpl> observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(Observer);
+ };
+
+ // Returns main frame for web page.
+ // Should be called on renderer main thread.
+ virtual WebFrame* MainFrame() = 0;
+
+ // Requests browser tab to nagivate to given url.
+ // Should be called on browser main thread.
+ virtual void OpenURL(const GURL& url) = 0;
+
+ using ScreenshotCallback = base::Callback<void(scoped_ptr<SkBitmap>)>;
+ // Requests an image of web contents.
+ // Should be called on browser main thread.
+ virtual void GetScreenshot(const ScreenshotCallback& callback) = 0;
+
+ protected:
+ virtual content::WebContents* web_contents() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebContents);
+};
+
+} // namespace headless
+
+#endif // HEADLESS_PUBLIC_WEB_CONTENTS_H_
« no previous file with comments | « headless/public/network.h ('k') | headless/public/web_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698