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

Unified Diff: headless/lib/browser/headless_web_contents_impl.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
Index: headless/lib/browser/headless_web_contents_impl.h
diff --git a/headless/lib/browser/headless_web_contents_impl.h b/headless/lib/browser/headless_web_contents_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..b272bfe9dab44cca80bb5a2c24e0eb4694774070
--- /dev/null
+++ b/headless/lib/browser/headless_web_contents_impl.h
@@ -0,0 +1,60 @@
+// 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_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_
+#define HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_
+
+#include "headless/public/headless_web_contents.h"
+
+#include <unordered_map>
+
+namespace aura {
+class Window;
+}
+
+namespace content {
+class WebContents;
+class BrowserContext;
+}
+
+namespace gfx {
+class Size;
+}
+
+namespace headless {
+class WebContentsObserverAdapter;
+
+class HeadlessWebContentsImpl : public HeadlessWebContents {
+ public:
+ ~HeadlessWebContentsImpl() override;
+
+ // HeadlessWebContents implementation:
+ bool OpenURL(const GURL& url) override;
+ void AddObserver(Observer* observer) override;
+ void RemoveObserver(Observer* observer) override;
+
+ content::WebContents* web_contents() const;
+
+ private:
+ friend class HeadlessBrowserImpl;
+
+ HeadlessWebContentsImpl(content::BrowserContext* context,
+ aura::Window* parent_window,
+ const gfx::Size& initial_size);
+
+ class Delegate;
+ scoped_ptr<Delegate> web_contents_delegate_;
+ scoped_ptr<content::WebContents> web_contents_;
+
+ using ObserverMap =
+ std::unordered_map<HeadlessWebContents::Observer*,
+ scoped_ptr<WebContentsObserverAdapter>>;
+ ObserverMap observer_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl);
+};
+
+} // namespace headless
+
+#endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_
« no previous file with comments | « headless/lib/browser/headless_url_request_context_getter.cc ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698