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

Unified Diff: headless/public/headless_web_contents.h

Issue 1674263002: headless: Initial headless embedder API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fine, no console logging Mr. Presubmit. Created 4 years, 10 months 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/headless_browser.cc ('k') | headless/public/network.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/headless_web_contents.h
diff --git a/headless/public/headless_web_contents.h b/headless/public/headless_web_contents.h
new file mode 100644
index 0000000000000000000000000000000000000000..2db82e9493c4f85195f035b7a019af5516f58f32
--- /dev/null
+++ b/headless/public/headless_web_contents.h
@@ -0,0 +1,53 @@
+// 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_HEADLESS_WEB_CONTENTS_H_
+#define HEADLESS_PUBLIC_HEADLESS_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"
+
+namespace headless {
+
+// Class representing contents of a browser tab. Should be accessed from browser
+// main thread.
+class HEADLESS_EXPORT HeadlessWebContents {
+ public:
+ virtual ~HeadlessWebContents() {}
+
+ // TODO(skyostil): Replace this with an equivalent client API.
+ class Observer {
+ public:
+ // Will be called on browser thread.
+ virtual void DocumentOnLoadCompletedInMainFrame() = 0;
+
+ protected:
+ Observer() {}
+ virtual ~Observer() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Observer);
+ };
+
+ // TODO(skyostil): Replace this with an equivalent client API.
+ virtual bool OpenURL(const GURL& url) = 0;
+
+ // Add or remove an observer to receive events from this WebContents.
+ // |observer| must outlive this class or be removed prior to being destroyed.
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
+
+ private:
+ friend class HeadlessWebContentsImpl;
+ HeadlessWebContents() {}
+
+ DISALLOW_COPY_AND_ASSIGN(HeadlessWebContents);
+};
+
+} // namespace headless
+
+#endif // HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
« no previous file with comments | « headless/public/headless_browser.cc ('k') | headless/public/network.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698